Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (88 sloc) 2.86 KB
pipeline {
agent {
label "jenkins-go"
}
environment {
ORG = 'junibutler'
APP_NAME = 'gojenx'
GIT_PROVIDER = 'github.com'
CHARTMUSEUM_CREDS = credentials('jenkins-x-chartmuseum')
}
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 {
dir ('/home/jenkins/go/src/github.com/junibutler/gojenx') {
checkout scm
container('go') {
sh "make linux"
sh 'export VERSION=$PREVIEW_VERSION && skaffold run -f skaffold.yaml'
}
}
dir ('/home/jenkins/go/src/github.com/junibutler/gojenx/charts/preview') {
container('go') {
sh "make preview"
sh "jx preview --app $APP_NAME --dir ../.."
}
}
}
}
stage('Build Release') {
when {
branch 'master'
}
steps {
container('go') {
dir ('/home/jenkins/go/src/github.com/junibutler/gojenx') {
checkout scm
// so we can retrieve the version in later steps
sh "echo \$(jx-release-version) > VERSION"
}
dir ('/home/jenkins/go/src/github.com/junibutler/gojenx/charts/gojenx') {
// ensure we're not on a detached head
sh "git checkout master"
// until we switch to the new kubernetes / jenkins credential implementation use git credentials store
sh "git config --global credential.helper store"
sh "jx step validate --min-jx-version 1.1.73"
sh "jx step git credentials"
sh "make tag"
}
dir ('/home/jenkins/go/src/github.com/junibutler/gojenx') {
container('go') {
sh "make build"
sh 'export VERSION=`cat VERSION` && skaffold build -f skaffold.yaml'
}
}
}
}
}
stage('Promote to Environments') {
when {
branch 'master'
}
steps {
dir ('/home/jenkins/go/src/github.com/junibutler/gojenx/charts/gojenx') {
container('go') {
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)'
}
}
}
}
}
post {
always {
cleanWs()
}
}
}
You can’t perform that action at this time.