-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jenkins Pipeline creation in makefile
- Loading branch information
Showing
3 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
apiVersion: template.openshift.io/v1 | ||
kind: Template | ||
parameters: | ||
- name: PROJECT | ||
displayName: Application | ||
description: The name of the application project. | ||
required: true | ||
- name: ODS_GIT_REF | ||
displayName: Git branch | ||
description: The git branch to use for the pipeline. | ||
required: true | ||
- name: ODS_IMAGE_TAG | ||
displayName: Agent tag | ||
description: The tag for the jenkins golang agent. | ||
required: true | ||
- name: ODS_NAMESPACE | ||
displayName: ODS namespace | ||
description: The ods namespae to fetch the jenkins agent. Include "-cd" if the ODS Namespace is not ods as default | ||
required: true | ||
- name: BITBUCKET_URL | ||
displayName: Bitbucket server URL | ||
description: The Bitbucket server URL. | ||
required: true | ||
- name: ODS_BITBUCKET_PROJECT | ||
displayName: ODS Bitbucket project | ||
description: The ODS Bitbucket project. | ||
required: true | ||
- name: SONAR_QUALITY_PROFILE | ||
displayName: SonarQube Quality Profile | ||
description: SonarQube Quality Profile. | ||
required: true | ||
- name: QuickstarterRepository | ||
displayName: Quickstarter repository | ||
description: Quickstarter repository. | ||
required: true | ||
objects: | ||
- apiVersion: build.openshift.io/v1 | ||
kind: BuildConfig | ||
metadata: | ||
labels: | ||
template: golden-test-pipeline | ||
name: '${PROJECT}-golden-test' | ||
spec: | ||
failedBuildsHistoryLimit: 5 | ||
runPolicy: Serial | ||
source: | ||
git: | ||
ref: ${ODS_GIT_REF} | ||
uri: '${BITBUCKET_URL}/${ODS_BITBUCKET_PROJECT}/ods-core.git' | ||
sourceSecret: | ||
name: cd-user-with-password | ||
type: Git | ||
strategy: | ||
jenkinsPipelineStrategy: | ||
env: | ||
- name: Quickstarter | ||
value: '' | ||
- name: QuickstarterRepository | ||
value: '${QuickstarterRepository}' | ||
- name: quickstarterRef | ||
value: '${ODS_GIT_REF}' | ||
- name: Project | ||
value: '${PROJECT}' | ||
- name: ODS_NAMESPACE | ||
value: '${ODS_NAMESPACE}' | ||
- name: ODS_URL | ||
value: '${BITBUCKET_URL}/${ODS_BITBUCKET_PROJECT}' | ||
- name: JENKINS_AGENT_TAG | ||
value: '${ODS_IMAGE_TAG}' | ||
- name: SONAR_QUALITY_PROFILE | ||
value: '${SONAR_QUALITY_PROFILE}' | ||
- name: excludedQuickstarters | ||
value: '' | ||
jenkinsfilePath: Jenkinsfile | ||
type: JenkinsPipeline | ||
successfulBuildsHistoryLimit: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
set -eux | ||
|
||
PROJECT="" | ||
QuickstarterRepository="" | ||
SONAR_QUALITY_PROFILE="" | ||
ODS_GIT_REF="$ODS_GIT_REF" | ||
BITBUCKET_URL="$BITBUCKET_URL" | ||
ODS_NAMESPACE="$ODS_NAMESPACE" | ||
ODS_IMAGE_TAG="$ODS_IMAGE_TAG" | ||
ODS_BITBUCKET_PROJECT="$ODS_BITBUCKET_PROJECT" | ||
|
||
# Override ods configuration (optional) | ||
while [[ "$#" > 0 ]]; do case $1 in | ||
-g=*|--ods-git-ref=*) ODS_GIT_REF="${1#*=}";; | ||
-g|--ods-git-ref) ODS_GIT_REF="$2"; shift;; | ||
|
||
-b=*|--bitbucket=*) BITBUCKET_URL="${1#*=}";; | ||
-b|--bitbucket) BITBUCKET_URL="$2"; shift;; | ||
|
||
-n=*|--ods-namespace=*) ODS_NAMESPACE="${1#*=}";; | ||
-n|--ods-namespace) ODS_NAMESPACE="$2"; shift;; | ||
|
||
-i=*|--ods-image-tag=*) ODS_IMAGE_TAG="${1#*=}";; | ||
-i|--ods-image-tag) ODS_IMAGE_TAG="$2"; shift;; | ||
|
||
-m=*|--bitbucket-ods-project=*) ODS_BITBUCKET_PROJECT="${1#*=}";; | ||
-m|--bitbucket-ods-project) ODS_BITBUCKET_PROJECT="$2"; shift;; | ||
|
||
-p=*|--project=*) PROJECT="${1#*=}";; | ||
-p|--project) PROJECT="$2"; shift;; | ||
|
||
-q=*|--quickstarter-repository=*) QuickstarterRepository="${1#*=}";; | ||
-q|--quickstarter-repository) QuickstarterRepository="$2"; shift;; | ||
|
||
-s=*|--sonar-quality-profile=*) SONAR_QUALITY_PROFILE="${1#*=}";; | ||
-s|--sonar-quality-profile) SONAR_QUALITY_PROFILE="$2"; shift;; | ||
|
||
*) echo "Unknown parameter passed: $1"; exit 1;; | ||
esac; shift; done | ||
|
||
# echo "create trigger secret" | ||
# SECRET=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '') | ||
|
||
tailor --namespace=${PROJECT}-cd --non-interactive \ | ||
apply \ | ||
--param=ODS_GIT_REF=${ODS_GIT_REF} \ | ||
--param=PROJECT=${PROJECT} \ | ||
--param=BITBUCKET_URL=${BITBUCKET_URL} \ | ||
--param=ODS_NAMESPACE=${ODS_NAMESPACE} \ | ||
--param=ODS_IMAGE_TAG=${ODS_IMAGE_TAG} \ | ||
--param=ODS_BITBUCKET_PROJECT=${ODS_BITBUCKET_PROJECT} \ | ||
--param=SONAR_QUALITY_PROFILE="${SONAR_QUALITY_PROFILE}" \ | ||
--param=QuickstarterRepository=${QuickstarterRepository} \ | ||
--selector template=golden-test-pipeline |