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

create Containerfiles for pushing images #3851

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
19 changes: 19 additions & 0 deletions external-plugins/phased/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM quay.io/kubevirtci/golang:v20241213-57bd934 as builder
ENV GOPROXY=https://proxy.golang.org|direct \
GOFLAGS="-mod=vendor -ldflags=-extldflags=\"-static\"" \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
ENV GIMME_GO_VERSION=1.21.6
RUN mkdir kubevirt && \
cd kubevirt && \
git clone https://github.com/kubevirt/project-infra.git && \
cd project-infra && \
/usr/local/bin/runner.sh /bin/sh -ce "go mod vendor" && \
/usr/local/bin/runner.sh /bin/sh -ce "env GOPROXY=off go build -tags netgo -o /go/bin/phased ./external-plugins/phased/plugin/main.go" && \
/usr/local/bin/runner.sh /bin/sh -ce "go clean -cache -modcache" && \
cd .. && rm -rf ./project-infra

FROM gcr.io/k8s-prow/git:v20231107-c87e01249e
COPY --from=builder /go/bin/phased /usr/bin/phased
ENTRYPOINT ["/usr/bin/phased"]
11 changes: 6 additions & 5 deletions external-plugins/phased/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
CONTAINER_IMAGE := referee
CONTAINER_REPO := quay.io/kubevirtci/$(CONTAINER_IMAGE)

.PHONY: all clean format test push
all: format test push
bazelbin := bazelisk

build:
$(bazelbin) build //external-plugins/phased/plugin
go build ./plugin/...

format:
gofmt -w .

test:
$(bazelbin) test //external-plugins/phased/...
go test ./plugin/...

push:
$(bazelbin) run --stamp --workspace_status_command="./hack/print-workspace-status-no-git-tag.sh" //external-plugins/phased/plugin:push
bash -x ../../hack/update-deployments-with-latest-image.sh quay.io/kubevirtci/phased
cd ../../images && ./publish_image.sh $(CONTAINER_IMAGE) quay.io kubevirtci
bash -x ../../hack/update-deployments-with-latest-image.sh $(CONTAINER_REPO)
19 changes: 19 additions & 0 deletions external-plugins/rehearse/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM quay.io/kubevirtci/golang:v20241213-57bd934 as builder
ENV GOPROXY=https://proxy.golang.org|direct \
GOFLAGS="-mod=vendor -ldflags=-extldflags=\"-static\"" \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
ENV GIMME_GO_VERSION=1.21.6
RUN mkdir kubevirt && \
cd kubevirt && \
git clone https://github.com/kubevirt/project-infra.git && \
cd project-infra && \
/usr/local/bin/runner.sh /bin/sh -ce "go mod vendor" && \
/usr/local/bin/runner.sh /bin/sh -ce "env GOPROXY=off go build -tags netgo -o /go/bin/rehearse ./external-plugins/rehearse/plugin/main.go" && \
/usr/local/bin/runner.sh /bin/sh -ce "go clean -cache -modcache" && \
cd .. && rm -rf ./project-infra

FROM gcr.io/k8s-prow/git:v20231107-c87e01249e
COPY --from=builder /go/bin/rehearse /usr/bin/rehearse
ENTRYPOINT ["/usr/bin/rehearse"]
11 changes: 6 additions & 5 deletions external-plugins/rehearse/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
CONTAINER_IMAGE := referee
CONTAINER_REPO := quay.io/kubevirtci/$(CONTAINER_IMAGE)

.PHONY: all clean format test push
all: format test push
bazelbin := bazelisk

build:
$(bazelbin) build //external-plugins/rehearse/plugin
go build ./...

format:
gofmt -w .

test:
$(bazelbin) test //external-plugins/rehearse/...
go test ./...

push:
$(bazelbin) run --stamp --workspace_status_command="./hack/print-workspace-status-no-git-tag.sh" //external-plugins/rehearse/plugin:push
bash -x ../../hack/update-deployments-with-latest-image.sh quay.io/kubevirtci/rehearse
cd ../../images && ./publish_image.sh $(CONTAINER_IMAGE) quay.io kubevirtci
bash -x ../../hack/update-deployments-with-latest-image.sh $(CONTAINER_REPO)
11 changes: 6 additions & 5 deletions external-plugins/release-blocker/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
CONTAINER_IMAGE := release-blocker
CONTAINER_REPO := quay.io/kubevirtci/$(CONTAINER_IMAGE)

.PHONY: all clean format test push
all: format test push
bazelbin := bazelisk

build:
$(bazelbin) build //external-plugins/release-blocker:release-blocker
go build ./...

format:
gofmt -w .

test:
$(bazelbin) test //external-plugins/release-blocker:*
go test ./...

push:
$(bazelbin) run //external-plugins/release-blocker:push
bash -x ../../hack/update-jobs-with-latest-image.sh quay.io/kubevirtci/release-blocker
cd ../../images && ./publish_image.sh $(CONTAINER_IMAGE) quay.io kubevirtci
bash -x ../../hack/update-jobs-with-latest-image.sh $(CONTAINER_REPO)
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ periodics:
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/gcs/service-account.json
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down Expand Up @@ -46,8 +44,6 @@ periodics:
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/gcs/service-account.json
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down Expand Up @@ -81,8 +77,6 @@ periodics:
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/gcs/service-account.json
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ periodics:
spec:
containers:
- image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand All @@ -32,8 +30,6 @@ periodics:
spec:
containers:
- image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand All @@ -53,8 +49,6 @@ periodics:
spec:
containers:
- image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ periodics:
spec:
containers:
- image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand All @@ -33,8 +31,6 @@ periodics:
spec:
containers:
- image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand All @@ -55,8 +51,6 @@ periodics:
spec:
containers:
- image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ periodics:
- --report_output_child_path=kubevirt/kubevirt
- --skip_results_before_start_of_report=false
- --pr_base_branch=main
command:
- /app/robots/cmd/flakefinder/app.binary
image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
name: ""
resources: {}
Expand All @@ -42,8 +40,6 @@ periodics:
- --skip_results_before_start_of_report=false
- --periodic_job_dir_regex=periodic-kubevirt-e2e-.*
- --pr_base_branch=main
command:
- /app/robots/cmd/flakefinder/app.binary
image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
name: ""
resources: {}
Expand All @@ -66,8 +62,6 @@ periodics:
- --skip_results_before_start_of_report=false
- --periodic_job_dir_regex=periodic-kubevirt-e2e-.*
- --pr_base_branch=main
command:
- /app/robots/cmd/flakefinder/app.binary
image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
name: ""
resources: {}
Expand Down Expand Up @@ -176,8 +170,6 @@ periodics:
- --skip_results_before_start_of_report=false
- --periodic_job_dir_regex=periodic-kubevirt-e2e-.*
- --pr_base_branch=main
command:
- /app/robots/cmd/flakefinder/app.binary
image: quay.io/kubevirtci/flakefinder:v20230112-ec14f598
name: ""
resources: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ periodics:
spec:
containers:
- image: quay.io/kubevirtci/indexpagecreator:v20230102-5ed6f7d7
command:
- "/app/robots/cmd/indexpagecreator/app.binary"
args:
- --dry-run=false
- name: periodic-kubevirt-mirror-uploader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ postsubmits:
- "-c"
- |
cat "$QUAY_PASSWORD" | podman login --username $(cat "$QUAY_USER") --password-stdin=true quay.io
bazelisk run //external-plugins/release-blocker:push
make -C ./external-plugins/release-blocker push
resources:
requests:
memory: "8Gi"
Expand Down Expand Up @@ -700,7 +700,8 @@ postsubmits:
- "-c"
- |
cat "$QUAY_PASSWORD" | podman login --username $(cat "$QUAY_USER") --password-stdin=true quay.io
bazelisk run //robots/cmd/ci-usage-exporter:push
cd images
./publish_image.sh ci-usage-exporter quay.io kubevirtci
resources:
requests:
memory: "8Gi"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ periodics:
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/gcs/service-account.json
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down Expand Up @@ -46,8 +44,6 @@ periodics:
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/gcs/service-account.json
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down Expand Up @@ -81,8 +77,6 @@ periodics:
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/gcs/service-account.json
command:
- "/app/robots/cmd/flakefinder/app.binary"
args:
- --dry-run=false
- --token=/etc/github/oauth
Expand Down
19 changes: 19 additions & 0 deletions images/ci-usage-exporter/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM quay.io/kubevirtci/golang:v20241213-57bd934 as builder
ENV GOPROXY=https://proxy.golang.org|direct \
GOFLAGS="-mod=vendor -ldflags=-extldflags=\"-static\"" \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
ENV GIMME_GO_VERSION=1.21.6
RUN mkdir kubevirt && \
cd kubevirt && \
git clone https://github.com/kubevirt/project-infra.git && \
cd project-infra && \
/usr/local/bin/runner.sh /bin/sh -ce "go mod vendor" && \
/usr/local/bin/runner.sh /bin/sh -ce "env GOPROXY=off go build -tags netgo -o /go/bin/ci-usage-exporter ./robots/cmd/ci-usage-exporter" && \
/usr/local/bin/runner.sh /bin/sh -ce "go clean -cache -modcache" && \
cd .. && rm -rf ./project-infra

FROM gcr.io/k8s-prow/git:v20231107-c87e01249e
COPY --from=builder /go/bin/ci-usage-exporter /usr/bin/ci-usage-exporter
ENTRYPOINT ["/usr/bin/ci-usage-exporter"]
19 changes: 19 additions & 0 deletions images/flake-report-creator/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM quay.io/kubevirtci/golang:v20241213-57bd934 as builder
ENV GOPROXY=https://proxy.golang.org|direct \
GOFLAGS="-mod=vendor -ldflags=-extldflags=\"-static\"" \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
ENV GIMME_GO_VERSION=1.21.6
RUN mkdir kubevirt && \
cd kubevirt && \
git clone https://github.com/kubevirt/project-infra.git && \
cd project-infra && \
/usr/local/bin/runner.sh /bin/sh -ce "go mod vendor" && \
/usr/local/bin/runner.sh /bin/sh -ce "env GOPROXY=off go build -tags netgo -o /go/bin/flake-report-creator ./robots/cmd/flake-report-creator" && \
/usr/local/bin/runner.sh /bin/sh -ce "go clean -cache -modcache" && \
cd .. && rm -rf ./project-infra

FROM gcr.io/k8s-prow/git:v20231107-c87e01249e
COPY --from=builder /go/bin/flake-report-creator /usr/bin/flake-report-creator
ENTRYPOINT ["/usr/bin/flake-report-creator"]
19 changes: 19 additions & 0 deletions images/flakefinder/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM quay.io/kubevirtci/golang:v20241213-57bd934 as builder
ENV GOPROXY=https://proxy.golang.org|direct \
GOFLAGS="-mod=vendor -ldflags=-extldflags=\"-static\"" \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
ENV GIMME_GO_VERSION=1.21.6
RUN mkdir kubevirt && \
cd kubevirt && \
git clone https://github.com/kubevirt/project-infra.git && \
cd project-infra && \
/usr/local/bin/runner.sh /bin/sh -ce "go mod vendor" && \
/usr/local/bin/runner.sh /bin/sh -ce "env GOPROXY=off go build -tags netgo -o /go/bin/flakefinder ./robots/cmd/flakefinder" && \
/usr/local/bin/runner.sh /bin/sh -ce "go clean -cache -modcache" && \
cd .. && rm -rf ./project-infra

FROM gcr.io/k8s-prow/git:v20231107-c87e01249e
COPY --from=builder /go/bin/flakefinder /usr/bin/flakefinder
ENTRYPOINT ["/usr/bin/flakefinder"]
19 changes: 19 additions & 0 deletions images/indexpagecreator/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM quay.io/kubevirtci/golang:v20241213-57bd934 as builder
ENV GOPROXY=https://proxy.golang.org|direct \
GOFLAGS="-mod=vendor -ldflags=-extldflags=\"-static\"" \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
ENV GIMME_GO_VERSION=1.21.6
RUN mkdir kubevirt && \
cd kubevirt && \
git clone https://github.com/kubevirt/project-infra.git && \
cd project-infra && \
/usr/local/bin/runner.sh /bin/sh -ce "go mod vendor" && \
/usr/local/bin/runner.sh /bin/sh -ce "env GOPROXY=off go build -tags netgo -o /go/bin/indexpagecreator ./robots/cmd/indexpagecreator" && \
/usr/local/bin/runner.sh /bin/sh -ce "go clean -cache -modcache" && \
cd .. && rm -rf ./project-infra

FROM gcr.io/k8s-prow/git:v20231107-c87e01249e
COPY --from=builder /go/bin/indexpagecreator /usr/bin/indexpagecreator
ENTRYPOINT ["/usr/bin/indexpagecreator"]
4 changes: 2 additions & 2 deletions images/publish_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ get_image_tag() {
build_image() {
local build_target="${1:?}"
local image_name="${2:?}"
docker build . -t "$image_name" -t "$build_target"
podman build . -t "$image_name" -t "$build_target"
}

publish_image() {
local full_image_name="${1:?}"

docker push "${full_image_name}"
podman push "${full_image_name}"
}

get_full_image_name() {
Expand Down
Loading