Skip to content

Commit

Permalink
feat(dev): add ENVIRONMENT_AUTOPULL override to Makefile (vectordot…
Browse files Browse the repository at this point in the history
…dev#18446)

* feat(dev): add `ENVIRONMENT_AUTOPULL` override to Makefile

This commits adds an override to disable force pulling the environment image, leaving the
container tool to pull it only when necessary instead.

Before this change, every time `make environment ENVIRONMENT_AUTOBUILD=false` is executed, it would
force pull the image in `ENVIRONMENT_UPSTREAM` even if the image already exists locally. This is not
efficient when the value in `ENVIRONMENT_UPSTREAM` is a static/fixed tag.

With the new override, the environment can be started very quickly when the image exists locally:

    make environment ENVIRONMENT_AUTOBUILD=false ENVIRONMENT_AUTOPULL=false

The default value for `ENVIRONMENT_AUTOPULL` is `true` to preserve the current behavior.

Signed-off-by: Hugo Hromic <[email protected]>

* chore: add `AUTOPULL` to spell checker expect-list

* added to `expect.txt` so it is together with `AUTOBUILD`

---------

Signed-off-by: Hugo Hromic <[email protected]>
  • Loading branch information
hhromic authored Sep 1, 2023
1 parent 4127b2c commit bc6c421
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ authsvc
autobenches
AUTOBUILD
AUTODESPAWN
AUTOPULL
autodiscovered
autodiscovery
autogen
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export ENVIRONMENT_UPSTREAM ?= docker.io/timberio/vector-dev:sha-3eadc96742a3375
# Override to disable building the container, having it pull from the GitHub packages repo instead
# TODO: Disable this by default. Blocked by `docker pull` from GitHub Packages requiring authenticated login
export ENVIRONMENT_AUTOBUILD ?= true
# Override to disable force pulling the image, leaving the container tool to pull it only when necessary instead
export ENVIRONMENT_AUTOPULL ?= true
# Override this when appropriate to disable a TTY being available in commands with `ENVIRONMENT=true`
export ENVIRONMENT_TTY ?= true

Expand Down Expand Up @@ -144,8 +146,9 @@ define ENVIRONMENT_PREPARE
--file scripts/environment/Dockerfile \
.
endef
else
else ifeq ($(ENVIRONMENT_AUTOPULL), true)
define ENVIRONMENT_PREPARE
@echo "Pulling the environment image. (ENVIRONMENT_AUTOPULL=true)"
$(CONTAINER_TOOL) pull $(ENVIRONMENT_UPSTREAM)
endef
endif
Expand Down

0 comments on commit bc6c421

Please sign in to comment.