-
Notifications
You must be signed in to change notification settings - Fork 43
Run quickstarter via Jenkins
Since the quickstarters in this repository are Jenkins-based, you can execute them without the provisioning app to experiment with them. Here is how (assuming your project is named foo
):
First, go to the FOO
Bitbucket project, then create the repository you want the quickstarter to fill, e.g. name the repository bar
.
Next, create a webhook 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_URL
required: true
- name: QUICKSTARTER
required: true
- name: ODS_GIT_REF_SHARED_LIBRARY
value: production
- name: ODS_GIT_REF_QUICKSTARTER
value: production
- name: ODS_IMAGE_TAG
value: latest
- name: PIPELINE_POSTFIX
from: '[a-z]{8}'
generate: expression
objects:
- apiVersion: v1
kind: BuildConfig
metadata:
name: ods-quickstarters-${QUICKSTARTER}-${PIPELINE_POSTFIX}
namespace: ${PROJECT_ID}-cd
spec:
nodeSelector: {}
output: {}
postCommit: {}
resources: {}
runPolicy: Serial
source:
git:
ref: ${ODS_GIT_REF_QUICKSTARTER}
uri: ${BITBUCKET_URL}/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: ${BITBUCKET_URL}/scm/${PROJECT_ID}/${COMPONENT_ID}.git
- name: ODS_IMAGE_TAG
value: ${ODS_IMAGE_TAG}
- name: ODS_GIT_REF
value: ${ODS_GIT_REF_SHARED_LIBRARY}
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_URL=https://bitbucket.example.com \
-p QUICKSTARTER=be-java-springboot \
| oc create -n foo-cd -f -
If you want to customise which quickstarter branch, shared library branch and slave image tag is used:
oc process -f qs-pipeline.yml \
-p PROJECT_ID=foo \
-p COMPONENT_ID=bar \
-p BITBUCKET_URL=https://bitbucket.example.com \
-p QUICKSTARTER=be-java-springboot \
-p ODS_IMAGE_TAG=my-tag \
-p ODS_GIT_REF_QUICKSTARTER=my-quickstarter-branch \
-p ODS_GIT_REF_SHARED_LIBRARY=my-shared-library-branch \
| oc create -n foo-cd -f -
To start provisioning a component, go to Jenkins, and select the created pipeline. Click on "Build with Parameters" and start provisioning.