Skip to content

Run quickstarter via Jenkins

Manuel Feller edited this page Nov 22, 2019 · 14 revisions

Since the quickstarters in this repository are Jenkins-based, you can execute them without a provisioning app to experiment with them. Here is how (assuming your project is named foo):

First, create the repository you want the quickstarter to fill in the FOO Bitbucket project, e.g. name the repository bar.

If you want to trigger builds via webhook, go to "Settings > Webhooks" and enter hook as described in https://www.opendevstack.org/ods-documentation/ods-core/latest/jenkins/webhook-proxy.html#_adding_a_webhook_in_bitbucket.

Then, create a pipeline for the quickstarter provisioning. Save the following in a file named qs-pipeline.yml:

apiVersion: v1
kind: Template
parameters:
- name: PROJECT_ID
  required: true
- name: COMPONENT_ID
  required: true
- name: BITBUCKET_HOST
  required: true
- name: QUICKSTARTER
  required: true
objects:
- apiVersion: v1
  kind: BuildConfig
  metadata:
    name: ods-quickstarters-${QUICKSTARTER}-production
    namespace: ${PROJECT_ID}-cd
  spec:
    nodeSelector: {}
    output: {}
    postCommit: {}
    resources: {}
    runPolicy: Serial
    source:
      git:
        ref: production
        uri: >-
          https://cd_user@${BITBUCKET_HOST}/scm/opendevstack/ods-quickstarters.git
      sourceSecret:
        name: cd-user-with-password
      type: Git
    strategy:
      jenkinsPipelineStrategy:
        env:
          - name: PROJECT_ID
            value: ${PROJECT_ID}
          - name: COMPONENT_ID
            value: ${COMPONENT_ID}
          - name: PACKAGE_NAME
            value: org.opendevstack.${COMPONENT_ID}
          - name: GIT_URL_HTTP
            value: 'https://cd_user@${BITBUCKET_HOST}/${PROJECT_ID}/${COMPONENT_ID}.git'
          - name: GIT_URL_SSH
            value: ''
        jenkinsfilePath: ${QUICKSTARTER}/Jenkinsfile
      type: JenkinsPipeline
    triggers: []

Then create this pipeline (replacing the params as required):

oc process -f qs-pipeline.yml -p PROJECT_ID=foo -p COMPONENT_ID=bar -p BITBUCKET_HOST=bitbucket.example.com -p QUICKSTARTER=be-java-springboot | oc create -n foo-cd -f -

Go to Jenkins, and select the created pipeline. Click on "Build with Parameters" and start provisioning.

Note: You can simply change to your custom branch by changing all occurences of production in the template to your branch.

Clone this wiki locally