Skip to content

Commit

Permalink
Merge pull request #1357 from nipreps/fix/version-in-containers
Browse files Browse the repository at this point in the history
FIX: Containers report wrong version
  • Loading branch information
oesteban authored Jan 13, 2025
2 parents 653ec69 + af556f5 commit 9c784c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ jobs:
- MRIQC_API_TAG: 1.1.0
- MRIQC_API_DOCKER_IMAGES: "nginx:latest swaggerapi/swagger-ui:latest mongo:latest
python:3.7-slim"
- DOCKER_BUILDKIT: 1
machine:
# https://discuss.circleci.com/t/linux-machine-executor-images-2021-april-q2-update/39928
# upgrade Docker version
image: ubuntu-2204:2023.02.1
image: default
docker_layer_caching: true
working_directory: /tmp/src/mriqc
steps:
Expand Down Expand Up @@ -126,10 +127,12 @@ jobs:
name: Build Docker image
no_output_timeout: 60m
command: |
python3 -m pip install hatch
pyenv local 3
pip install hatch
# Get version before making repo dirty
THISVERSION=$( python3 -m hatch version )
THISVERSION=$( hatch version )
# Inject MRIQC-WebAPI secret
if [ "${MRIQC_API_SECRET_TOKEN}" != "" ]; then
sed -i -E "s/<secret_token>/$MRIQC_API_SECRET_TOKEN/" mriqc/config.py
Expand All @@ -143,6 +146,8 @@ jobs:
echo "them to your fork with ``git push origin --tags``"
fi
echo "Building version: $THISVERSION."
# Build docker image
e=1 && for i in {1..5}; do
docker build \
Expand All @@ -153,6 +158,14 @@ jobs:
--build-arg VERSION="${CIRCLE_TAG:-$THISVERSION}" . \
&& e=0 && break || sleep 15
done && [ "$e" -eq "0" ]
TARGET_VERSION="${CIRCLE_TAG:-$THISVERSION}"
TARGET_VERSION="MRIQC v${TARGET_VERSION%+*}"
DOCKER_VERSION=$( docker run --rm nipreps/mriqc:latest --version )
DOCKER_VERSION="${DOCKER_VERSION%+*}"
echo "Target version: \"${TARGET_VERSION}\""
echo "Docker version: \"${DOCKER_VERSION}\""
test "${TARGET_VERSION}" == "$DOCKER_VERSION"
- run:
name: Docker push to local registry
no_output_timeout: 40m
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ WORKDIR /tmp/

# Run mriqc by default
ENTRYPOINT ["/opt/conda/bin/mriqc"]
ARG VERSION
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
Expand Down

0 comments on commit 9c784c9

Please sign in to comment.