2023-03-31 14:29:10 +02:00
|
|
|
@Library('cadoles') _
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
agent {
|
|
|
|
dockerfile {
|
|
|
|
label 'docker'
|
|
|
|
filename 'Dockerfile'
|
|
|
|
dir 'misc/jenkins'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2023-04-06 15:12:06 +02:00
|
|
|
stage('Cancel older jobs') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
def buildNumber = env.BUILD_NUMBER as int
|
|
|
|
if (buildNumber > 1) milestone(buildNumber - 1)
|
|
|
|
milestone(buildNumber)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-25 18:36:18 +02:00
|
|
|
|
2023-03-31 14:29:10 +02:00
|
|
|
stage('Run unit tests') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
withCredentials([
|
|
|
|
usernamePassword([
|
2023-04-06 10:30:40 +02:00
|
|
|
credentialsId: 'forge-jenkins',
|
|
|
|
usernameVariable: 'GIT_USERNAME',
|
|
|
|
passwordVariable: 'GIT_PASSWORD'
|
2023-03-31 14:29:10 +02:00
|
|
|
])
|
|
|
|
]) {
|
|
|
|
sh '''
|
2023-03-31 17:31:44 +02:00
|
|
|
git config --global credential.https://forge.cadoles.com.username "$GIT_USERNAME"
|
|
|
|
git config --global credential.https://forge.cadoles.com.helper '!f() { test "$1" = get && echo "password=$GIT_PASSWORD"; }; f'
|
|
|
|
|
2023-03-31 14:29:10 +02:00
|
|
|
export GOPRIVATE=forge.cadoles.com/arcad/edge
|
|
|
|
make test
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Release') {
|
|
|
|
when {
|
|
|
|
anyOf {
|
|
|
|
branch 'master'
|
|
|
|
branch 'develop'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
withCredentials([
|
|
|
|
usernamePassword([
|
2023-04-06 10:30:40 +02:00
|
|
|
credentialsId: 'forge-jenkins',
|
|
|
|
usernameVariable: 'GITEA_RELEASE_USERNAME',
|
|
|
|
passwordVariable: 'GITEA_RELEASE_PASSWORD'
|
2023-03-31 14:29:10 +02:00
|
|
|
])
|
|
|
|
]) {
|
2023-08-25 18:36:18 +02:00
|
|
|
sh """
|
|
|
|
export MKT_PROJECT_VERSION_BRANCH_NAME=${env.BRANCH_NAME}
|
2023-08-25 17:56:28 +02:00
|
|
|
make mktools
|
|
|
|
make gitea-release
|
2023-08-25 18:36:18 +02:00
|
|
|
"""
|
2023-03-31 14:29:10 +02:00
|
|
|
}
|
2023-08-25 18:36:18 +02:00
|
|
|
|
2023-08-25 18:45:15 +02:00
|
|
|
String currentVersion = sh(script: 'make version', returnStdout: true).trim()
|
|
|
|
|
2023-08-25 18:20:42 +02:00
|
|
|
build(
|
|
|
|
job: "../emissary-firmware/${env.GIT_BRANCH}",
|
|
|
|
parameters: [
|
|
|
|
[$class: 'StringParameterValue', name: 'emissaryRelease', value: currentVersion]
|
|
|
|
],
|
|
|
|
wait: false
|
|
|
|
)
|
2023-03-31 14:29:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
cleanWs()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|