2020-11-26 02:59:36 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
|
|
|
|
2020-11-30 11:59:53 +00:00
|
|
|
options {
|
|
|
|
timestamps()
|
2022-06-08 11:48:30 +00:00
|
|
|
timeout(time: 20, unit: 'MINUTES')
|
2020-11-30 11:59:53 +00:00
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
2020-11-26 02:59:36 +00:00
|
|
|
parameters {
|
|
|
|
string(
|
2020-11-30 11:59:53 +00:00
|
|
|
name: 'MAKE_TARGET',
|
|
|
|
description: 'Makefile target to build. Optional Parameter.',
|
|
|
|
defaultValue: params.MAKE_TARGET ?: 'wakunode2',
|
2020-11-26 02:59:36 +00:00
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'IMAGE_TAG',
|
2020-11-30 11:59:53 +00:00
|
|
|
description: 'Name of Docker tag to push. Optional Parameter.',
|
2022-09-28 12:31:10 +00:00
|
|
|
defaultValue: params.IMAGE_TAG ?: 'deploy-wakuv2-test',
|
2020-11-26 02:59:36 +00:00
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'IMAGE_NAME',
|
2020-11-30 11:59:53 +00:00
|
|
|
description: 'Name of Docker image to push.',
|
2023-09-26 10:09:20 +00:00
|
|
|
defaultValue: params.IMAGE_NAME ?: 'wakuorg/nwaku',
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'DOCKER_CRED',
|
|
|
|
description: 'Name of Docker Hub credential.',
|
|
|
|
defaultValue: params.DOCKER_CRED ?: 'dockerhub-vacorgbot-api-token',
|
2020-11-26 02:59:36 +00:00
|
|
|
)
|
|
|
|
string(
|
2022-05-17 19:11:07 +00:00
|
|
|
name: 'NIMFLAGS',
|
2020-11-30 11:59:53 +00:00
|
|
|
description: 'Flags for Nim compilation.',
|
2022-07-22 11:45:47 +00:00
|
|
|
defaultValue: params.NIMFLAGS ?: [
|
|
|
|
'--colors:off',
|
|
|
|
'-d:disableMarchNative',
|
|
|
|
'-d:chronicles_colors:none',
|
|
|
|
'-d:insecure',
|
2023-09-26 08:11:38 +00:00
|
|
|
'-d:postgres',
|
2022-07-22 11:45:47 +00:00
|
|
|
].join(' ')
|
2020-11-26 02:59:36 +00:00
|
|
|
)
|
2023-05-23 08:44:57 +00:00
|
|
|
string(
|
|
|
|
name: "LOG_LEVEL",
|
|
|
|
description: "Chronicles log level (default: TRACE)",
|
|
|
|
)
|
2023-05-15 16:25:25 +00:00
|
|
|
booleanParam(
|
|
|
|
name: 'DEBUG',
|
|
|
|
description: 'Enable debug features (heaptrack).',
|
|
|
|
defaultValue: false
|
|
|
|
)
|
2020-11-26 02:59:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
steps { script {
|
|
|
|
image = docker.build(
|
2023-09-11 06:32:31 +00:00
|
|
|
"${params.IMAGE_NAME}:${env.GIT_COMMIT.take(8)}",
|
2022-02-21 15:42:27 +00:00
|
|
|
"--label=commit='${env.GIT_COMMIT.take(8)}' " +
|
2020-11-30 11:59:53 +00:00
|
|
|
"--build-arg=MAKE_TARGET='${params.MAKE_TARGET}' " +
|
2022-12-01 10:28:09 +00:00
|
|
|
"--build-arg=NIMFLAGS='${params.NIMFLAGS}' " +
|
2023-05-23 08:44:57 +00:00
|
|
|
(params.LOG_LEVEL != null ? "--build-arg=LOG_LEVEL='${params.LOG_LEVEL}' ": "") +
|
2023-05-15 16:25:25 +00:00
|
|
|
"--target=${params.DEBUG ? "debug" : "prod"} ."
|
2020-11-26 02:59:36 +00:00
|
|
|
)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
2023-06-27 13:28:36 +00:00
|
|
|
stage('Check') {
|
|
|
|
steps { script {
|
|
|
|
image.inside('--entrypoint=""') { c ->
|
|
|
|
sh '/usr/bin/wakunode --version'
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
2020-11-26 02:59:36 +00:00
|
|
|
stage('Push') {
|
|
|
|
steps { script {
|
2023-09-26 10:09:20 +00:00
|
|
|
withDockerRegistry([
|
|
|
|
credentialsId: params.DOCKER_CRED, url: ""
|
|
|
|
]) {
|
2020-11-26 02:59:36 +00:00
|
|
|
image.push()
|
2020-11-30 11:59:53 +00:00
|
|
|
image.push(env.IMAGE_TAG)
|
2020-11-26 02:59:36 +00:00
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
} // stages
|
|
|
|
post {
|
2022-09-09 08:46:06 +00:00
|
|
|
success { script {
|
2023-09-26 10:08:07 +00:00
|
|
|
def discord = load 'ci/discord.groovy'
|
|
|
|
discord.notify(
|
2022-10-12 13:31:30 +00:00
|
|
|
header: 'Nim-Waku deployment successful!',
|
|
|
|
cred: 'discord-waku-deployments-webhook',
|
|
|
|
)
|
2022-09-09 08:46:06 +00:00
|
|
|
} }
|
2020-11-26 02:59:36 +00:00
|
|
|
always { sh 'docker image prune -f' }
|
|
|
|
} // post
|
|
|
|
} // pipeline
|