Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

David.benque/build image automation #106

Open
wants to merge 2 commits into
base: datadog-master-vpa-0.13.0
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include: https://gitlab-templates.ddbuild.io/compute-delivery/v2/compute-delivery.yml

test:
stage: verify
tags: [ "arch:amd64" ]
image: registry.ddbuild.io/images/mirror/golang:1.20
script:
- echo "TODO test"

build-docker-image:
variables:
EXTRA_ARGS: "-f vertical-pod-autoscaler/Dockerfile"

extends: .build-docker-image

27 changes: 27 additions & 0 deletions vertical-pod-autoscaler/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG BASE_IMAGE

FROM --platform=$BUILDPLATFORM golang:1.19 AS builder
WORKDIR /go/src/k8s.io/autoscaler
COPY . .
ARG TARGETARCH
ENV GO111MODULE "on"
ENV GOARCH=${TARGETARCH}

WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender
RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-recommender -buildvcs=false --ldflags "-s"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the introduction of the before script there https://github.com/DataDog/compute-delivery/blame/master/gitlab-pipeline-templates/v2/compute-delivery.yml#L137
it should work without -buildvcs=false


WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender-external
RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-recommender-external-metrics -buildvcs=false --ldflags "-s"

WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller
RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-admission-controller -buildvcs=false --ldflags "-s"

WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/updater
RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-updater -buildvcs=false --ldflags "-s"

FROM $BASE_IMAGE

COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender/vpa-recommender /usr/local/bin/vpa-recommender
COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender-external/vpa-recommender-external-metrics /usr/local/bin/vpa-recommender-external-metrics
COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller/vpa-admission-controller /usr/local/bin/vpa-admission-controller
COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/updater/vpa-updater /usr/local/bin/vpa-updater
Loading