Skip to content
Snippets Groups Projects
Commit 82ad87c9 authored by Alexis Mergez's avatar Alexis Mergez
Browse files

Update .gitlab-ci.yml

Don't build if no changes
Only stable runners
parent 7c754b2e
No related branches found
No related tags found
No related merge requests found
Pipeline #172129 failed
......@@ -9,52 +9,82 @@ release_job:
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
build-and-push pangetools:
stage: build
image:
name: kaczmarj/apptainer:latest
entrypoint: [""]
test_for_changes:
stage: .pre
tags:
- stable # Using Stable runners as test runners don't work properly
image: ubuntu:latest
rules:
- if : $CI_COMMIT_TAG
changes:
- PanGeTools.def
allow_failure: true
- if: $CI_COMMIT_TAG
script:
- sed -i "s/VERSION_NUMBER/${CI_COMMIT_TAG#v}/" PanGeTools.def
- apptainer build PanGeTools.sif PanGeTools.def
- apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" PanGeTools.sif oras://"$CI_REGISTRY_IMAGE"/"$CI_PROJECT_NAME":"$CI_COMMIT_TAG"
- apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" PanGeTools.sif oras://"$CI_REGISTRY_IMAGE"/"$CI_PROJECT_NAME":latest
- apt update -y && apt install -y git
# Getting current and previous tags
- curTag=$(git describe --abbrev=0 --tags)
- prevTag=$(git describe --abbrev=0 --tags HEAD^)
build-and-push pytools:
# Check block for PanGeTools.def
- curMd5=$(git show ${curTag}:PanGeTools.def | md5sum | cut -d' ' -f1)
- prevMd5=$(git show ${prevTag}:PanGeTools.def | md5sum | cut -d' ' -f1)
- if [ $curMd5 != $prevMd5 ]; then
RUN_PanGeTools="1";
else
RUN_PanGeTools="0";
fi
# Check block for panache.def
- curMd5=$(git show ${curTag}:panache.def | md5sum | cut -d' ' -f1)
- prevMd5=$(git show ${prevTag}:panache.def | md5sum | cut -d' ' -f1)
- if [ $curMd5 != $prevMd5 ]; then
RUN_panache="1";
else
RUN_panache="0";
fi
- echo "RUN_PanGeTools=$RUN_PanGeTools" >> build.env
- echo "RUN_panache=$RUN_panache" >> build.env
artifacts:
reports:
dotenv: build.env
build:PanGeTools:
stage: build
tags:
- stable # Using Stable runners as test runners don't work properly
needs:
- job: "test_for_changes"
artifacts: true
image:
name: kaczmarj/apptainer:latest
entrypoint: [""]
rules:
- if : $CI_COMMIT_TAG
changes:
- PyTools.def
allow_failure: true
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- sed -i "s/VERSION_NUMBER/${CI_COMMIT_TAG#v}/" PyTools.def
- apptainer build PyTools.sif PyTools.def
- apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" PyTools.sif oras://"$CI_REGISTRY_IMAGE"/pytools:"$CI_COMMIT_TAG"
- apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" PyTools.sif oras://"$CI_REGISTRY_IMAGE"/pytools:latest
- if [ $RUN_PanGeTools == "1" ]; then
sed -i "s/VERSION_NUMBER/${CI_COMMIT_TAG#v}/" PanGeTools.def;
apptainer build PanGeTools.sif PanGeTools.def;
apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" PanGeTools.sif oras://"$CI_REGISTRY_IMAGE"/pangetools:"$CI_COMMIT_TAG";
apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" PanGeTools.sif oras://"$CI_REGISTRY_IMAGE"/pangetools:latest;
fi
build-and-push panache:
build:panache:
stage: build
tags:
- stable # Using Stable runners as test runners don't work properly
needs:
- job: "test_for_changes"
artifacts: true
image:
name: kaczmarj/apptainer:latest
entrypoint: [""]
rules:
- if : $CI_COMMIT_TAG
changes:
- Panache.def
allow_failure: true
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- sed -i "s/VERSION_NUMBER/${CI_COMMIT_TAG#v}/" Panache.def
- apptainer build Panache.sif Panache.def
- apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" Panache.sif oras://"$CI_REGISTRY_IMAGE"/panache:"$CI_COMMIT_TAG"
- apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" Panache.sif oras://"$CI_REGISTRY_IMAGE"/panache:latest
- if [ $RUN_panache == "1" ]; then
sed -i "s/VERSION_NUMBER/${CI_COMMIT_TAG#v}/" Panache.def;
apptainer build Panache.sif Panache.def;
apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" panache.sif oras://"$CI_REGISTRY_IMAGE"/panache:"$CI_COMMIT_TAG";
apptainer push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" panache.sif oras://"$CI_REGISTRY_IMAGE"/panache:latest;
fi
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