Operator for CronJob resources
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

58 lines
1.7 KiB

node {
checkout scm
def branch = env.BRANCH_NAME
def build = env.BUILD_NUMBER
def image
def repository = 'iam21h/cron-operator'
def git_tag = env.TAG_NAME
if (branch == "master") {
stage('Publish master') {
try {
docker.build(repository)
image = docker.image(repository)
docker.withRegistry('', 'dockerhub') {
image.push('latest')
}
} catch (Exception e) {
error('Failed to push image', e)
} finally {
sh "docker rmi ${repository}:latest || true"
}
}
}
if ( git_tag != null ) {
stage('Config new version') {
try {
echo "Detected version: ${git_tag}"
writeFile file: "version/VERSION", text: "${git_tag}"
image_name = "${repository}:${git_tag}"
sh "sed -i 's/0.0.0/${git_tag}/g' helm_chart/Chart.yaml"
} catch (Exception e) {
error('Failed to set version', e)
}
}
stage('Update Helm Chart') {
sh "tar -zcvf /var/www/charts.blindage.org/cron-operator-${git_tag}.tgz -C helm_chart ."
sh 'cd /var/www/charts.blindage.org/ && helm repo index .'
}
stage('Publish version') {
try {
docker.build(repository)
image = docker.image(repository)
docker.withRegistry('', 'dockerhub') {
image.push(git_tag)
}
} catch (Exception e) {
error('Failed to push image', e)
} finally {
sh "docker rmi ${repository}:${git_tag} || true"
}
}
}
}