Skip to content

Commit

Permalink
enable Jenkins piepline
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrylyuk-andriy committed Oct 14, 2024
1 parent 0cbba87 commit fe7df14
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
properties([pipelineTriggers([githubPush()])])

pipeline {
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 30, unit: 'MINUTES')
}

agent {
kubernetes {
label 'worker-apibuilder-generator'
inheritFrom 'kaniko-slim'
}
}

environment {
ORG = 'flowcommerce'
}

stages {
stage('Checkout') {
steps {
checkoutWithTags scm

script {
VERSION = new flowSemver().calculateSemver() //requires checkout
}
}
}

stage('Commit SemVer tag') {
when { branch 'main' }
steps {
script {
new flowSemver().commitSemver(VERSION)
}
}
}

stage('Build and push docker image release') {
when { branch 'main' }
steps {
container('kaniko') {
script {
semver = VERSION.printable()

sh """
/kaniko/executor -f `pwd`/Dockerfile -c `pwd` \
--snapshot-mode=redo --use-new-run \
--destination ${env.ORG}/apibuilder-generator:$semver
"""

}
}
}
}

stage('Display Helm Diff') {
when {
allOf {
not { branch 'main' }
changeRequest()
expression {
return changesCheck.hasChangesInDir('deploy')
}
}
}
steps {
script {
container('helm') {
new helmDiff().diff('apibuilder-generator')
}
}
}
}

stage('Deploy Helm chart') {
when { branch 'main' }
parallel {

stage('deploy apibuilder-generator') {
steps {
script {
container('helm') {
new helmCommonDeploy().deploy('apibuilder-generator', 'apicollective', VERSION.printable(), 420)
}
}
}
}
}
}
}
}

0 comments on commit fe7df14

Please sign in to comment.