Add deploy and test stage to CI/CD pipeline


Signed-off-by: Norman Ziegner (Out of office 23 July - 29 Oct. 2021)'s avatarNorman Ziegner <norman.ziegner@ufz.de>
parent b0d44548
Pipeline #70851 passed with stages
in 3 minutes and 17 seconds
image: image:
name: quay.io/singularity/singularity:v3.7.3 name: quay.io/singularity/singularity:v3.7.3
entrypoint: [""] entrypoint: [ "" ]
stages:
- build
- deploy
- test
# build the image
build: build:
stage: build
tags: tags:
- docker - docker
script: script:
- /bin/bash .gitlabci/build.sh Singularity - /bin/bash .gitlabci/build.sh Singularity
- mkdir -p build && cp *.sif build
# step 1. build the container! - mkdir -p build && cp Singularity* build
# You can add any other sregistry push commands here, and specify a client
# (and make sure your define the encrypted environment credentials in gitlab
# to push to your storage locations of choice
- mkdir -p build && cp *.sif build
- mkdir -p build && cp Singularity* build
# Step 2. Take a look at "artifacts" below and add the paths you want added # Step 2. Take a look at "artifacts" below and add the paths you want added
# You can also add the entire build folder. You can also upload to storage # You can also add the entire build folder. You can also upload to storage
...@@ -25,13 +26,27 @@ build: ...@@ -25,13 +26,27 @@ build:
#- /bin/bash build.sh --uri collection/container --cli google-storage Singularity #- /bin/bash build.sh --uri collection/container --cli google-storage Singularity
#- /bin/bash build.sh --uri collection/container --cli google-drive Singularity #- /bin/bash build.sh --uri collection/container --cli google-drive Singularity
#- /bin/bash build.sh --uri collection/container --cli globus Singularity #- /bin/bash build.sh --uri collection/container --cli globus Singularity
#- /bin/bash build.sh --uri collection/container --cli registry Singularity #- /bin/bash build.sh --uri collection/container --cli registry Singularity
# This is where you can save job artifacts
# https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html
# You can specify the path to containers or the build folder to save.
# Don't forget to save your recipes too!
artifacts: artifacts:
paths: paths:
- build/Singularity.sif - build/Singularity.sif
- build/Singularity - build/Singularity
# Push the image to container registry
deploy:
stage: deploy
tags:
- docker
script:
- singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" build/Singularity.sif oras://"${CI_REGISTRY_IMAGE}"/"${CI_PROJECT_NAME}":"${CI_COMMIT_REF_SLUG}"
# Pull and run the image
test:
stage: test
tags:
- docker
script:
- mkdir test && cd test
- singularity pull --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" Singularity.sif oras://"${CI_REGISTRY_IMAGE}"/"${CI_PROJECT_NAME}":"${CI_COMMIT_REF_SLUG}"
- ./Singularity.sif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment