From 5a7be16f325da2bda7c8fd553f3058a9c0f410ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 26 Oct 2021 16:33:46 +0200 Subject: [PATCH] ci: add Jenkinsfile for building Docker images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By pushing to `deploy-test` tag we can update the `go-waku.test` fleet. Job: https://ci.status.im/job/go-waku/job/deploy-test/ Signed-off-by: Jakub SokoĊ‚owski --- Jenkinsfile => ci/Jenkinsfile | 0 ci/Jenkinsfile.docker | 65 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) rename Jenkinsfile => ci/Jenkinsfile (100%) create mode 100644 ci/Jenkinsfile.docker diff --git a/Jenkinsfile b/ci/Jenkinsfile similarity index 100% rename from Jenkinsfile rename to ci/Jenkinsfile diff --git a/ci/Jenkinsfile.docker b/ci/Jenkinsfile.docker new file mode 100644 index 00000000..e1d4de63 --- /dev/null +++ b/ci/Jenkinsfile.docker @@ -0,0 +1,65 @@ +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 { + always { cleanWs() } + } +}