Commit 60aed326 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'bf/update-manifest3' into 'master'

CI: Make it necessary to update the fslinstaller __version__ field, block deployment if it doesn't match tag

See merge request fsl/conda/installer!8
parents 51a7d5b9 f71b569a
......@@ -7,11 +7,16 @@
# First we copy the installer into the deployment directory, denoted by the
# $FSLINSTALLER_DEPLOY_DIRECTORY environment variable.
# copy the installer to the deploy directory,
# stamping it with the new version number.
PATTERN="s/^__version__ =.*/__version__ = '$CI_COMMIT_TAG'/g"
DEST=$FSLINSTALLER_DEPLOY_DIRECTORY/fslinstaller.py
cat fslinstaller.py | sed "$PATTERN" > $DEST
set -e
# Make sure that the installer version matches the tag
scriptver=$(cat fslinstaller.py | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
if [ "$scriptver" != "$CI_COMMIT_TAG" ]; then
echo "Version in fslinstaller.py does not match tag! $scriptver != $CI_COMMIT_TAG"
exit 1
fi
# Then we call the update_manifest.py script, which opens a merge request
# on the fsl/conda/manifest repository, to update the latest available
......
......@@ -69,7 +69,7 @@ def checkout_and_update_manifest(server, token, tag, base_branch):
with indir('manifest'):
sprun(f'git config user.name {USERNAME}')
sprun(f'git config user.email {EMAIL}')
sprun(f'git checkout -b {branch} {base_branch}')
sprun(f'git checkout -b {branch} origin/{base_branch}')
update_manifest(tag)
sprun( 'git add *')
sprun(f'git commit -m "{msg}"')
......
......@@ -11,6 +11,7 @@
# be copied.
stages:
- test
- check-version
- release
# Don't run pipeline on MRs
......@@ -79,6 +80,30 @@ test:py39:
extends: .test-template
image: python:3.9
check-version:
stage: check-version
image: python:3.9
tags:
- fsl-ci
- docker
rules:
- if: '$CI_COMMIT_BRANCH != "master"'
script:
- git fetch origin master
- thisver=$( cat fslinstaller.py | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
- masterver=$(git show origin/master:fslinstaller.py | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
- |
if [ "$thisver" = "$masterver" ]; then
echo "Version has not been updated!"
echo "Version on master branch: $masterver"
echo "Version in this MR: $thisver"
echo "The version number must be updated before this MR can be merged."
exit 1
else
echo "Version on master branch: $masterver"
echo "Version in this MR: $thisver"
fi
release:
image: python:3.9
......
......@@ -52,7 +52,7 @@ log = logging.getLogger(__name__)
__absfile__ = op.abspath(__file__).rstrip('c')
__version__ = '0.0.0'
__version__ = '1.0.12'
"""Installer script version number. This is automatically updated
whenever a new version of the installer script is released.
"""
......
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