Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Support for ARM64 #334

Merged
merged 10 commits into from
Nov 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 32 additions & 98 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,101 +7,35 @@ gazelle(
prefix = "kope.io/etcd-manager",
)

[genrule(
name = "etcd-v2.2.1-linux-amd64_%s" % c,
srcs = ["@etcd_2_2_1_tar//file"],
outs = ["etcd-v2.2.1-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_2_2_1_tar//file) etcd-v2.2.1-linux-amd64/%s && mv etcd-v2.2.1-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.1.12-linux-amd64_%s" % c,
srcs = ["@etcd_3_1_12_tar//file"],
outs = ["etcd-v3.1.12-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_1_12_tar//file) etcd-v3.1.12-linux-amd64/%s && mv etcd-v3.1.12-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.2.18-linux-amd64_%s" % c,
srcs = ["@etcd_3_2_18_tar//file"],
outs = ["etcd-v3.2.18-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_2_18_tar//file) etcd-v3.2.18-linux-amd64/%s && mv etcd-v3.2.18-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.2.24-linux-amd64_%s" % c,
srcs = ["@etcd_3_2_24_tar//file"],
outs = ["etcd-v3.2.24-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_2_24_tar//file) etcd-v3.2.24-linux-amd64/%s && mv etcd-v3.2.24-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.3.10-linux-amd64_%s" % c,
srcs = ["@etcd_3_3_10_tar//file"],
outs = ["etcd-v3.3.10-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_3_10_tar//file) etcd-v3.3.10-linux-amd64/%s && mv etcd-v3.3.10-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.3.13-linux-amd64_%s" % c,
srcs = ["@etcd_3_3_13_tar//file"],
outs = ["etcd-v3.3.13-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_3_13_tar//file) etcd-v3.3.13-linux-amd64/%s && mv etcd-v3.3.13-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.3.17-linux-amd64_%s" % c,
srcs = ["@etcd_3_3_17_tar//file"],
outs = ["etcd-v3.3.17-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_3_17_tar//file) etcd-v3.3.17-linux-amd64/%s && mv etcd-v3.3.17-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.4.3-linux-amd64_%s" % c,
srcs = ["@etcd_3_4_3_tar//file"],
outs = ["etcd-v3.4.3-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_4_3_tar//file) etcd-v3.4.3-linux-amd64/%s && mv etcd-v3.4.3-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.4.13-linux-amd64_%s" % c,
srcs = ["@etcd_3_4_13_tar//file"],
outs = ["etcd-v3.4.13-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_4_13_tar//file) etcd-v3.4.13-linux-amd64/%s && mv etcd-v3.4.13-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]
load("//images:etcd.bzl", "supported_etcd_arch_and_version")

[
genrule(
name = "etcd-v{version}-linux-{arch}_{bin}".format(
version = version,
arch = arch,
bin = bin,
),
srcs = ["@etcd_{version}_{arch}_tar//file".format(
version = version,
arch = arch,
bin = bin,
)],
outs = ["etcd-v{version}-linux-{arch}/{bin}".format(
version = version,
arch = arch,
bin = bin,
)],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_{version}_{arch}_tar//file) etcd-v{version}-linux-{arch}/{bin} && mv etcd-v{version}-linux-{arch}/{bin} \"$@\"".format(
version = version,
arch = arch,
bin = bin,
),
visibility = ["//visibility:public"],
)
for (arch, version) in supported_etcd_arch_and_version()
for (bin) in [
"etcd",
"etcdctl",
]
]
53 changes: 48 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

STABLE_DOCKER_REGISTRY := $(shell tools/get_workspace_status.sh | grep STABLE_DOCKER_REGISTRY | cut -d ' ' -f 2)
STABLE_DOCKER_IMAGE_PREFIX := $(shell tools/get_workspace_status.sh | grep STABLE_DOCKER_IMAGE_PREFIX | cut -d ' ' -f 2)
STABLE_DOCKER_TAG := $(shell tools/get_workspace_status.sh | grep STABLE_DOCKER_TAG | cut -d ' ' -f 2)
IMAGE_BASE := $(STABLE_DOCKER_REGISTRY)/$(STABLE_DOCKER_IMAGE_PREFIX)

BAZEL_FLAGS=--features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

.PHONY: all
all: test

Expand All @@ -34,20 +40,57 @@ goimports:

.PHONY: push-etcd-manager
push-etcd-manager:
bazel run ${BAZEL_FLAGS} //images:push-etcd-manager
bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:push-etcd-manager
bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //images:push-etcd-manager

.PHONY: push-etcd-manager-manifest
push-etcd-manager-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create \
$(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG) \
$(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG)-amd64 \
$(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG)-arm64
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push --purge \
$(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG)

.PHONY: push-etcd-dump
push-etcd-dump:
bazel run ${BAZEL_FLAGS} //images:push-etcd-dump
bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:push-etcd-dump
bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //images:push-etcd-dump

.PHONY: push-etcd-dump-manifest
push-etcd-dump-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create \
$(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG) \
$(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG)-amd64 \
$(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG)-arm64
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push --purge \
$(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG)

.PHONY: push-etcd-backup
push-etcd-backup:
bazel run ${BAZEL_FLAGS} //images:push-etcd-backup
bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:push-etcd-backup
bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //images:push-etcd-backup

.PHONY: push
push: push-etcd-manager push-etcd-dump push-etcd-backup
.PHONY: push-etcd-backup-manifest
push-etcd-backup-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create \
$(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG) \
$(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG)-amd64 \
$(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG)-arm64
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push --purge \
$(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG)

.PHONY: push-images
push-images: push-etcd-manager push-etcd-dump push-etcd-backup
echo "pushed images"

.PHONY: push-manifests
push-manifests: push-etcd-manager-manifest push-etcd-dump-manifest push-etcd-backup-manifest
echo "pushed manifests"

.PHONY: push
push: push-images push-manifests

.PHONY: gazelle
gazelle:
bazel run //:gazelle -- fix
Expand Down
Loading