Skip to content

Commit

Permalink
prow: Build minimal arm64 payload
Browse files Browse the repository at this point in the history
The arm64 payload only contains the following four images which are
the minimal requirements for scheduling Prow builds on an arm64 build
farm:
- clonerefs
- entrypoint
- initupload
- sidecar

The image will be tagged as before but with an additional `-arm64` suffix.
  • Loading branch information
LorbusChris committed Jun 10, 2021
1 parent b054bd5 commit d715b77
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 5 deletions.
15 changes: 14 additions & 1 deletion prow/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_docker//container:bundle.bzl", "container_bundle")
load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push")
load("//prow:def.bzl", "prefix", "prow_push", "tags")
load("//prow:def.bzl", "prefix", "prow_push", "tags", "tags_arm64")
load("//def:image.bzl", image_tags = "tags")

prow_push(
Expand Down Expand Up @@ -59,6 +59,19 @@ prow_push(
),
)

prow_push(
name = "release-push-arm64",
bundle_name = "release-arm64",
images = tags_arm64(
cmds = [
"clonerefs",
"entrypoint",
"initupload",
"sidecar",
],
),
)

prow_push(
name = "testimage-push",
bundle_name = "testimage",
Expand Down
1 change: 1 addition & 0 deletions prow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ bazel-release-push:
@echo Be sure to setup authentication: https://github.com/bazelbuild/rules_docker#authentication
@echo Also run gcloud auth application-default login
bazel run //prow:release-push --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64
bazel run //prow:release-push-arm64 --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

.PHONY: bazel-release-push

Expand Down
17 changes: 16 additions & 1 deletion prow/cmd/clonerefs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//prow:def.bzl", "prow_image")
load("//prow:def.bzl", "prow_image", "prow_image_arm64")

go_library(
name = "go_default_library",
Expand Down Expand Up @@ -38,6 +38,21 @@ prow_image(
visibility = ["//visibility:public"],
)

prow_image_arm64(
name = "image-arm64",
base = "@git-base-arm64//image",
component = NAME,
files = [
"github_known_hosts",
"ssh_config",
],
symlinks = {
"/clonerefs": "/app/prow/cmd/clonerefs/app.binary",
"/etc/ssh/ssh_config": "/ssh_config",
},
visibility = ["//visibility:public"],
)

filegroup(
name = "package-srcs",
srcs = glob(["**"]),
Expand Down
10 changes: 9 additions & 1 deletion prow/cmd/entrypoint/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//prow:def.bzl", "prow_image")
load("//prow:def.bzl", "prow_image", "prow_image_arm64")

go_library(
name = "go_default_library",
Expand Down Expand Up @@ -31,6 +31,14 @@ prow_image(
visibility = ["//visibility:public"],
)

prow_image_arm64(
name = "image-arm64",
base = "@git-base-arm64//image",
component = NAME,
symlinks = {"/entrypoint": "/app/prow/cmd/entrypoint/app.binary"},
visibility = ["//visibility:public"],
)

filegroup(
name = "package-srcs",
srcs = glob(["**"]),
Expand Down
10 changes: 9 additions & 1 deletion prow/cmd/initupload/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//prow:def.bzl", "prow_image")
load("//prow:def.bzl", "prow_image", "prow_image_arm64")

go_library(
name = "go_default_library",
Expand Down Expand Up @@ -31,6 +31,14 @@ prow_image(
visibility = ["//visibility:public"],
)

prow_image_arm64(
name = "image-arm64",
base = "@git-base-arm64//image",
component = NAME,
symlinks = {"/initupload": "/app/prow/cmd/initupload/app.binary"},
visibility = ["//visibility:public"],
)

filegroup(
name = "package-srcs",
srcs = glob(["**"]),
Expand Down
10 changes: 9 additions & 1 deletion prow/cmd/sidecar/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//prow:def.bzl", "prow_image")
load("//prow:def.bzl", "prow_image", "prow_image_arm64")

go_library(
name = "go_default_library",
Expand Down Expand Up @@ -31,6 +31,14 @@ prow_image(
visibility = ["//visibility:public"],
)

prow_image_arm64(
name = "image-arm64",
base = "@git-base-arm64//image",
component = NAME,
symlinks = {"/sidecar": "/app/prow/cmd/sidecar/app.binary"},
visibility = ["//visibility:public"],
)

filegroup(
name = "package-srcs",
srcs = glob(["**"]),
Expand Down
12 changes: 12 additions & 0 deletions prow/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,15 @@ for i in {1..3}; do
echo "Failed attempt $i, retrying..."
sleep 5
done
echo -e "Pushing $(color-version ${new_version}) arm64 images via $(color-target //prow:release-push-arm64 --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64) ..." >&2
# Remove retries after https://github.com/bazelbuild/rules_docker/issues/673
for i in {1..3}; do
if bazel run //prow:release-push-arm64 --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64; then
exit 0
elif [[ "$i" == 3 ]]; then
echo "Failed"
exit 1
fi
echo "Failed attempt $i, retrying..."
sleep 5
done

0 comments on commit d715b77

Please sign in to comment.