Skip to content
Snippets Groups Projects
Commit 9a9ab8b9 authored by Mainguy Jean's avatar Mainguy Jean
Browse files

add rules to CI pipeline to better define image label

parent 1953efa9
No related branches found
No related tags found
1 merge request!26v2.4.2
Pipeline #96484 passed
# recipe for building singularity image and deploy it on the registery for bwa version 0.7.17
image:
name: quay.io/singularity/singularity:v3.10.0
entrypoint: [""]
stages:
- build
singularity-image-metag:
variables:
IMAGE_LABEL: "$CI_COMMIT_TAG"
rules:
- if: "$CI_COMMIT_TAG == null"
variables: # Override IMAGE_LABEL defined
IMAGE_LABEL: "${CI_COMMIT_BRANCH}_${CI_COMMIT_SHORT_SHA}" # at the job level.
when: manual
- if: "$CI_COMMIT_TAG != null"
variables: # Override IMAGE_LABEL defined
IMAGE_LABEL: "$CI_COMMIT_TAG" # at the job level.
when: always
stage: build
script:
- singularity build metagWGS.sif env/Singularity_recipe_metagWGS
- singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" metagWGS.sif oras://"$CI_REGISTRY_IMAGE"/"$CI_PROJECT_NAME"_"$CI_COMMIT_BRANCH":"$CI_COMMIT_TAG"
- df -h
- echo IMAGE LABEL $IMAGE_LABEL
- singularity build metagWGS.sif env/Singularity_recipe_metagWGS
- singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" metagWGS.sif oras://"$CI_REGISTRY_IMAGE"/"$CI_PROJECT_NAME":"$IMAGE_LABEL"
when: manual
singularity-image-binning:
variables:
IMAGE_LABEL: "$CI_COMMIT_TAG"
rules:
- if: "$CI_COMMIT_TAG == null" # when the pipeline is not launch from a tag this variable is null
variables: # Override IMAGE_LABEL defined
IMAGE_LABEL: "${CI_COMMIT_BRANCH}_${CI_COMMIT_SHORT_SHA}" # at the job level.
when: manual
- if: "$CI_COMMIT_TAG != null"
variables: # Override IMAGE_LABEL defined
IMAGE_LABEL: "$CI_COMMIT_TAG" # at the job level.
when: always
stage: build
script:
- df -h
- echo IMAGE LABEL $IMAGE_LABEL
- singularity build binning.sif env/Singularity_recipe_binning
- singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" binning.sif oras://"$CI_REGISTRY_IMAGE"/binning_"$CI_COMMIT_BRANCH":"$CI_COMMIT_TAG"
when: manual
- singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" binning.sif oras://"$CI_REGISTRY_IMAGE"/binning:"$IMAGE_LABEL"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment