Stages now gated by branch: - PR-*: test only - feature/*: test + build/push + helm bump + git push - develop/main/release/hotfix: test + build/push only
54 lines
1.4 KiB
Groovy
54 lines
1.4 KiB
Groovy
@Library('homelab') _
|
|
|
|
import vn.fireflylab.pipeline.BranchStrategy
|
|
|
|
pipeline {
|
|
agent {
|
|
kubernetes {
|
|
yaml homelabK8sAgent(withTools: true)
|
|
}
|
|
}
|
|
|
|
environment {
|
|
DOCKER_HOST = 'tcp://localhost:2375'
|
|
}
|
|
|
|
stages {
|
|
stage('Install & Test') {
|
|
steps {
|
|
container('node') {
|
|
runNodeTest()
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Build & Push Image') {
|
|
when { expression { BranchStrategy.shouldBuildImage(env.BRANCH_NAME) } }
|
|
steps {
|
|
container('docker') {
|
|
script {
|
|
def tag = BranchStrategy.imageTag(env.BRANCH_NAME)
|
|
env.IMAGE_TAG = tag
|
|
dockerBuildPush(appName: 'tictactoe', tag: tag)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Bump Helm Chart') {
|
|
when { expression { BranchStrategy.shouldBumpChart(env.BRANCH_NAME) } }
|
|
steps {
|
|
container('tools') {
|
|
script {
|
|
bumpHelmChart(imageTag: env.IMAGE_TAG)
|
|
gitCommitPush(
|
|
files: ['manifest/helm/Chart.yaml', 'manifest/helm/values.yaml'],
|
|
message: "ci: bump tictactoe chart to ${env.IMAGE_TAG}"
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|