@Library('cadoles') _ pipeline { agent { dockerfile { label 'docker' filename 'Dockerfile' dir 'misc/jenkins' args '-v /var/run/docker.sock:/var/run/docker.sock --network host' } } stages { stage('Cancel older jobs') { steps { script { def buildNumber = env.BUILD_NUMBER as int if (buildNumber > 1) milestone(buildNumber - 1) milestone(buildNumber) } } } stage('Run unit tests') { steps { script { sh 'make test' } } } stage('Release binaries and packages') { when { anyOf { branch 'master' branch 'develop' } } steps { script { withCredentials([ usernamePassword([ credentialsId: 'forge-jenkins', usernameVariable: 'GITEA_RELEASE_USERNAME', passwordVariable: 'GITEA_RELEASE_PASSWORD' ]) ]) { sh 'make gitea-release' } } } } stage('Build and release Docker image') { when { anyOf { branch 'master' branch 'develop' branch 'PR-7' } } steps { script { withCredentials([ usernamePassword([ credentialsId: 'forge-jenkins', usernameVariable: 'GITEA_RELEASE_USERNAME', passwordVariable: 'GITEA_RELEASE_PASSWORD' ]) ]) { sh ''' make docker-build docker-release ''' } } } } } post { always { cleanWs() } } }