Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 09f11c3

Browse files
authored
allow Makefile vars including REQUIREMENTS_TAG to be overridden (#1205)
1 parent 7840d9f commit 09f11c3

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
sha := $(shell git rev-parse --short=7 HEAD)
2-
full_sha := $(shell git rev-parse HEAD)
1+
sha ?= $(shell git rev-parse --short=7 HEAD)
2+
full_sha ?= $(shell git rev-parse HEAD)
33
release_version = `cat VERSION`
44
_gcr := ${CODECOV_WORKER_GCR_REPO_BASE}
5-
merge_sha := $(shell git merge-base HEAD^ origin/main)
5+
merge_sha ?= $(shell git merge-base HEAD^ origin/main)
66
build_date ?= $(shell git show -s --date=iso8601-strict --pretty=format:%cd $$sha)
77
name ?= worker
8-
branch = $(shell git branch | grep \* | cut -f2 -d' ')
8+
branch ?= $(shell git branch | grep \* | cut -f2 -d' ')
99
gh_access_token := $(shell echo ${GH_ACCESS_TOKEN})
10-
epoch := $(shell date +"%s")
10+
epoch ?= $(shell date +"%s")
1111

1212
AR_REPO ?= codecov/worker
1313
DOCKERHUB_REPO ?= codecov/self-hosted-worker
14-
REQUIREMENTS_TAG := requirements-v1-$(shell sha1sum uv.lock | cut -d ' ' -f 1)-$(shell sha1sum docker/Dockerfile.requirements | cut -d ' ' -f 1)
15-
VERSION := release-${sha}
14+
VERSION ?= release-${sha}
1615
CODECOV_UPLOAD_TOKEN ?= "notset"
1716
CODECOV_STATIC_TOKEN ?= "notset"
1817
CODECOV_URL ?= "https://api.codecov.io"
1918

19+
DEFAULT_REQS_TAG := requirements-v1-$(shell sha1sum uv.lock | cut -d ' ' -f 1)-$(shell sha1sum docker/Dockerfile.requirements | cut -d ' ' -f 1)
20+
REQUIREMENTS_TAG ?= ${DEFAULT_REQS_TAG}
21+
2022
# We allow this to be overridden so that we can run `pytest` from this directory
2123
# but have the junit file use paths relative to a parent directory. This will
2224
# help us move to a monorepo.
@@ -89,6 +91,12 @@ lint.check:
8991
ruff format --check
9092

9193
build.requirements:
94+
# If make was given a different requirements tag, we assume a suitable image
95+
# was already built (e.g. by umbrella) and don't want to build this one.
96+
ifneq (${REQUIREMENTS_TAG},${DEFAULT_REQS_TAG})
97+
echo "Error: building worker reqs image despite another being provided"
98+
exit 1
99+
endif
92100
# if docker pull succeeds, we have already build this version of
93101
# requirements.txt. Otherwise, build and push a version tagged
94102
# with the hash of this requirements.txt

0 commit comments

Comments
 (0)