Merge pull request #8042 from jackfrancis/cas-release-automation

cluster autoscaler: enable automated builds for release
This commit is contained in:
Kubernetes Prow Robot 2025-04-24 07:40:31 -07:00 committed by GitHub
commit 6771ca4848
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 50 deletions

View File

@ -11,9 +11,20 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASEIMAGE=gcr.io/distroless/static:nonroot-amd64
FROM $BASEIMAGE
FROM --platform=$BUILDPLATFORM golang:1.23 as builder
WORKDIR /workspace
COPY . .
ARG GOARCH
ARG LDFLAGS_FLAG
ARG TAGS_FLAG
RUN CGO_ENABLED=0 GOOS=linux go build -o cluster-autoscaler-$GOARCH $LDFLAGS_FLAG $TAGS_FLAG
FROM gcr.io/distroless/static:nonroot
ARG GOARCH
COPY --from=builder /workspace/cluster-autoscaler-$GOARCH /cluster-autoscaler
COPY cluster-autoscaler-amd64 /cluster-autoscaler
WORKDIR /
CMD ["/cluster-autoscaler"]

View File

@ -1,19 +0,0 @@
# Copyright 2016 The Kubernetes Authors. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASEIMAGE=gcr.io/distroless/static:nonroot-arm64
FROM $BASEIMAGE
COPY cluster-autoscaler-arm64 /cluster-autoscaler
WORKDIR /
CMD ["/cluster-autoscaler"]

View File

@ -1,19 +0,0 @@
# Copyright 2016 The Kubernetes Authors. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASEIMAGE=gcr.io/distroless/static:nonroot-s390x
FROM $BASEIMAGE
COPY cluster-autoscaler-s390x /cluster-autoscaler
WORKDIR /
CMD ["/cluster-autoscaler"]

View File

@ -20,7 +20,7 @@ else
FOR_PROVIDER=
endif
ifdef LDFLAGS
LDFLAGS_FLAG=--ldflags "${LDFLAGS}"
LDFLAGS_FLAG=--ldflags="${LDFLAGS}"
else
LDFLAGS_FLAG=
endif
@ -64,15 +64,9 @@ dev-release-arch-%: build-arch-% make-image-arch-% push-image-arch-%
make-image: make-image-arch-$(GOARCH)
make-image-arch-%:
ifdef BASEIMAGE
docker build --pull --build-arg BASEIMAGE=${BASEIMAGE} \
GOOS=$(GOOS) GOARCH=$* docker buildx build --pull --platform linux/$* \
-t ${IMAGE}-$*:${TAG} \
-f Dockerfile.$* .
else
docker build --pull \
-t ${IMAGE}-$*:${TAG} \
-f Dockerfile.$* .
endif
-f Dockerfile .
@echo "Image ${TAG}${FOR_PROVIDER}-$* completed"
push-image: push-image-arch-$(GOARCH)