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)
44release_version := ` cat VERSION `
55build_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")
88AR_REPO ?= codecov/api
99DOCKERHUB_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}
1212CODECOV_UPLOAD_TOKEN ?= "notset"
1313CODECOV_STATIC_TOKEN ?= "notset"
1414CODECOV_URL ?= "https://api.codecov.io"
@@ -19,6 +19,9 @@ export CODECOV_TOKEN=${CODECOV_UPLOAD_TOKEN}
1919API_DOMAIN ?= api
2020PROXY_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
7275build.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