rht-labs / labs-ci-cd

👻UNMAINTAINED - A collection of Red Hat Open Innovation Labs CI/CD components
Apache License 2.0
101 stars 70 forks source link

Issue 94 resolved with triggers #114

Closed jtprichett closed 6 years ago

jtprichett commented 6 years ago

https://github.com/rht-labs/labs-ci-cd/issues/94

sherl0cks commented 6 years ago

@JoshuaTPritchett Thanks for contributing. See below the build config generated by your changes in the CI job. I think for this to work as expected, you'll need to declare a parameter for each of these secrets, and then reference the parameter name in the value of the template. Check out this example of generating the github webhook secret for a rails app.

apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  creationTimestamp: '2018-01-29T03:55:15Z'
  labels:
    build: java-app
    name: java-app-pipeline
    template: s2i-app-build-template
    type: pipeline
  name: java-app-pipeline
  namespace: labs-ci-cd-pr-114
  resourceVersion: '6475648'
  selfLink: >-
    /apis/build.openshift.io/v1/namespaces/labs-ci-cd-pr-114/buildconfigs/java-app-pipeline
  uid: 36a2e7c7-04a8-11e8-9dd8-fa163eee5816
spec:
  nodeSelector: {}
  output: {}
  postCommit: {}
  resources: {}
  runPolicy: Serial
  source:
    git:
      ref: dev-demo
      uri: 'https://github.com/rht-labs/automation-api'
    type: Git
  strategy:
    jenkinsPipelineStrategy:
      jenkinsfilePath: Jenkinsfile
    type: JenkinsPipeline
  triggers:
    - type: ConfigChange
    - github:
        secret: '[A-Z0-9]{4}'
      type: GitHub
    - generic:
        secret: '[A-Z0-9]{4}'
      type: Generic
    - gitlab:
        secret: '[A-Z0-9]{4}'
      type: GitLab
    - bitbucket:
        secret: '[A-Z0-9]{4}'
      type: Bitbucket
status:
  lastVersion: 1
jtprichett commented 6 years ago

@sherl0cks Sorry, this a new construct that I just learned. The topic wasn't quite clear on the docs, thanks for the example, I hope this is what you were looking for. As a side note, I made the expression 16 character s long, I am not sure if this is too long or short?

sherl0cks commented 6 years ago

@JoshuaTPritchett no need to apologize - this is why we peer review changes. Your changes look good in CI. RE: length, it looks like oc new-app creates secrets of length 20, so if you can update your secrets to that length, I think we are good to merge this in

jtprichett commented 6 years ago

Done.

sherl0cks commented 6 years ago

@JoshuaTPritchett thank you. we welcome your contributions. feel free to keep pulling issues!