Skip to content

Commit

Permalink
Fix auto-tag build scripts (#294)
Browse files Browse the repository at this point in the history
Description of changes:
When adding the [Go version and architecture to the code-generator Dockerfile](aws-controllers-k8s/code-generator#391), it broke the continuous deployment scripts which use a separate set of calls (to `buildah`) instead of using `build-controller-image.sh`. This pull request adds the same `GOARCH` and `GOLANG_VERSION` build arguments to the `release-controller.sh` script and adds the Go CLI to the deploy container to support them.

These changes were validated by running a custom edit of the Prowjob against the new images and script. Log output: https://prow.ack.aws.dev/view/s3/ack-prow-logs/logs/lambda-post-submit/1620583281521070080

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
RedbackThomson authored Feb 1, 2023
1 parent 9b24d14 commit c1ea63e
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 43 deletions.
18 changes: 11 additions & 7 deletions cd/scripts/release-controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Environment variables:
# find out the service name and semver tag from the prow environment variables.
AWS_SERVICE=$(echo "$REPO_NAME" | rev | cut -d"-" -f2- | rev | tr '[:upper:]' '[:lower:]')
VERSION=$PULL_BASE_REF
GOARCH=${GOARCH:-"$(go env GOARCH)"}

# Important Directory references based on prowjob configuration.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
Expand Down Expand Up @@ -135,26 +136,29 @@ if ! (echo "$VERSION" | grep -Eq "stable$"); then
echo " git commit: $SERVICE_CONTROLLER_GIT_COMMIT"
fi

pushd "$CODE_GEN_DIR" 1>/dev/null
# Get the golang version from the code-generator
GOLANG_VERSION=${GOLANG_VERSION:-"$(go list -f \{\{.GoVersion\}\} -m)"}
popd 1>/dev/null

# build controller image
buildah bud \
if ! buildah bud \
--quiet="$QUIET" \
-t "$AWS_SERVICE_DOCKER_IMG" \
-f "$CONTROLLER_IMAGE_DOCKERFILE_PATH" \
--build-arg service_alias="$AWS_SERVICE" \
--build-arg service_controller_git_version="$VERSION" \
--build-arg service_controller_git_commit="$SERVICE_CONTROLLER_GIT_COMMIT" \
--build-arg build_date="$BUILD_DATE" \
"${DOCKER_BUILD_CONTEXT}"

if [ $? -ne 0 ]; then
--build-arg golang_version="$GOLANG_VERSION" \
--build-arg go_arch="$GOARCH" \
"$DOCKER_BUILD_CONTEXT"; then
exit 2
fi

echo "Pushing '$AWS_SERVICE' controller image with tag: ${AWS_SERVICE_DOCKER_IMG}"

buildah push "${AWS_SERVICE_DOCKER_IMG}"

if [ $? -ne 0 ]; then
if ! buildah push "${AWS_SERVICE_DOCKER_IMG}"; then
exit 2
fi
fi
Expand Down
17 changes: 17 additions & 0 deletions prow/jobs/images/Dockerfile.deploy
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Dockerfile for Prow CD postsubmit jobs
FROM quay.io/containers/buildah:v1.20.1

ARG GOPROXY=https://proxy.golang.org|direct
ENV GOPROXY=${GOPROXY}

ARG GO_VERSION=1.19
ENV GO_VERSION=${GO_VERSION}

ENV GOPATH=/home/prow/go \
GO111MODULE=on \
PATH=/home/prow/go/bin:/usr/local/go/bin:${PATH}

RUN dnf -y install \
which \
git \
Expand All @@ -15,6 +25,13 @@ RUN dnf -y install \
&& curl -L -s https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 --output /usr/bin/yq \
&& chmod +x /usr/bin/yq

RUN echo "Installing Go ..." \
&& export GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz"\
&& curl -fsSL "https://storage.googleapis.com/golang/${GO_TARBALL}" --output "${GO_TARBALL}" \
&& tar xzf "${GO_TARBALL}" -C /usr/local \
&& rm "${GO_TARBALL}"\
&& mkdir -p "${GOPATH}/bin"

RUN echo "Installing Helm ... " \
&& export HELM_TARBALL="helm.tar.gz" \
&& curl -fsSL https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz --output "${HELM_TARBALL}" \
Expand Down
2 changes: 1 addition & 1 deletion prow/jobs/images_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ images:
auto-generate-controllers: prow-auto-generate-controllers-0.0.8
auto-update-controllers: prow-auto-update-controllers-0.0.2
controller-release-tag: prow-controller-release-tag-0.0.1
deploy: prow-deploy-0.0.7
deploy: prow-deploy-0.0.8

olm-test: prow-olm-test-0.0.6
olm-bundle-pr: prow-olm-bundle-pr-0.0.7
70 changes: 35 additions & 35 deletions prow/jobs/jobs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Autogenerated. Do NOT update Manually.
# Last generated on 2023-01-26 15:57:42.205097.
# Last generated on 2023-02-01 00:44:28.074757.
periodics:
- name: label-sync
labels:
Expand Down Expand Up @@ -569,7 +569,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -769,7 +769,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -969,7 +969,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -1169,7 +1169,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -1369,7 +1369,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -1569,7 +1569,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -1769,7 +1769,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -1969,7 +1969,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -2169,7 +2169,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -2369,7 +2369,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -2569,7 +2569,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -2769,7 +2769,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -2969,7 +2969,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -3169,7 +3169,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -3285,7 +3285,7 @@ postsubmits:
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: prowjob-github-token
name: prowjob-github-pat-token
key: token
- name: GITHUB_ACTOR
value: "ack-bot"
Expand All @@ -3311,7 +3311,7 @@ postsubmits:
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: prowjob-github-token
name: prowjob-github-pat-token
key: token
- name: GITHUB_ACTOR
value: "ack-bot"
Expand Down Expand Up @@ -3344,7 +3344,7 @@ postsubmits:
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: prowjob-github-token
name: prowjob-github-pat-token
key: token
- name: GITHUB_ACTOR
value: "ack-bot"
Expand All @@ -3369,7 +3369,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -3569,7 +3569,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -3769,7 +3769,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -3969,7 +3969,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -4169,7 +4169,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -4369,7 +4369,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -4569,7 +4569,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -4769,7 +4769,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -4969,7 +4969,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -5169,7 +5169,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -5369,7 +5369,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -5569,7 +5569,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -5769,7 +5769,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -5969,7 +5969,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -6169,7 +6169,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -6369,7 +6369,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down Expand Up @@ -6569,7 +6569,7 @@ postsubmits:
spec:
serviceAccountName: post-submit-service-account
containers:
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.7
- image: public.ecr.aws/m5q3e4b2/prow:prow-deploy-0.0.8
securityContext:
privileged: true
command: ["/bin/bash", "-c", "cd cd/scripts && ./release-controller.sh"]
Expand Down

0 comments on commit c1ea63e

Please sign in to comment.