|
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) |
3 | 3 | release_version = `cat VERSION` |
4 | 4 | _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) |
6 | 6 | build_date ?= $(shell git show -s --date=iso8601-strict --pretty=format:%cd $$sha) |
7 | 7 | name ?= worker |
8 | | -branch = $(shell git branch | grep \* | cut -f2 -d' ') |
| 8 | +branch ?= $(shell git branch | grep \* | cut -f2 -d' ') |
9 | 9 | gh_access_token := $(shell echo ${GH_ACCESS_TOKEN}) |
10 | | -epoch := $(shell date +"%s") |
| 10 | +epoch ?= $(shell date +"%s") |
11 | 11 |
|
12 | 12 | AR_REPO ?= codecov/worker |
13 | 13 | 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} |
16 | 15 | CODECOV_UPLOAD_TOKEN ?= "notset" |
17 | 16 | CODECOV_STATIC_TOKEN ?= "notset" |
18 | 17 | CODECOV_URL ?= "https://api.codecov.io" |
19 | 18 |
|
| 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 | + |
20 | 22 | # We allow this to be overridden so that we can run `pytest` from this directory |
21 | 23 | # but have the junit file use paths relative to a parent directory. This will |
22 | 24 | # help us move to a monorepo. |
@@ -89,6 +91,12 @@ lint.check: |
89 | 91 | ruff format --check |
90 | 92 |
|
91 | 93 | 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 |
92 | 100 | # if docker pull succeeds, we have already build this version of |
93 | 101 | # requirements.txt. Otherwise, build and push a version tagged |
94 | 102 | # with the hash of this requirements.txt |
|
0 commit comments