Skip to content

Commit f24ad54

Browse files
committed
Updates Jenkinsfile with OpenShift annotations
1 parent 5eac450 commit f24ad54

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Jenkinsfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ spec:
153153
value: /home/devops
154154
- name: ENVIRONMENT_NAME
155155
value: ${env.NAMESPACE}
156+
- name: BRANCH
157+
value: ${branch}
156158
- name: trigger-cd
157159
image: docker.io/garagecatalyst/ibmcloud-dev:1.0.10
158160
tty: true
@@ -175,7 +177,7 @@ spec:
175177
checkout scm
176178
stage('Build') {
177179
sh '''#!/bin/bash
178-
npm install
180+
npm install --unsafe-perm
179181
npm run build --if-present
180182
'''
181183
}
@@ -253,6 +255,7 @@ spec:
253255
254256
echo "IMAGE_VERSION=$(git describe --abbrev=0 --tags)" > ./env-config
255257
echo "IMAGE_NAME=$(basename -s .git `git config --get remote.origin.url` | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')" >> ./env-config
258+
echo "REPO_URL=$(git config --get remote.origin.url)" >> ./env-config
256259
257260
cat ./env-config
258261
'''
@@ -323,6 +326,8 @@ spec:
323326
cat ${CHART_PATH}/values.yaml | \
324327
yq w - nameOverride "${IMAGE_NAME}" | \
325328
yq w - fullnameOverride "${IMAGE_NAME}" | \
329+
yq w - vcsInfo.repoUrl "${REPO_URL}" | \
330+
yq w - vcsInfo.branch "${BRANCH}" | \
326331
yq w - image.repository "${IMAGE_REPOSITORY}" | \
327332
yq w - image.tag "${IMAGE_VERSION}" | \
328333
yq w - ingress.enabled "${INGRESS_ENABLED}" | \

chart/base/templates/deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: {{ include "starter-kit.fullname" . }}
5+
{{- if and .Values.vcsInfo.repoUrl .Values.vcsInfo.branch }}
6+
annotations:
7+
app.openshift.io/vcs-ref: {{ .Values.vcsInfo.branch }}
8+
app.openshift.io/vcs-uri: {{ .Values.vcsInfo.repoUrl }}
9+
{{- end }}
510
labels:
611
app.kubernetes.io/name: {{ include "starter-kit.name" . }}
712
helm.sh/chart: {{ include "starter-kit.chart" . }}

chart/base/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ ingress:
3535
path: "/"
3636

3737
# tlsSecretName: ""
38+
39+
vcsInfo:
40+
repoUrl: ""
41+
branch: ""

0 commit comments

Comments
 (0)