-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile.prow
72 lines (69 loc) · 2.55 KB
/
Jenkinsfile.prow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
pipeline {
agent any
environment {
ORG = 'activiti'
APP_NAME = 'activiti-cloud-query'
CHARTMUSEUM_CREDS = credentials('jenkins-x-chartmuseum')
GITHUB_CHARTS_REPO = "https://github.com/Activiti/activiti-cloud-helm-charts.git"
GITHUB_HELM_REPO_URL = "https://activiti.github.io/activiti-cloud-helm-charts/"
}
stages {
stage('CI Build and push snapshot') {
when {
branch 'PR-*'
}
environment {
PREVIEW_VERSION = "0.0.0-SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER"
PREVIEW_NAMESPACE = "$APP_NAME-$BRANCH_NAME".toLowerCase()
HELM_RELEASE = "$PREVIEW_NAMESPACE".toLowerCase()
}
steps {
sh "mvn versions:set -DnewVersion=$PREVIEW_VERSION"
sh "mvn install"
sh 'export VERSION=$PREVIEW_VERSION && skaffold build -f skaffold.yaml'
sh "jx step validate --min-jx-version 1.2.36"
sh "jx step post build --image \$DOCKER_REGISTRY/$ORG/$APP_NAME:$PREVIEW_VERSION"
//dir ('./charts/preview') {
// sh "make preview"
// sh "jx preview --app $APP_NAME --dir ../.."
//}
dir('.charts/activiti-cloud-query') {
sh "make build"
}
}
}
stage('Build Release') {
when {
branch 'master'
}
steps {
git 'https://github.com/activiti/activiti-cloud-query.git'
// so we can retrieve the version in later steps
sh "echo \$(jx-release-version) > VERSION"
sh "mvn versions:set -DnewVersion=\$(cat VERSION)"
dir ('./charts/activiti-cloud-query') {
sh "make tag"
}
sh 'mvn clean deploy'
sh 'export VERSION=`cat VERSION` && skaffold build -f skaffold.yaml'
sh "jx step post build --image \$DOCKER_REGISTRY/$ORG/$APP_NAME:\$(cat VERSION)"
}
}
stage('Promote to Environments') {
when {
branch 'master'
}
steps {
dir ('./charts/activiti-cloud-query') {
sh 'jx step changelog --version v\$(cat ../../VERSION)'
// release the helm chart
sh 'make release'
// promote through all 'Auto' promotion Environments
// sh 'jx promote -b --all-auto --timeout 1h --version \$(cat ../../VERSION) --no-wait'
sh 'jx step git credentials'
sh 'cd ../.. && updatebot push-version --kind helm $APP_NAME \$(cat VERSION)'
}
}
}
}
}