Skip to content

Commit

Permalink
fix: Fix build pipeline to always build dependencies. (#6823)
Browse files Browse the repository at this point in the history
* fix: build skaffold builder image always

* fix files

* increase timeout

* use gcr.io/gcp-runtimes/ubuntu_20_0_4 as base image

* fix: remove hack check skaffold builders
  • Loading branch information
tejal29 authored Nov 11, 2021
1 parent f00a80c commit 018b13a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 46 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ build_deps:
-t gcr.io/$(GCP_PROJECT)/build_deps:$(DEPS_DIGEST) \
deploy/skaffold
docker push gcr.io/$(GCP_PROJECT)/build_deps:$(DEPS_DIGEST)
@./hack/check-skaffold-builder.sh

.PHONY: skaffold-builder
skaffold-builder:
Expand Down
15 changes: 14 additions & 1 deletion deploy/cloudbuild-release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# using default substitutions, provided by Google Cloud Build
# see: https://cloud.google.com/container-builder/docs/configuring-builds/substitute-variable-values#using_default_substitutions
steps:

# Build and tag skaffold-deps image using docker with cache-from
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/build_deps:latest'
- '--cache-from'
- 'gcr.io/k8s-skaffold/build_deps:latest'
- '-f'
- 'deploy/skaffold/Dockerfile.deps'
- '.'

# Grab secret credentials from gcp bucket
- name: gcr.io/cloud-builders/gcloud
entrypoint: 'bash'
Expand Down Expand Up @@ -38,4 +51,4 @@ images:
options:
machineType: 'N1_HIGHCPU_8'

timeout: 1200s
timeout: 1500s
14 changes: 13 additions & 1 deletion deploy/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# using default substitutions, provided by Google Cloud Build
# see: https://cloud.google.com/container-builder/docs/configuring-builds/substitute-variable-values#using_default_substitutions
steps:
# Build and tag skaffold-deps image using docker with cache-from
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/build_deps:latest'
- '--cache-from'
- 'gcr.io/k8s-skaffold/build_deps:latest'
- '-f'
- 'deploy/skaffold/Dockerfile.deps'
- '.'

# Grab secret credentials from gcp bucket
- name: gcr.io/cloud-builders/gcloud
entrypoint: 'bash'
Expand Down Expand Up @@ -37,4 +49,4 @@ images:
options:
machineType: 'N1_HIGHCPU_8'

timeout: 1200s
timeout: 1500s
4 changes: 2 additions & 2 deletions deploy/skaffold/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This base image has to be updated manually after running `make build_deps`
FROM gcr.io/k8s-skaffold/build_deps:a2f5d630a6cf9f3f7cb777f4e6f7cf46045d4846 as build
# This base image is built using docker from cache every single time as build step.
FROM gcr.io/k8s-skaffold/build_deps:latest as build
WORKDIR /skaffold

FROM build as builder
Expand Down
22 changes: 11 additions & 11 deletions deploy/skaffold/Dockerfile.deps
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ARG ARCH
ENV KUBECTL_VERSION v1.20.10
ENV KUBECTL_URL https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl
# SHAs at gs://kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/
COPY digests/kubectl.${ARCH}.sha512 .
COPY deploy/skaffold/digests/kubectl.${ARCH}.sha512 .
RUN wget -O kubectl "${KUBECTL_URL}" && sha512sum -c kubectl.${ARCH}.sha512
RUN chmod +x kubectl

Expand All @@ -32,7 +32,7 @@ ARG ARCH
RUN echo arch=$ARCH
ENV HELM_VERSION v3.7.1
ENV HELM_URL https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz
COPY digests/helm.${ARCH}.sha256 .
COPY deploy/skaffold/digests/helm.${ARCH}.sha256 .
RUN wget -O helm.tar.gz "${HELM_URL}" && sha256sum -c helm.${ARCH}.sha256
RUN tar -xvf helm.tar.gz --strip-components 1

Expand All @@ -41,7 +41,7 @@ FROM alpine:3.10 as download-kustomize
ARG ARCH
ENV KUSTOMIZE_VERSION 4.4.0
ENV KUSTOMIZE_URL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_${ARCH}.tar.gz
COPY digests/kustomize.${ARCH}.sha256 .
COPY deploy/skaffold/digests/kustomize.${ARCH}.sha256 .
RUN wget -O kustomize.tar.gz "${KUSTOMIZE_URL}" && sha256sum -c kustomize.${ARCH}.sha256
RUN tar -xvf kustomize.tar.gz

Expand All @@ -50,7 +50,7 @@ FROM alpine:3.10 as download-kpt
ARG ARCH
ENV KPT_VERSION 0.39.3
ENV KPT_URL https://github.com/GoogleContainerTools/kpt/releases/download/v${KPT_VERSION}/kpt_linux_amd64
COPY digests/kpt.${ARCH}.sha256 .
COPY deploy/skaffold/digests/kpt.${ARCH}.sha256 .
RUN wget -O kpt "${KPT_URL}" && sha256sum -c kpt.${ARCH}.sha256
RUN chmod +x kpt

Expand All @@ -59,7 +59,7 @@ FROM alpine:3.10 as download-kompose
ARG ARCH
ENV KOMPOSE_VERSION v1.24.0
ENV KOMPOSE_URL https://github.com/kubernetes/kompose/releases/download/${KOMPOSE_VERSION}/kompose-linux-amd64
COPY digests/kompose.${ARCH}.sha256 .
COPY deploy/skaffold/digests/kompose.${ARCH}.sha256 .
RUN wget -O kompose "${KOMPOSE_URL}" && sha256sum -c kompose.${ARCH}.sha256
RUN chmod +x kompose

Expand All @@ -68,7 +68,7 @@ FROM alpine:3.10 as download-container-structure-test
ARG ARCH
ENV CONTAINER_STRUCTURE_TEST_VERSION v1.10.0
ENV CONTAINER_STRUCTURE_TEST_URL https://storage.googleapis.com/container-structure-test/${CONTAINER_STRUCTURE_TEST_VERSION}/container-structure-test-linux-${ARCH}
COPY digests/container-structure-test.${ARCH}.sha512 .
COPY deploy/skaffold/digests/container-structure-test.${ARCH}.sha512 .
RUN wget -O container-structure-test "${CONTAINER_STRUCTURE_TEST_URL}" && sha512sum -c container-structure-test.${ARCH}.sha512
RUN chmod +x container-structure-test

Expand All @@ -77,7 +77,7 @@ FROM alpine:3.10 as download-kind
ARG ARCH
ENV KIND_VERSION v0.11.1
ENV KIND_URL https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-${ARCH}
COPY digests/kind.${ARCH}.sha512 .
COPY deploy/skaffold/digests/kind.${ARCH}.sha512 .
RUN wget -O kind "${KIND_URL}" && sha512sum -c kind.${ARCH}.sha512
RUN chmod +x kind

Expand All @@ -86,7 +86,7 @@ FROM alpine:3.10 as download-k3d
ARG ARCH
ENV K3D_VERSION v5.0.3
ENV K3D_URL https://github.com/rancher/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
COPY digests/k3d.${ARCH}.sha256 .
COPY deploy/skaffold/digests/k3d.${ARCH}.sha256 .
RUN wget -O k3d "${K3D_URL}" && sha256sum -c k3d.${ARCH}.sha256
RUN chmod +x k3d

Expand All @@ -96,7 +96,7 @@ ARG ARCH
ENV GCLOUD_VERSION 360.0.0
ENV GCLOUD_URL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-GCLOUDARCH.tar.gz
# SHAs listed at https://cloud.google.com/sdk/docs/downloads-versioned-archives
COPY digests/gcloud.${ARCH}.sha256 .
COPY deploy/skaffold/digests/gcloud.${ARCH}.sha256 .
RUN \
GCLOUDARCH=$(case "${ARCH}" in amd64) echo x86_64;; *) echo ${ARCH};; esac); \
wget -O gcloud.tar.gz $(echo "${GCLOUD_URL}" | sed "s/GCLOUDARCH/${GCLOUDARCH}/g") && \
Expand All @@ -108,14 +108,14 @@ FROM alpine:3.10 as download-bazel
ARG ARCH
ENV BAZEL_VERSION 4.2.1
ENV BAZEL_URL https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-BAZELARCH
COPY digests/bazel.${ARCH}.sha256 .
COPY deploy/skaffold/digests/bazel.${ARCH}.sha256 .
RUN \
BAZELARCH=$(case "${ARCH}" in amd64) echo x86_64;; *) echo ${ARCH};; esac); \
wget -O bazel $(echo "${BAZEL_URL}" | sed "s/BAZELARCH/${BAZELARCH}/g") && \
sha256sum -c bazel.${ARCH}.sha256
RUN chmod +x bazel

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4 as runtime_deps
FROM gcr.io/gcp-runtimes/ubuntu_20_0_4 as runtime_deps

RUN apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
Expand Down
29 changes: 0 additions & 29 deletions hack/check-skaffold-builder.sh

This file was deleted.

1 change: 0 additions & 1 deletion hack/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RESET='\033[0m'
echo "Running validation scripts..."
scripts=(
"hack/check-schema-changes.sh"
"hack/check-skaffold-builder.sh"
"hack/check-samples.sh"
"hack/check-docs.sh"
"hack/test-generated-proto.sh"
Expand Down

0 comments on commit 018b13a

Please sign in to comment.