2021-10-26 14:33:46 +00:00
|
|
|
pipeline {
|
|
|
|
agent {
|
|
|
|
label 'linux'
|
|
|
|
}
|
|
|
|
|
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'BRANCH',
|
|
|
|
defaultValue: 'master',
|
|
|
|
description: 'Name of branch to build.'
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'IMAGE_NAME',
|
|
|
|
defaultValue: 'statusteam/go-waku',
|
|
|
|
description: 'Docker image name.',
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'IMAGE_TAG',
|
|
|
|
defaultValue: 'deploy-test',
|
|
|
|
description: 'Docker image name.',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
steps { script {
|
|
|
|
image = docker.build(
|
|
|
|
"${params.IMAGE_NAME}:${GIT_COMMIT.take(8)}",
|
|
|
|
"--build-arg='GIT_COMMIT=${GIT_COMMIT.take(8)}' ."
|
|
|
|
)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Push') {
|
|
|
|
steps { script {
|
|
|
|
withDockerRegistry([
|
|
|
|
credentialsId: "dockerhub-statusteam-auto", url: ""
|
|
|
|
]) {
|
|
|
|
image.push()
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Deploy') {
|
|
|
|
steps { script {
|
|
|
|
withDockerRegistry([
|
|
|
|
credentialsId: "dockerhub-statusteam-auto", url: ""
|
|
|
|
]) {
|
|
|
|
image.push(env.IMAGE_TAG)
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
2022-09-27 14:08:56 +00:00
|
|
|
success { script {
|
|
|
|
withCredentials([
|
|
|
|
string(
|
|
|
|
credentialsId: 'discord-waku-deployments-webhook',
|
|
|
|
variable: 'DISCORD_WEBHOOK'
|
|
|
|
),
|
|
|
|
]) {
|
2022-09-28 12:40:06 +00:00
|
|
|
def repo = [
|
|
|
|
url: 'https://github.com/status-im/go-waku',
|
|
|
|
branch: GIT_BRANCH.minus("origin/"),
|
|
|
|
commit: GIT_COMMIT.take(8),
|
|
|
|
prev: (env.GIT_PREVIOUS_SUCCESSFUL_COMMIT ?: env.GIT_PREVIOUS_COMMIT ?: 'master').take(8),
|
|
|
|
]
|
2022-10-12 09:17:47 +00:00
|
|
|
wrap([$class: 'BuildUser']) {
|
|
|
|
BUILD_USER_ID = env.BUILD_USER_ID
|
|
|
|
}
|
2022-09-27 14:08:56 +00:00
|
|
|
discordSend(
|
|
|
|
title: "${env.JOB_NAME}#${env.BUILD_NUMBER}",
|
|
|
|
description: """
|
|
|
|
Go-Waku deployment successful!
|
2022-09-28 12:40:06 +00:00
|
|
|
Image: [`${IMAGE_NAME}:${IMAGE_TAG}`](https://hub.docker.com/r/${IMAGE_NAME}/tags?name=${IMAGE_TAG})
|
|
|
|
Branch: [`${repo.branch}`](${repo.url}/commits/${repo.branch})
|
|
|
|
Commit: [`${repo.commit}`](${repo.url}/commit/${repo.commit})
|
|
|
|
Diff: [`${repo.prev}...${repo.commit}`](${repo.url}/compare/${repo.prev}...${repo.commit})
|
2022-10-12 09:17:47 +00:00
|
|
|
By: [`${BUILD_USER_ID}`](${repo.url}/commits?author=${BUILD_USER_ID})
|
2022-09-27 14:08:56 +00:00
|
|
|
""",
|
|
|
|
link: env.BUILD_URL,
|
|
|
|
result: currentBuild.currentResult,
|
|
|
|
webhookURL: env.DISCORD_WEBHOOK
|
|
|
|
)
|
|
|
|
}
|
|
|
|
} }
|
2021-10-26 14:33:46 +00:00
|
|
|
always { cleanWs() }
|
|
|
|
}
|
|
|
|
}
|