Redis operator for Kubernetes with HAProxy support
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.
 
 
 
 

55 lines
1.4 KiB

node('node1') {
checkout scm
def branch = env.BRANCH_NAME
def build = env.BUILD_NUMBER
def image
def repository = "iam21h/redis-operator"
def image_name = "${repository}"
def commit_hash = checkout(scm).GIT_COMMIT
def git_tag = env.TAG_NAME
def version
stage("Read version from file") {
try {
version = readFile file: "VERSION"
echo "Detected version: ${version}"
image_name = "${repository}:${version}"
} catch (Exception e) {
error("Failed to read version from file")
}
}
stage("Build Image") {
try {
sh "docker build -t ${image_name} ."
image = docker.image(image_name)
} catch (Exception e) {
error("Failed to build image")
}
}
if ( git_tag != null ) {
stage("Update Helm Chart") {
sh "tar -zcvf /var/www/charts.blindage.org/redis-operator-${version}.tgz -C deploy/helm_chart ."
sh "cd /var/www/charts.blindage.org/ && helm repo index ."
}
stage("Push Image") {
try {
docker.withRegistry("", "dockerhub") {
image.push()
}
} catch(Exception e) {
echo "${e}"
error("Failed to push image")
} finally {
// cleanup
sh "docker rmi ${image_name} || true"
}
}
}
}