Update 'Jenkinsfile'

This commit is contained in:
dany 2022-08-02 14:32:16 +02:00
parent 236298fa32
commit bba38e35d9

83
Jenkinsfile vendored
View File

@ -1,41 +1,44 @@
def remote = [:] def remote = [:]
remote.name = 'workstation' remote.name = 'workstation'
remote.host = 'workstation' remote.host = 'workstation'
remote.user = 'dany' remote.user = 'dany'
remote.identityFile = '/var/jenkins_home/.ssh/id_rsa' remote.identityFile = '/var/jenkins_home/.ssh/id_rsa'
remote.allowAnyHosts = true remote.allowAnyHosts = true
remote.agent = false remote.agent = false
remote.logLevel = 'INFO' remote.logLevel = 'INFO'
pipeline{ pipeline{
agent { node{ label'master' }} agent { node{ label'master' }}
options { options {
// Limit build history with buildDiscarder option: // Limit build history with buildDiscarder option:
// daysToKeepStr: history is only kept up to this many days. // daysToKeepStr: history is only kept up to this many days.
// numToKeepStr: only this many build logs are kept. // numToKeepStr: only this many build logs are kept.
// artifactDaysToKeepStr: artifacts are only kept up to this many days. // artifactDaysToKeepStr: artifacts are only kept up to this many days.
// artifactNumToKeepStr: only this many builds have their artifacts kept. // artifactNumToKeepStr: only this many builds have their artifacts kept.
buildDiscarder(logRotator(numToKeepStr: "1")) buildDiscarder(logRotator(numToKeepStr: "1"))
// Enable timestamps in build log console // Enable timestamps in build log console
timestamps() timestamps()
// Maximum time to run the whole pipeline before canceling it // Maximum time to run the whole pipeline before canceling it
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
// Use Jenkins ANSI Color Plugin for log console // Use Jenkins ANSI Color Plugin for log console
ansiColor('xterm') ansiColor('xterm')
// Limit build concurrency to 1 per branch // Limit build concurrency to 1 per branch
disableConcurrentBuilds() disableConcurrentBuilds()
} }
stages stages
{ {
stage('Build') { stage('Build') {
steps { steps {
sshCommand remote: remote, command: ''' sshCommand remote: remote, command: '''
docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 set -e
docker buildx build \ export WORKSPACE=$(realpath "./jenkins/workspace/ci-image")
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \ cd $WORKSPACE
--tag xsangle/ci-tools:latest . docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
''' docker buildx build \
} --platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
} --tag xsangle/ci-tools:latest .
} '''
}
}
}
} }