pixelfed/Jenkinsfile

96 lines
4.0 KiB
Plaintext
Raw Normal View History

2020-10-30 17:49:09 +00:00
version = ""
2020-05-28 16:19:38 +00:00
project = "pixelfed"
repo = "zknt"
registry = "reg.zknt.org"
timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC'))
pipeline {
agent any
2023-06-05 22:16:19 +00:00
environment {
ZKNT_CRED = credentials("6ff44976-23cd-4cc2-902c-de8c340e65e5")
IO_CRED = credentials("3deeee3d-6fce-4430-98dd-9b4db56f43f7")
QUAY_CRED = credentials("18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a")
2020-05-28 16:19:38 +00:00
}
2020-10-30 17:49:09 +00:00
stages {
stage('Build image') {
steps {
2023-06-05 22:16:19 +00:00
script {
sh "buildah login -u " + ZKNT_CRED_USR + " -p " + ZKNT_CRED_PSW + " reg.zknt.org"
def image = registry + '/' + repo + '/' + project
2023-10-07 13:08:30 +00:00
sh "buildah bud -f Containerfile --build-arg DATE=$timeStamp -t pixelfed:dev"
sh "buildah bud -f Containerfile.fpm --build-arg DATE=$timeStamp -t pixelfed:dev-fpm"
sh "buildah tag pixelfed:dev reg.zknt.org/zknt/pixelfed:dev"
sh "buildah tag pixelfed:dev reg.zknt.org/zknt/pixelfed:latest"
sh "buildah tag pixelfed:dev-fpm reg.zknt.org/zknt/pixelfed:dev-fpm"
sh "buildah tag pixelfed:dev-fpm reg.zknt.org/zknt/pixelfed:fpm"
2023-10-07 13:12:15 +00:00
sh "buildah push reg.zknt.org/zknt/pixelfed:dev"
sh "buildah push reg.zknt.org/zknt/pixelfed:latest"
sh "buildah push reg.zknt.org/zknt/pixelfed:dev-fpm"
sh "buildah push reg.zknt.org/zknt/pixelfed:fpm"
2023-06-05 22:16:19 +00:00
}
script {
2023-06-09 17:55:53 +00:00
sh "buildah login -u " + IO_CRED_USR+ " -p " + IO_CRED_PSW + " docker.io"
2023-10-07 13:08:30 +00:00
sh "buildah tag pixelfed:dev docker.io/zknt/pixelfed:dev"
sh "buildah tag pixelfed:dev docker.io/zknt/pixelfed:latest"
2023-10-07 13:12:15 +00:00
sh "buildah tag pixelfed:dev docker.io/zknt/pixelfed:$timeStamp"
2023-10-07 13:08:30 +00:00
sh "buildah tag pixelfed:dev-fpm docker.io/zknt/pixelfed:dev-fpm"
sh "buildah tag pixelfed:dev-fpm docker.io/zknt/pixelfed:fpm"
2023-10-07 13:12:15 +00:00
sh "buildah tag pixelfed:dev-fpm docker.io/zknt/pixelfed:$timeStamp-fpm"
2023-10-07 13:08:30 +00:00
sh "buildah push docker.io/zknt/pixelfed:dev"
sh "buildah push docker.io/zknt/pixelfed:dev-fpm"
sh "buildah push docker.io/zknt/pixelfed:latest"
2023-10-07 13:12:15 +00:00
sh "buildah push docker.io/zknt/pixelfed:$timeStamp"
sh "buildah push docker.io/zknt/pixelfed:$timeStamp-fpm"
2023-08-09 09:13:30 +00:00
sh "buildah push docker.io/zknt/pixelfed:fpm"
2023-06-05 22:16:19 +00:00
}
script {
2023-06-09 17:55:53 +00:00
sh "buildah login -u " + QUAY_CRED_USR+ " -p " + QUAY_CRED_PSW + " quay.io"
2023-10-07 13:08:30 +00:00
sh "buildah tag pixelfed:dev quay.io/zknt/pixelfed:dev"
sh "buildah tag pixelfed:dev quay.io/zknt/pixelfed:latest"
2023-10-07 13:12:15 +00:00
sh "buildah tag pixelfed:dev quay.io/zknt/pixelfed:$timeStamp"
2023-10-07 13:08:30 +00:00
sh "buildah tag pixelfed:dev-fpm quay.io/zknt/pixelfed:dev-fpm"
sh "buildah tag pixelfed:dev-fpm quay.io/zknt/pixelfed:fpm"
2023-10-07 13:12:15 +00:00
sh "buildah tag pixelfed:dev-fpm quay.io/zknt/pixelfed:$timeStamp-fpm"
2023-10-07 13:08:30 +00:00
sh "buildah push quay.io/zknt/pixelfed:dev"
sh "buildah push quay.io/zknt/pixelfed:latest"
2023-10-07 13:12:15 +00:00
sh "buildah push quay.io/zknt/pixelfed:$timeStamp"
2023-10-07 13:08:30 +00:00
sh "buildah push quay.io/zknt/pixelfed:dev-fpm"
2023-10-07 13:12:15 +00:00
sh "buildah push quay.io/zknt/pixelfed:$timeStamp-fpm"
2023-08-09 09:13:30 +00:00
sh "buildah push quay.io/zknt/pixelfed:fpm"
2020-05-28 16:19:38 +00:00
}
}
}
}
post {
2020-11-04 00:54:50 +00:00
always {
2023-06-07 02:34:44 +00:00
sh """buildah rmi -af"""
2023-07-17 08:49:42 +00:00
emailext body: 'build finished', subject: '[jenkins] docker '+project+'('+timeStamp+'-test): ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true
2020-06-22 12:10:13 +00:00
}
2020-05-28 16:19:38 +00:00
}
options {
buildDiscarder(BuildHistoryManager([
[
conditions: [
BuildResult(matchFailure: true)
],
matchAtMost: 4,
continueAfterMatch: false
],
[
conditions: [
BuildResult(matchSuccess: true)
],
matchAtMost: 4,
continueAfterMatch: false
],
[
conditions: [
BuildResult(matchSuccess: true, matchFailure: true)
],
actions: [DeleteBuild()]
]
]))
}
2023-06-05 22:16:19 +00:00
}