Skip to content

Commit b31e62d

Browse files
authored
fix: always pull latest docker image in run_macaron.sh (#448)
fix: by default, always pull latest version of docker image, but allow this behaviour to be overidden by setting the DOCKER_PULL env var Signed-off-by: Nicholas Allen <nicholas.allen@oracle.com>
1 parent db7da33 commit b31e62d

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

.github/workflows/_build_docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ jobs:
5858
env:
5959
# This environment variable will be picked up by run_macaron.sh.
6060
MACARON_IMAGE_TAG: test
61+
DOCKER_PULL: never
6162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6263
run: make integration-test-docker

docs/source/pages/cli_usage/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ Common Options
4949

5050
The directory where Macaron looks for already cloned repositories.
5151

52+
-----------
53+
Common Environment
54+
-----------
55+
56+
``MACARON_IMAGE_TAG`` – The tag to use for the Macaron docker image
57+
``DOCKER_PULL`` – Whether to pull docker image from registry, must be one of: always, missing, never (default: always)
58+
5259
---------------
5360
Action Commands
5461
---------------

docs/source/pages/installation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ To verify your setup, go to the directory containing the downloaded ``run_macaro
4545

4646
.. note:: By default, ``latest`` is used as the tag for the downloaded image. You can choose a specific tag by assigning the environment variable ``MACARON_IMAGE_TAG``. For example to run Macaron v0.1.0 run: ``MACARON_IMAGE_TAG=v0.1.0 ./run_macaron.sh --help``
4747

48+
.. note:: By default, the script will always check the docker registry to ensure the docker image is up-to-date. This can be overridden if necessary (e.g. if running offline with a pre-installed image) by assigning the environment variable ``DOCKER_PULL``. For example: ``DOCKER_PULL=never ./run_macaron.sh --help``
49+
4850
.. _prepare-github-token:
4951

5052
---------------------------

scripts/release_scripts/run_macaron.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ argv_main=()
3636

3737
# These are the sub-commands for a specific action.
3838
# macaron
39-
# analzye:
39+
# analyze:
4040
# -g/--template-path TEMPLATE_PATH: The path to the Jinja2 html template (please make sure to use .html or .j2 extensions).
4141
# -c/--config-path CONFIG_PATH: The path to the user configuration.
4242
# -pe/--provenance-expectation POLICY: The path to provenance expectation file or directory.
@@ -420,9 +420,19 @@ then
420420
entrypoint=("macaron")
421421
fi
422422

423+
if [[ -n "${DOCKER_PULL}" ]]; then
424+
if [[ "${DOCKER_PULL}" != @(always|missing|never) ]]; then
425+
echo "DOCKER_PULL must be one of: always, missing, never (default: always)"
426+
exit 1
427+
fi
428+
else
429+
DOCKER_PULL="always"
430+
fi
431+
423432
echo "Running ${IMAGE}:${MACARON_IMAGE_TAG}"
424433

425434
docker run \
435+
--pull ${DOCKER_PULL} \
426436
--network=host \
427437
--rm -i "${tty[@]}" \
428438
-e "USER_UID=${USER_UID}" \

0 commit comments

Comments
 (0)