Skip to content

Commit d2516b3

Browse files
committed
Change terminology to local for local docker image creation
There was some confusion about what was meant by `host` in the various target names, and in the documentation `local` seemed like a better term. Changed all make and bake targets to use the `local-image` instead of `host-image` or `image-host`.
1 parent 49c2ec1 commit d2516b3

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

Makefile.build.mk

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ $(BASE_BINARY_PATH)-%: GOARCH=$(lastword $(subst -, ,$(basename $*)))
3535
$(BASE_BINARY_PATH)-%:
3636
GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build -trimpath -ldflags "$(GO_LDFLAGS)" -o $@
3737

38-
.PHONY: runner-image-host
39-
runner-image-host: export HOST_ARCH ?= $(shell go env GOARCH)
40-
runner-image-host: export HOST_FLAVOR ?= alpine-3.21
41-
runner-image-host: export RUNNER_IMAGES_VERSION ?= $(shell grep "RUNNER_IMAGES_VERSION:" .gitlab/ci/_common.gitlab-ci.yml | awk -F': ' '{ print $$2 }' | tr -d '"')
42-
runner-image-host: runner-bin-linux
43-
cd dockerfiles/runner && docker buildx bake --progress plain host-image
44-
45-
.PHONY: runner-and-helper-image-host
46-
runner-and-helper-image-host: runner-image-host helper-image-host
38+
.PHONY: runner-local-image
39+
runner-local-image: export LOCAL_ARCH ?= $(shell go env GOARCH)
40+
runner-local-image: export LOCAL_FLAVOR ?= alpine-3.21
41+
runner-local-image: export RUNNER_IMAGES_VERSION ?= $(shell grep "RUNNER_IMAGES_VERSION:" .gitlab/ci/_common.gitlab-ci.yml | awk -F': ' '{ print $$2 }' | tr -d '"')
42+
runner-local-image: runner-bin-linux
43+
cd dockerfiles/runner && docker buildx bake --progress plain local-image
44+
45+
.PHONY: runner-and-helper-local-image
46+
runner-and-helper-local-image: runner-local-image helper-local-image
4747

4848
out/runner-images: TARGETS ?= ubuntu alpine
4949
out/runner-images:

Makefile.runner_helper.mk

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ helper-bin-fips: ${BASE_BINARY_PATH}.linux-amd64-fips
4545
helper-images: $(BINARIES)
4646
helper-images: out/helper-images
4747

48-
.PHONY: helper-image-host
49-
helper-image-host: export HOST_ARCH ?= $(shell go env GOARCH)
50-
helper-image-host: export HOST_FLAVOR ?= alpine-3.21
51-
helper-image-host: export RUNNER_IMAGES_VERSION ?= $(shell grep "RUNNER_IMAGES_VERSION:" .gitlab/ci/_common.gitlab-ci.yml | awk -F': ' '{ print $$2 }' | tr -d '"')
52-
helper-image-host: helper-bin-linux
53-
cd dockerfiles/runner-helper && docker buildx bake --progress plain host-image
48+
.PHONY: helper-local-image
49+
helper-local-image: export LOCAL_ARCH ?= $(shell go env GOARCH)
50+
helper-local-image: export LOCAL_FLAVOR ?= alpine-3.21
51+
helper-local-image: export RUNNER_IMAGES_VERSION ?= $(shell grep "RUNNER_IMAGES_VERSION:" .gitlab/ci/_common.gitlab-ci.yml | awk -F': ' '{ print $$2 }' | tr -d '"')
52+
helper-local-image: helper-bin-linux
53+
cd dockerfiles/runner-helper && docker buildx bake --progress plain local-image
5454

5555
# Make sure the fips target is first since it's less general
5656
${BASE_BINARY_PATH}.linux-amd64-fips: GOOS=linux

dockerfiles/runner-helper/docker-bake.hcl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ variable "RUNNER_IMAGES_VERSION" {
66
default = "0.0.0"
77
}
88

9-
variable "HOST_ARCH" {
9+
variable "LOCAL_ARCH" {
1010
default = "amd64"
1111
}
1212

13-
variable "HOST_FLAVOR" {
13+
variable "LOCAL_FLAVOR" {
1414
default = "alpine-3.21"
1515
}
1616

@@ -135,14 +135,14 @@ target "windows" {
135135
}
136136

137137
# Used for local testing, creates the gitlab-runner-helper:local image in the user's current docker context
138-
target "host-image" {
138+
target "local-image" {
139139
inherits = ["base"]
140140

141141
args = {
142-
BASE_IMAGE = "${RUNNER_IMAGES_REGISTRY}/runner-helper:${RUNNER_IMAGES_VERSION}-${HOST_FLAVOR}"
142+
BASE_IMAGE = "${RUNNER_IMAGES_REGISTRY}/runner-helper:${RUNNER_IMAGES_VERSION}-${LOCAL_FLAVOR}"
143143
}
144144

145-
platforms = ["linux/${HOST_ARCH}"]
145+
platforms = ["linux/${LOCAL_ARCH}"]
146146
output = ["type=docker"]
147147
tags = ["gitlab-runner-helper:local"]
148148
}

dockerfiles/runner/docker-bake.hcl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ variable "RUNNER_IMAGES_VERSION" {
66
default = "0.0.0"
77
}
88

9-
variable "HOST_ARCH" {
9+
variable "LOCAL_ARCH" {
1010
default = "amd64"
1111
}
1212

13-
variable "HOST_FLAVOR" {
13+
variable "LOCAL_FLAVOR" {
1414
default = "alpine-3.21"
1515
}
1616

@@ -63,14 +63,14 @@ target "alpine" {
6363
}
6464

6565
# Used for local testing, creates the gitlab-runner:local image in the user's current docker context
66-
target "host-image" {
66+
target "local-image" {
6767
inherits = ["base"]
6868

6969
args = {
70-
BASE_IMAGE = "${RUNNER_IMAGES_REGISTRY}/runner:${RUNNER_IMAGES_VERSION}-${HOST_FLAVOR}"
70+
BASE_IMAGE = "${RUNNER_IMAGES_REGISTRY}/runner:${RUNNER_IMAGES_VERSION}-${LOCAL_FLAVOR}"
7171
}
7272

73-
platforms = ["linux/${HOST_ARCH}"]
73+
platforms = ["linux/${LOCAL_ARCH}"]
7474
output = ["type=docker"]
7575
tags = ["gitlab-runner:local"]
7676
}

docs/development/index.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,13 @@ To use the debugger, make sure to remove the last two flags (`-s -w`).
350350
You can build the runner and/or helper as a local docker image with:
351351

352352
```shell
353-
make runner-image-host # build only gitlab-runner:local
354-
make helper-image-host # build only gitlab-runner-helper:local
355-
make runner-and-helper-image-host # build both
353+
make runner-local-image # build only gitlab-runner:local
354+
make helper-local-image # build only gitlab-runner-helper:local
355+
make runner-and-helper-local-image # build both
356356
```
357357

358+
After the build completes, the images are ready to be used locally.
359+
358360
```shell
359361
docker image ls
360362
REPOSITORY TAG IMAGE ID CREATED SIZE
@@ -369,7 +371,7 @@ to set your docker context appropriately before building the images. For example
369371

370372
```shell
371373
eval $(minikube docker-env)
372-
make runner-and-helper-image-host
374+
make runner-and-helper-local-image
373375
```
374376

375377
## 9. Install optional tools

0 commit comments

Comments
 (0)