2020-11-26 02:59:36 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
|
|
|
|
2020-11-30 11:59:53 +00:00
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
/* WARNING: Two more parameters can be defined.
|
|
|
|
* See 'environment' section. */
|
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.',
|
|
|
|
defaultValue: params.IMAGE_TAG ?: 'deploy-v2-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.',
|
|
|
|
defaultValue: params.IMAGE_NAME ?: 'statusteam/nim-waku',
|
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-05-17 19:11:07 +00:00
|
|
|
defaultValue: params.NIMFLAGS ?: '-d:disableMarchNative -d:chronicles_colors:none -d:insecure',
|
2020-11-26 02:59:36 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
steps { script {
|
|
|
|
image = docker.build(
|
2022-02-21 15:42:27 +00:00
|
|
|
"${params.IMAGE_NAME}:${env.GIT_COMMIT.take(8)}",
|
|
|
|
"--label=commit='${env.GIT_COMMIT.take(8)}' " +
|
2020-11-30 11:59:53 +00:00
|
|
|
"--build-arg=MAKE_TARGET='${params.MAKE_TARGET}' " +
|
2022-05-17 19:11:07 +00:00
|
|
|
"--build-arg=NIMFLAGS='${params.NIMFLAGS}' ."
|
2020-11-26 02:59:36 +00:00
|
|
|
)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Push') {
|
|
|
|
steps { script {
|
|
|
|
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
|
|
|
|
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 {
|
|
|
|
always { sh 'docker image prune -f' }
|
|
|
|
} // post
|
|
|
|
} // pipeline
|