pixelfed/Jenkinsfile

108 lines
3.7 KiB
Text
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"
timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC'))
pipeline {
agent any
2023-06-05 22:16:19 +00:00
environment {
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 {
2023-10-17 09:53:26 +00:00
stage('Prepare') {
2020-10-30 17:49:09 +00:00
steps {
2023-06-05 22:16:19 +00:00
script {
2023-10-17 09:53:26 +00:00
sh "buildah login -u " + IO_CRED_USR+ " -p " + IO_CRED_PSW + " docker.io"
sh "buildah login -u " + QUAY_CRED_USR+ " -p " + QUAY_CRED_PSW + " quay.io"
sh "buildah manifest create pixelfed-dev"
sh "buildah manifest create pixelfed-dev-fpm"
2023-06-05 22:16:19 +00:00
}
2023-10-17 09:53:26 +00:00
}
}
stage('Build dev amd64') {
steps {
2023-06-05 22:16:19 +00:00
script {
2023-12-08 20:02:02 +00:00
sh "TMPDIR=/buildah/tmp buildah bud -f Containerfile --build-arg DATE=$timeStamp --manifest pixelfed-dev --arch amd64"
2023-06-05 22:16:19 +00:00
}
2023-10-17 09:53:26 +00:00
}
}
stage('Build dev arm64') {
steps {
2023-06-05 22:16:19 +00:00
script {
2023-12-08 20:02:02 +00:00
sh "TMPDIR=/buildah/tmp buildah bud -f Containerfile --build-arg DATE=$timeStamp --manifest pixelfed-dev --arch arm64"
2023-10-17 09:53:26 +00:00
}
}
}
stage('Build dev-fpm amd64') {
steps {
script {
2023-12-08 20:02:02 +00:00
sh "TMPDIR=/buildah/tmp buildah bud -f Containerfile.fpm --build-arg DATE=$timeStamp --manifest pixelfed-dev-fpm --arch amd64"
2023-10-17 09:53:26 +00:00
}
}
}
stage('Build dev-fpm arm64') {
steps {
script {
2023-12-08 20:02:02 +00:00
sh "TMPDIR=/buildah/tmp buildah bud -f Containerfile.fpm --build-arg DATE=$timeStamp --manifest pixelfed-dev-fpm --arch arm64"
2023-10-17 09:53:26 +00:00
}
}
}
stage('Upload to quay.io') {
steps {
script {
sh "buildah manifest push --all pixelfed-dev docker://quay.io/zknt/pixelfed:dev"
sh "buildah manifest push --all pixelfed-dev docker://quay.io/zknt/pixelfed:latest"
sh "buildah manifest push --all pixelfed-dev docker://quay.io/zknt/pixelfed:$timeStamp"
sh "buildah manifest push --all pixelfed-dev-fpm docker://quay.io/zknt/pixelfed:dev-fpm"
sh "buildah manifest push --all pixelfed-dev-fpm docker://quay.io/zknt/pixelfed:fpm"
sh "buildah manifest push --all pixelfed-dev-fpm docker://quay.io/zknt/pixelfed:$timeStamp-fpm"
}
}
}
stage('Upload to docker.io') {
steps {
script {
sh "buildah manifest push --all pixelfed-dev docker://docker.io/zknt/pixelfed:dev"
sh "buildah manifest push --all pixelfed-dev docker://docker.io/zknt/pixelfed:latest"
sh "buildah manifest push --all pixelfed-dev docker://docker.io/zknt/pixelfed:$timeStamp"
sh "buildah manifest push --all pixelfed-dev-fpm docker://docker.io/zknt/pixelfed:dev-fpm"
sh "buildah manifest push --all pixelfed-dev-fpm docker://docker.io/zknt/pixelfed:fpm"
sh "buildah manifest push --all pixelfed-dev-fpm docker://docker.io/zknt/pixelfed:$timeStamp-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-10-17 09:53:26 +00:00
emailext body: 'build finished', subject: '[jenkins] docker '+project+'('+timeStamp+'): ' + 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
}