Skip to content

Commit 130af54

Browse files
authored
Merge pull request #8066 from raywainman/cluster-autoscaler-build
cloudbuild.yaml file for cluster-autoscaler for automated builds
2 parents 420df58 + c897c97 commit 130af54

File tree

2 files changed

+20
-61
lines changed

2 files changed

+20
-61
lines changed

cluster-autoscaler/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LDFLAGS?=-s
77
ENVVAR=CGO_ENABLED=0
88
GOOS?=linux
99
GOARCH?=$(shell go env GOARCH)
10-
REGISTRY?=staging-k8s.gcr.io
10+
REGISTRY?=gcr.io/k8s-staging-autoscaling
1111
DOCKER_NETWORK?=default
1212
SUPPORTED_BUILD_TAGS=$(shell ls cloudprovider/builder/ | grep -e '^builder_.*\.go' | sed 's/builder_\(.*\)\.go/\1/')
1313
ifdef BUILD_TAGS
@@ -64,7 +64,8 @@ dev-release-arch-%: build-arch-% make-image-arch-% push-image-arch-%
6464
make-image: make-image-arch-$(GOARCH)
6565

6666
make-image-arch-%:
67-
GOOS=$(GOOS) GOARCH=$* docker buildx build --pull --platform linux/$* \
67+
GOOS=$(GOOS) docker buildx build --pull --platform linux/$* \
68+
--build-arg "GOARCH=$*" \
6869
-t ${IMAGE}-$*:${TAG} \
6970
-f Dockerfile .
7071
@echo "Image ${TAG}${FOR_PROVIDER}-$* completed"
@@ -74,12 +75,15 @@ push-image: push-image-arch-$(GOARCH)
7475
push-image-arch-%:
7576
./push_image.sh ${IMAGE}-$*:${TAG}
7677

78+
push-release-image-arch-%:
79+
docker push ${IMAGE}-$*:${TAG}
80+
7781
push-manifest:
7882
docker manifest create ${IMAGE}:${TAG} \
7983
$(addprefix $(REGISTRY)/cluster-autoscaler$(PROVIDER)-, $(addsuffix :$(TAG), $(ALL_ARCH)))
8084
docker manifest push --purge ${IMAGE}:${TAG}
8185

82-
execute-release: $(addprefix make-image-arch-,$(ALL_ARCH)) $(addprefix push-image-arch-,$(ALL_ARCH)) push-manifest
86+
execute-release: $(addprefix make-image-arch-,$(ALL_ARCH)) $(addprefix push-release-image-arch-,$(ALL_ARCH)) push-manifest
8387
@echo "Release ${TAG}${FOR_PROVIDER} completed"
8488

8589
clean: clean-arch-$(GOARCH)

cluster-autoscaler/cloudbuild.yaml

Lines changed: 13 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,15 @@
1+
# See https://cloud.google.com/cloud-build/docs/build-config
2+
timeout: 3600s
13
options:
2-
machineType: E2_HIGHCPU_32
3-
timeout: 10800s
4-
5-
substitutions:
6-
{ "_TAG": "dev" }
7-
4+
# this prevents errors if you don't use both _GIT_TAG and _PULL_BASE_REF,
5+
# or any new substitutions added in the future.
6+
substitution_option: ALLOW_LOOSE
87
steps:
9-
- name: gcr.io/cloud-builders/git
10-
id: git-clone
11-
entrypoint: bash
12-
args:
13-
- "-c"
14-
- |
15-
set -ex
16-
mkdir -p /workspace/src/k8s.io
17-
cd /workspace/src/k8s.io
18-
git clone https://github.com/kubernetes/autoscaler.git
19-
20-
- name: gcr.io/cloud-builders/docker
21-
id: build-build-container
22-
entrypoint: bash
23-
dir: "/workspace/src/k8s.io/autoscaler/cluster-autoscaler"
24-
args:
25-
- "-c"
26-
- |
27-
set -e
28-
docker build -t autoscaling-builder ../builder
29-
30-
- name: autoscaling-builder
31-
id: run-tests
32-
entrypoint: godep
33-
dir: "/workspace/src/k8s.io/autoscaler/cluster-autoscaler"
34-
env:
35-
- "GOPATH=/workspace/"
36-
args: ["go", "test", "./..."]
37-
38-
- name: autoscaling-builder
39-
id: run-build
40-
entrypoint: godep
41-
dir: "/workspace/src/k8s.io/autoscaler/cluster-autoscaler"
42-
env:
43-
- "GOPATH=/workspace/"
44-
- "GOOS=linux"
45-
args: ["go", "build", "-o", "cluster-autoscaler"]
46-
waitFor: build-build-container
47-
48-
- name: gcr.io/cloud-builders/docker
49-
id: build-container
50-
entrypoint: bash
51-
dir: "/workspace/src/k8s.io/autoscaler/cluster-autoscaler"
52-
args:
53-
- "-c"
54-
- |
55-
set -e
56-
docker build -t gcr.io/k8s-image-staging/cluster-autoscaler:${_TAG} .
57-
waitFor: ["run-tests", "run-build"]
58-
59-
images:
60-
- "gcr.io/k8s-image-staging/cluster-autoscaler:${_TAG}"
8+
- name: "gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:latest"
9+
entrypoint: make
10+
env:
11+
- TAG=$_GIT_TAG
12+
args:
13+
- execute-release
14+
substitutions:
15+
_GIT_TAG: "0.0.0" # default value, this is substituted at build time

0 commit comments

Comments
 (0)