Skip to content

Commit 6ccecf3

Browse files
saumetsjraff
authored andcommitted
fix(ci): add run-build script to pipeline
1 parent 354d8e5 commit 6ccecf3

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

Jenkinsfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ finally {
102102

103103
def build(Map attrs) {
104104
node {
105-
boolean imageTagExists = sh(
106-
returnStatus: true,
107-
script: "oc get istag ${attrs.name}:${attrs.buildVersion}"
108-
) == 0
105+
unstash 'scripts'
106+
ansiColor('xterm') {
107+
sh("./openshift/run-build.sh ${attrs.name} ${attrs.buildVersion} ${attrs.gitCommitId}")
108+
}
109109
}
110110
}
111111

openshift/run-build.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
set -o nounset -o errexit
3+
4+
# Start a container build against a container on OpenShift. Used by the Build stage of the Jenkinsfile.
5+
# Usage: ./run-build.sh telus-isomorphic-starter-kit my-tag
6+
7+
NAME=${1}
8+
VERSION=${2}
9+
COMMIT=${3:-''}
10+
11+
if oc get istag ${NAME}:${VERSION} > /dev/null 2>&1
12+
then
13+
echo "Image tag ${NAME}:${VERSION} exists... skipping build"
14+
exit 0
15+
fi
16+
17+
oc start-build ${NAME} --follow --commit=${COMMIT} --wait=true
18+
19+
oc tag ${NAME}:latest ${NAME}:${VERSION}

0 commit comments

Comments
 (0)