Skip to content

Commit 9c784c9

Browse files
authored
Merge pull request #1357 from nipreps/fix/version-in-containers
FIX: Containers report wrong version
2 parents 653ec69 + af556f5 commit 9c784c9

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.circleci/config.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ jobs:
99
- MRIQC_API_TAG: 1.1.0
1010
- MRIQC_API_DOCKER_IMAGES: "nginx:latest swaggerapi/swagger-ui:latest mongo:latest
1111
python:3.7-slim"
12+
- DOCKER_BUILDKIT: 1
1213
machine:
1314
# https://discuss.circleci.com/t/linux-machine-executor-images-2021-april-q2-update/39928
1415
# upgrade Docker version
15-
image: ubuntu-2204:2023.02.1
16+
image: default
1617
docker_layer_caching: true
1718
working_directory: /tmp/src/mriqc
1819
steps:
@@ -126,10 +127,12 @@ jobs:
126127
name: Build Docker image
127128
no_output_timeout: 60m
128129
command: |
129-
python3 -m pip install hatch
130+
pyenv local 3
131+
pip install hatch
130132
131133
# Get version before making repo dirty
132-
THISVERSION=$( python3 -m hatch version )
134+
THISVERSION=$( hatch version )
135+
133136
# Inject MRIQC-WebAPI secret
134137
if [ "${MRIQC_API_SECRET_TOKEN}" != "" ]; then
135138
sed -i -E "s/<secret_token>/$MRIQC_API_SECRET_TOKEN/" mriqc/config.py
@@ -143,6 +146,8 @@ jobs:
143146
echo "them to your fork with ``git push origin --tags``"
144147
fi
145148
149+
echo "Building version: $THISVERSION."
150+
146151
# Build docker image
147152
e=1 && for i in {1..5}; do
148153
docker build \
@@ -153,6 +158,14 @@ jobs:
153158
--build-arg VERSION="${CIRCLE_TAG:-$THISVERSION}" . \
154159
&& e=0 && break || sleep 15
155160
done && [ "$e" -eq "0" ]
161+
162+
TARGET_VERSION="${CIRCLE_TAG:-$THISVERSION}"
163+
TARGET_VERSION="MRIQC v${TARGET_VERSION%+*}"
164+
DOCKER_VERSION=$( docker run --rm nipreps/mriqc:latest --version )
165+
DOCKER_VERSION="${DOCKER_VERSION%+*}"
166+
echo "Target version: \"${TARGET_VERSION}\""
167+
echo "Docker version: \"${DOCKER_VERSION}\""
168+
test "${TARGET_VERSION}" == "$DOCKER_VERSION"
156169
- run:
157170
name: Docker push to local registry
158171
no_output_timeout: 40m

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ WORKDIR /tmp/
201201

202202
# Run mriqc by default
203203
ENTRYPOINT ["/opt/conda/bin/mriqc"]
204+
ARG VERSION
204205
ARG BUILD_DATE
205206
ARG VCS_REF
206207
LABEL org.label-schema.build-date=$BUILD_DATE \

0 commit comments

Comments
 (0)