Merge branch 'make-prerelease' into 'dev'

deploy from dev branch

See merge request epi2melabs/workflow-containers/wf-template!4
This commit is contained in:
Chris Wright 2021-03-15 16:01:23 +00:00
commit a2a1ac2739

View File

@ -1,5 +1,7 @@
stages: stages:
- build_and_run - test
- pre-release
- release-checks
- release - release
image: ${IMAGE} image: ${IMAGE}
@ -15,10 +17,31 @@ variables:
source ./miniconda/bin/activate source ./miniconda/bin/activate
conda init conda init
# Insist a CHANGELOG entry has been made for tags
.check-changelog: &check-changelog |
TAGVER=${CI_COMMIT_TAG}
MATCHES=$(grep -c "## \[${TAGVER}\]" CHANGELOG.md)
if [[ "${MATCHES}" != "1" ]] then;
echo "Expected one match to '${CI_COMMIT_TAG}' in CHANGELOG, found ${MATCHES}"
exit 1
else;
echo "Found CHANGELOG.md entry for tag"
fi
# setup image for pushing to github
.setup-gh-push: &setup-gh-push |
apt-get update -qq && apt-get install -y -qq
git python3-all-dev git-lfs python3-venv
mkdir ~/.ssh/
cp $LABS_BOT_GH_KEY ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
echo -e "Host github.com\n\tStrictHostKeyChecking no\n\tHostname ssh.github.com\n\tPort 443\n\n" > ~/.ssh/config
git config --global user.email "epi2melabs@nanoporetech.com"
git config --global user.name "epi2melabs-bot"
conda-run: conda-run:
image: ubuntu:20.04 image: ubuntu:20.04
stage: build_and_run stage: test
before_script: before_script:
- apt update && apt install -y wget default-jre - apt update && apt install -y wget default-jre
- *install-nextflow - *install-nextflow
@ -35,7 +58,7 @@ conda-run:
build-image: build-image:
stage: build_and_run stage: test
before_script: before_script:
- apk add wget openjdk11 bash - apk add wget openjdk11 bash
- *install-nextflow - *install-nextflow
@ -52,12 +75,15 @@ build-image:
--wfversion latest --wfversion latest
--fastq test_data/reads.fq.gz --fastq test_data/reads.fq.gz
--out_dir ${OUTPUT} --out_dir ${OUTPUT}
# push # push, to ont for later tagging, to dockerhub for release testing
- if [[ ${CI_COMMIT_BRANCH} == 'dev' ]]; then - if [[ ${CI_COMMIT_BRANCH} == 'dev' ]]; then
SHATAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}; SHATAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA};
echo "Pushing ${SHATAG}"; HUBTAG="${DOCKERHUB_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHORT_SHA}";
docker tag ${TAG} ${SHATAG}; for tag in SHATAG HUBTAG; do
docker push ${SHATAG}; echo "Pushing ${tag}";
docker tag ${TAG} ${tag};
docker push ${tag};
done;
fi; fi;
only: only:
- branches - branches
@ -67,6 +93,30 @@ build-image:
- ${CI_PROJECT_NAME} - ${CI_PROJECT_NAME}
expire_in: 1 day expire_in: 1 day
###
# Push dev branch to github for release testers
release-dev:
stage: pre-release
image: $GH_PUSH_IMAGE
before_script:
- *setup-gh-push
script:
# Merge ont/dev into prerelease
- git remote add ont ${CI_REPOSITORY_URL} || true
- git remote add github git@github.com:epi2me-labs/${CI_PROJECT_NAME}.git || true
- git fetch ont dev
- git fetch github prerelease || echo "No 'prerelease' branch present on github"
- git checkout --track github/prerelease || git checkout prerelease
- git merge ont/dev
# Edit nextflow config to set wfversion
- grep 'wfversion = ".*"' nextflow.config || echo "Failed to replace wfversion" && exit 1
- git add nextflow.config
- git commit -m "Setting wfversion to:${CI_COMMIT_SHORT_SHA}"
- git push github prerelease
only:
- '/^dev$/'
except:
- tags
### ###
# Retag the image for git tags (releases) # Retag the image for git tags (releases)
@ -80,17 +130,6 @@ build-image:
only: only:
- tags - tags
# To ONT registry
release-int:
stage: release
<<: *pull_tag
script:
- echo ${CI_BUILD_TOKEN} | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
- RELTAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
- echo "Pushing ${TAG}"
- docker tag ${SHATAG} ${RELTAG}
- docker push ${RELTAG}
# To dockerhub # To dockerhub
release-hub: release-hub:
stage: release stage: release
@ -111,13 +150,7 @@ push-github:
stage: release stage: release
image: $GH_PUSH_IMAGE image: $GH_PUSH_IMAGE
before_script: before_script:
- apt-get update -qq && apt-get install -y -qq - *setup-gh-push
git python3-all-dev git-lfs python3-venv
- mkdir ~/.ssh/
- cp $LABS_BOT_GH_KEY ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n\tHostname ssh.github.com\n\tPort 443\n\n" > ~/.ssh/config
- git config --global user.email "epi2melabs@nanoporetech.com"
- git config --global user.name "epi2melabs-bot"
script: script:
# Push master and tag to github # Push master and tag to github
- git remote add ont ${CI_REPOSITORY_URL} || true - git remote add ont ${CI_REPOSITORY_URL} || true