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

Commit 6bb21bf

Browse files
authored
allow Makefile vars including REQUIREMENTS_TAG to be overridden (#1273)
1 parent 5a55a2a commit 6bb21bf

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Makefile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
sha := $(shell git rev-parse --short=7 HEAD)
2-
long_sha := $(shell git rev-parse HEAD)
3-
merge_sha := $(shell git merge-base HEAD^ origin/main)
1+
sha ?= $(shell git rev-parse --short=7 HEAD)
2+
long_sha ?= $(shell git rev-parse HEAD)
3+
merge_sha ?= $(shell git merge-base HEAD^ origin/main)
44
release_version := `cat VERSION`
55
build_date ?= $(shell git show -s --date=iso8601-strict --pretty=format:%cd $$sha)
6-
branch = $(shell git branch | grep \* | cut -f2 -d' ')
7-
epoch := $(shell date +"%s")
6+
branch ?= $(shell git branch | grep \* | cut -f2 -d' ')
7+
epoch ?= $(shell date +"%s")
88
AR_REPO ?= codecov/api
99
DOCKERHUB_REPO ?= codecov/self-hosted-api
10-
REQUIREMENTS_TAG := requirements-v1-$(shell sha1sum uv.lock | cut -d ' ' -f 1)-$(shell sha1sum docker/Dockerfile.requirements | cut -d ' ' -f 1)
11-
VERSION := release-${sha}
10+
REQUIREMENTS_TAG ?= requirements-v1-$(shell sha1sum uv.lock | cut -d ' ' -f 1)-$(shell sha1sum docker/Dockerfile.requirements | cut -d ' ' -f 1)
11+
VERSION ?= release-${sha}
1212
CODECOV_UPLOAD_TOKEN ?= "notset"
1313
CODECOV_STATIC_TOKEN ?= "notset"
1414
CODECOV_URL ?= "https://api.codecov.io"
@@ -19,6 +19,9 @@ export CODECOV_TOKEN=${CODECOV_UPLOAD_TOKEN}
1919
API_DOMAIN ?= api
2020
PROXY_NETWORK ?= api_default
2121

22+
DEFAULT_REQS_TAG := requirements-v1-$(shell sha1sum uv.lock | cut -d ' ' -f 1)-$(shell sha1sum docker/Dockerfile.requirements | cut -d ' ' -f 1)
23+
REQUIREMENTS_TAG ?= ${DEFAULT_REQS_TAG}
24+
2225
# We allow this to be overridden so that we can run `pytest` from this directory
2326
# but have the junit file use paths relative to a parent directory. This will
2427
# help us move to a monorepo.
@@ -70,6 +73,12 @@ lint.check:
7073
ruff format --check
7174

7275
build.requirements:
76+
# If make was given a different requirements tag, we assume a suitable image
77+
# was already built (e.g. by umbrella) and don't want to build this one.
78+
ifneq (${REQUIREMENTS_TAG},${DEFAULT_REQS_TAG})
79+
echo "Error: building api reqs image despite another being provided"
80+
exit 1
81+
endif
7382
# if docker pull succeeds, we have already build this version of
7483
# requirements.txt. Otherwise, build and push a version tagged
7584
# with the hash of this requirements.txt

0 commit comments

Comments
 (0)