-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jenkins: Merge build scripts for distribution images into single scri…
…pted pipeline (#178) * Jenkins: Merge build scripts for distribution images into single scripted pipeline * Add git checkout and SSH agent wrapper * Delete obsolete pipelines and scripts * Convert back to declarative pipeline It's a better match than scripted pipeline for this job after all. * Jenkins: added ecr-login stage Co-authored-by: Felice Dibattista <fb@concordium.com>
- Loading branch information
Showing
8 changed files
with
69 additions
and
213 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Parameters: | ||
// - environment | ||
// - image_tag (default: "latest") | ||
// - base_image_tag (default: "latest") | ||
// - static_libraries_image_tag (default: "latest") | ||
// - ghc_version (default: "8.10.4") | ||
// - genesis_ref (default: "master") | ||
// - genesis_path | ||
|
||
@Library('concordium-pipelines') _ | ||
pipeline { | ||
agent any | ||
|
||
environment { | ||
image_name = "${environment}-node" | ||
domain = "${concordiumDomain(environment)}" | ||
} | ||
|
||
stages { | ||
stage('ecr-login') { | ||
steps { | ||
sh 'aws ecr get-login-password \ | ||
--region eu-west-1 \ | ||
| docker login \ | ||
--username AWS \ | ||
--password-stdin 192549843005.dkr.ecr.eu-west-1.amazonaws.com' | ||
} | ||
} | ||
stage('build') { | ||
steps { | ||
// Using '--no-cache' because we're cloning genesis data | ||
// and BuildKit (and '--ssh default') because the repo is on GitLab. | ||
sshagent (credentials: ['jenkins-gitlab-ssh']) { | ||
sh '''\ | ||
DOCKER_BUILDKIT=1 docker build \ | ||
--build-arg environment="${domain}"\ | ||
--build-arg base_image_tag="${base_image_tag}" \ | ||
--build-arg static_libraries_image_tag="${static_libraries_image_tag}" \ | ||
--build-arg ghc_version="${ghc_version}" \ | ||
--build-arg genesis_ref="${genesis_ref}" \ | ||
--build-arg genesis_path="${genesis_path}" \ | ||
--label base_image_tag="${base_image_tag}" \ | ||
--label static_libraries_image_tag="${static_libraries_image_tag}" \ | ||
--label ghc_version="${ghc_version}" \ | ||
--label genesis_ref="${genesis_ref}" \ | ||
--label genesis_path="${genesis_path}" \ | ||
-t "concordium/${image_name}:${image_tag}" \ | ||
-f scripts/distribution/builder.Dockerfile \ | ||
--ssh default\ | ||
--no-cache \ | ||
. | ||
'''.stripIndent() | ||
} | ||
} | ||
} | ||
|
||
stage('push') { | ||
environment { | ||
file = "${image_name}-${image_tag}.tar.gz" | ||
} | ||
steps { | ||
sh '''\ | ||
docker save concordium/"${image_name}:${image_tag}" | gzip > "${file}" | ||
aws s3 cp "${file}" s3://distribution.${domain}/image/ --grants=read=uri=http://acs.amazonaws.com/groups/global/AllUsers | ||
'''.stripIndent() | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.