Skip to content

Commit af0074e

Browse files
Fully remove intermediate eksctl build image (#8341)
1 parent 779b56c commit af0074e

14 files changed

+308
-509
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
!.goreleaser*
44
!.golangci*
55
!.mockery.yaml
6+
!.requirements
67
!build/scripts
78
!cmd
89
!examples

.github/workflows/ecr-publish-build.yaml

-37
This file was deleted.

.github/workflows/test-and-build.yaml

-12
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,3 @@ jobs:
3535
run: make check-schema
3636
- name: Lint
3737
run: make lint
38-
image:
39-
name: Build and check image
40-
runs-on: ubuntu-latest
41-
steps:
42-
- name: Checkout
43-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
44-
with:
45-
fetch-depth: 0
46-
- name: Setup build environment
47-
uses: ./.github/actions/setup-build
48-
- name: build
49-
run: make -f Makefile.docker check-build-image-manifest-up-to-date

.requirements

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ github.com/maxbrunsfeld/counterfeiter/v6
22
github.com/cloudflare/cfssl/cmd/[email protected]
33
github.com/cloudflare/cfssl/cmd/[email protected]
44
github.com/golangci/golangci-lint/cmd/golangci-lint
5-
github.com/onsi/ginkgo/v2/ginkgo@v2.22.2
5+
github.com/onsi/ginkgo/v2/ginkgo
66
github.com/vektra/mockery/v2
77
github.com/github-release/github-release
88
k8s.io/code-generator/cmd/client-gen

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
FROM public.ecr.aws/docker/library/golang:1.24.0 AS builder
2+
FROM public.ecr.aws/docker/library/golang:1.24.2 AS builder
33

44
WORKDIR /src
55
COPY . .
@@ -14,6 +14,6 @@ RUN <<EOT
1414
chown 65532 eksctl
1515
EOT
1616

17-
FROM public.ecr.aws/eks-distro/kubernetes/go-runner:v0.16.4-eks-1-32-6 AS go-runner
17+
FROM public.ecr.aws/eks-distro/kubernetes/go-runner:v0.18.0-eks-1-32-10 AS go-runner
1818
COPY --from=builder /src/eksctl /eksctl
1919
ENTRYPOINT ["/eksctl"]

Makefile.docker

-54
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@ export PATH := ./build/scripts:$(PATH)
44

55
image_manifest_file = build/docker/build_image_manifest
66

7-
# We use git object hashes for determining the input files used for any given build image
8-
# E.g. given `public.ecr.aws/eksctl/eksctl-build:d94225a6dbb6dfab6dd185442ae554432f9365dc` one can
9-
# run `git show d94225a6dbb6dfab6dd185442ae554432f9365dc` to get contents of `.build_image_manifest`,
10-
# and `git show <hash>` for each of the hashes in the manifest to determine contents of each of the
11-
# files used in `$(build_image_input)` at the time.
12-
build_image_tag_file = build/docker/image_tag
13-
build_image_tag = $(shell cat $(build_image_tag_file))
14-
15-
build_image = public.ecr.aws/eksctl/eksctl-build
16-
build_image_name = $(build_image):$(build_image_tag)
17-
187
eksctl_image = public.ecr.aws/eksctl/eksctl
198
eksctl_image_name = "$(eksctl_image):$${EKSCTL_IMAGE_VERSION}"
209

@@ -33,55 +22,12 @@ endif
3322
authenticate-ecr-for-docker: ## Get ECR public registry credentials with AWS credentials
3423
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
3524

36-
.PHONY: update-build-image-tag
37-
update-build-image-tag: ## Update the build image tag as referenced across the repo
38-
build-image-manifest.sh > $(image_manifest_file)
39-
git hash-object $(image_manifest_file) > $(build_image_tag_file)
40-
sed $(sedi) -e "1s|\(BUILD_IMAGE=\).*|\1$(build_image):$$(cat $(build_image_tag_file))|" Dockerfile
41-
find .github/workflows -type f | xargs sed $(sedi) -e "s|\($(build_image):\).*|\1$$(cat $(build_image_tag_file))|"
42-
43-
.PHONY: check-build-image-manifest-up-to-date
44-
check-build-image-manifest-up-to-date: update-build-image-tag ## Update build image manifest and commits the changes
45-
git diff --quiet -- $(image_manifest_file) \
46-
|| (git --no-pager diff $(image_manifest_file); echo "HINT: to fix this, run 'make -f Makefile.docker update-build-image-tag' then 'commit-new-image-tag'"; exit 1)
47-
48-
.PHONY: commit-new-image-tag
49-
commit-new-image-tag: ## Update build image manifest and commits the changes
50-
git add -u
51-
git commit --message 'Update build image manifest, tag file and workflows'
52-
@echo "Remember to run \"Publish ECR eksctl-build image\" GitHub workflow after merging these image tag changes"
53-
54-
.PHONY: build-image
55-
build-image: check-build-image-manifest-up-to-date ## Build the build image that has all of external dependencies
56-
-docker pull $(build_image_name)
57-
cp .requirements build/scripts/install-build-deps.sh go.mod go.sum build/docker/
58-
$(docker_build) \
59-
--cache-from=$(build_image_name) \
60-
--tag=$(build_image_name) \
61-
build/docker/
62-
63-
.PHONY: push-build-image
64-
push-build-image: authenticate-ecr-for-docker build-image ## Push the build image to the ECR public registry
65-
docker push $(build_image_name)
66-
@echo "Remember to commit the image_tag and build_image_manifest files"
67-
6825
.PHONY: eksctl-image
6926
eksctl-image: ## Build the eksctl image that has release artefacts and no build dependencies
70-
docker pull $(build_image_name)
7127
$(docker_build) \
72-
--cache-from=$(build_image_name) \
7328
--tag=$(eksctl_image_name) \
74-
--build-arg=BUILD_IMAGE=$(build_image_name) \
7529
$(git_toplevel)
7630

7731
.PHONY: eksctl-image
7832
push-eksctl-image: eksctl-image ## Push the eksctl image to the ECR public registry
7933
docker push $(eksctl_image_name)
80-
81-
.PHONY: build-test
82-
build-test: ## Run targets from Makefile using the build image
83-
time docker run \
84-
--tty \
85-
--rm \
86-
--volume=$(git_toplevel):/src \
87-
$(build_image_name) make $@

build/build_image_manifest

-4
This file was deleted.

build/docker/Dockerfile

-56
This file was deleted.

build/docker/build_image_manifest

-17
This file was deleted.

build/docker/image_tag

-1
This file was deleted.

build/scripts/build-image-manifest.sh

-21
This file was deleted.

0 commit comments

Comments
 (0)