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

chore: keep layers clean during build #1838

Merged
merged 4 commits into from
Sep 20, 2023
Merged
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
2 changes: 1 addition & 1 deletion infra/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ OPA_VERSION := 0.52.0
# Updated by Update Tooling Workflow
GCRANE_VERSION := 0.16.1

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.16.1
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.16.2
DOCKER_TAG_MAJOR_VERSION_DEVELOPER_TOOLS := $(firstword $(subst ., , $(DOCKER_TAG_VERSION_DEVELOPER_TOOLS)))
DOCKER_TAG_MINOR_VERSION_DEVELOPER_TOOLS := $(shell echo "${DOCKER_TAG_VERSION_DEVELOPER_TOOLS}" | awk -F. '{print $$1"."$$2}')

Expand Down
5 changes: 4 additions & 1 deletion infra/build/developer-tools-krm/build/install_asmcli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
set -e
set -u

cd /build
mkdir -p /build/install_asmcli
cd /build/install_asmcli

ASMCLI_VERSION=$1

curl https://storage.googleapis.com/csm-artifacts/asm/asmcli_${ASMCLI_VERSION} > asmcli
install -o 0 -g 0 -m 0755 asmcli /usr/local/bin/asmcli

rm -rf /build/install_asmcli
7 changes: 5 additions & 2 deletions infra/build/developer-tools-krm/build/install_gator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
set -e
set -u

cd /build
mkdir -p /build/install_gator
cd /build/install_gator

GATOR_VERSION=$1

wget -q https://github.com/open-policy-agent/gatekeeper/releases/download/v${GATOR_VERSION}/gator-v${GATOR_VERSION}-linux-amd64.tar.gz
wget -nv "https://github.com/open-policy-agent/gatekeeper/releases/download/v${GATOR_VERSION}/gator-v${GATOR_VERSION}-linux-amd64.tar.gz"
tar -xf gator-v${GATOR_VERSION}-linux-amd64.tar.gz
install -o 0 -g 0 -m 0755 gator /usr/local/bin/gator

rm -rf /build/install_gator
7 changes: 5 additions & 2 deletions infra/build/developer-tools-krm/build/install_kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
set -e
set -u

cd /build
mkdir -p /build/install_kind
cd /build/install_kind

KIND_VERSION=$1

wget -q https://kind.sigs.k8s.io/dl/v${KIND_VERSION}/kind-linux-amd64
wget -nv "https://kind.sigs.k8s.io/dl/v${KIND_VERSION}/kind-linux-amd64"
install -o 0 -g 0 -m 0755 kind-linux-amd64 /usr/local/bin/kind

rm -rf /build/install_kind
7 changes: 5 additions & 2 deletions infra/build/developer-tools-krm/build/install_opa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
set -e
set -u

cd /build
mkdir -p /build/install_opa
cd /build/install_opa

OPA_VERSION=$1

wget -q https://openpolicyagent.org/downloads/v${OPA_VERSION}/opa_linux_amd64_static -O opa
wget -nv "https://openpolicyagent.org/downloads/v${OPA_VERSION}/opa_linux_amd64_static" -O opa
install -o 0 -g 0 -m 0755 opa /usr/local/bin/opa

rm -rf /build/install_opa
26 changes: 13 additions & 13 deletions infra/build/developer-tools/build/install_bats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@
set -e
set -u

mkdir -p /build/install_bats
cd /build/install_bats

BATS_VERSION=$1
BATS_SUPPORT_VERSION=$2
BATS_ASSERT_VERSION=$3
BATS_MOCK_VERSION=$4

cd /build
wget "https://github.com/sstephenson/bats/archive/v${BATS_VERSION}.zip"
unzip "v${BATS_VERSION}.zip"
wget -nv "https://github.com/sstephenson/bats/archive/v${BATS_VERSION}.zip"
unzip -q "v${BATS_VERSION}.zip"
cd "bats-${BATS_VERSION}"
./install.sh /usr/local
rm -rf "v${BATS_VERSION}" "bats-${BATS_VERSION}"

wget "https://github.com/ztombol/bats-support/archive/v${BATS_SUPPORT_VERSION}.zip"
unzip "v${BATS_SUPPORT_VERSION}.zip"
wget -nv "https://github.com/ztombol/bats-support/archive/v${BATS_SUPPORT_VERSION}.zip"
unzip -q "v${BATS_SUPPORT_VERSION}.zip"
cp -r "bats-support-${BATS_SUPPORT_VERSION}" /usr/local/bats-support
rm -rf "v${BATS_SUPPORT_VERSION}.zip" "bats-support-${BATS_SUPPORT_VERSION}"

wget "https://github.com/jasonkarns/bats-assert-1/archive/v${BATS_ASSERT_VERSION}.zip"
unzip "v${BATS_ASSERT_VERSION}.zip"
wget -nv "https://github.com/jasonkarns/bats-assert-1/archive/v${BATS_ASSERT_VERSION}.zip"
unzip -q "v${BATS_ASSERT_VERSION}.zip"
cp -r "bats-assert-${BATS_ASSERT_VERSION}" /usr/local/bats-assert
rm -rf "v${BATS_ASSERT_VERSION}.zip" "bats-assert-${BATS_ASSERT_VERSION}"

wget "https://github.com/jasonkarns/bats-mock/archive/v${BATS_MOCK_VERSION}.zip"
unzip "v${BATS_MOCK_VERSION}.zip"
wget -nv "https://github.com/jasonkarns/bats-mock/archive/v${BATS_MOCK_VERSION}.zip"
unzip -q "v${BATS_MOCK_VERSION}.zip"
cp -r "bats-mock-${BATS_MOCK_VERSION}" /usr/local/bats-mock
rm -rf "v${BATS_MOCK_VERSION}.zip" "bats-mock-${BATS_MOCK_VERSION}"

rm -rf /build/install_bats
11 changes: 7 additions & 4 deletions infra/build/developer-tools/build/install_cft_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
set -e
set -u

CFT_CLI_VERSION=$1
mkdir -p /build/install_cft_cli
cd /build/install_cft_cli

cd /build
CFT_CLI_VERSION=$1

if ! wget "https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/releases/download/cli%2Fv${CFT_CLI_VERSION}/cft-linux-amd64"; then
wget "https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/releases/download/v${CFT_CLI_VERSION}/cft-linux-amd64"
if ! wget -nv "https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/releases/download/cli%2Fv${CFT_CLI_VERSION}/cft-linux-amd64"; then
wget -nv "https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/releases/download/v${CFT_CLI_VERSION}/cft-linux-amd64"
fi

install -o 0 -g 0 -m 0755 cft-linux-amd64 /usr/local/bin/cft

rm -rf /build/install_cft_cli
2 changes: 1 addition & 1 deletion infra/build/developer-tools/build/install_cloud_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CLOUD_SDK_VERSION=$1

cd /build

wget "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz"
wget -nv "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz"
tar -C /usr/local -xzf "google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz"
rm "google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
set -e
set -u

GSUITE_PROVIDER_VERSION=$1
mkdir -p /build/install_gsuite_terraform_provider
cd /build/install_gsuite_terraform_provider

cd /build
GSUITE_PROVIDER_VERSION=$1

wget "https://github.com/DeviaVir/terraform-provider-gsuite/releases/download/v${GSUITE_PROVIDER_VERSION}/terraform-provider-gsuite_${GSUITE_PROVIDER_VERSION}_linux_amd64.tgz"
tar xzf "terraform-provider-gsuite_${GSUITE_PROVIDER_VERSION}_linux_amd64.tgz"
rm "terraform-provider-gsuite_${GSUITE_PROVIDER_VERSION}_linux_amd64.tgz"
wget -nv "https://github.com/DeviaVir/terraform-provider-gsuite/releases/download/v${GSUITE_PROVIDER_VERSION}/terraform-provider-gsuite_${GSUITE_PROVIDER_VERSION}_linux_amd64.tgz"
tar -xzf "terraform-provider-gsuite_${GSUITE_PROVIDER_VERSION}_linux_amd64.tgz"
install -o 0 -g 0 -m 0755 -d ~/.terraform.d/plugins/
install -o 0 -g 0 -m 0755 "terraform-provider-gsuite_v${GSUITE_PROVIDER_VERSION}" ~/.terraform.d/plugins/

rm -rf /build/install_gsuite_terraform_provider
7 changes: 5 additions & 2 deletions infra/build/developer-tools/build/install_hadolint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
set -e
set -u

cd /build
mkdir -p /build/install_hadolint
cd /build/install_hadolint

wget https://github.com/hadolint/hadolint/releases/download/v1.15.0/hadolint-Linux-x86_64
wget -nv "https://github.com/hadolint/hadolint/releases/download/v1.15.0/hadolint-Linux-x86_64"
install -o 0 -g 0 -m 0755 hadolint-Linux-x86_64 /usr/local/bin/hadolint

rm -rf /build/install_hadolint
12 changes: 7 additions & 5 deletions infra/build/developer-tools/build/install_kpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
set -e
set -u

KPT_VERSION=$1
mkdir -p /build/install_kpt
cd /build/install_kpt

cd /build
KPT_VERSION=$1

wget "https://github.com/GoogleContainerTools/kpt/releases/download/v${KPT_VERSION}/kpt_linux_amd64-${KPT_VERSION}.tar.gz"
tar xzf "kpt_linux_amd64-${KPT_VERSION}.tar.gz"
rm "kpt_linux_amd64-${KPT_VERSION}.tar.gz"
wget -nv "https://github.com/GoogleContainerTools/kpt/releases/download/v${KPT_VERSION}/kpt_linux_amd64-${KPT_VERSION}.tar.gz"
tar -xzf "kpt_linux_amd64-${KPT_VERSION}.tar.gz"
install -o 0 -g 0 -m 0755 kpt /usr/local/bin/

rm -rf /build/install_kpt
7 changes: 5 additions & 2 deletions infra/build/developer-tools/build/install_kubectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
set -e
set -u

cd /build
mkdir -p /build/install_kubectl
cd /build/install_kubectl

KUBECTL_VERSION=$1

wget https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
wget -nv "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
install -o 0 -g 0 -m 0755 kubectl /usr/local/bin/kubectl

rm -rf /build/install_kubectl
9 changes: 6 additions & 3 deletions infra/build/developer-tools/build/install_kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
set -e
set -u

cd /build
mkdir -p /build/install_kustomize
cd /build/install_kustomize

KUSTOMIZE_VERSION=$1

wget -q https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz
tar xzf ./kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz
wget -nv https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz
tar -xzf kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz
install -o 0 -g 0 -m 0755 kustomize /usr/local/bin/kustomize

rm -rf /build/install_kustomize
8 changes: 5 additions & 3 deletions infra/build/developer-tools/build/install_protoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ PROTOC_GEN_GO_VERSION=$2
PROTOC_GEN_GO_GRPC_VERSION=$3
PROTOC_GEN_GO_INJECT_TAG=$4

cd /build
mkdir -p /build/install_protoc
cd /build/install_protoc

curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip"
unzip "protoc-${PROTOC_VERSION}-linux-x86_64.zip" -d $HOME/.local
rm "protoc-${PROTOC_VERSION}-linux-x86_64.zip"
unzip -q "protoc-${PROTOC_VERSION}-linux-x86_64.zip" -d $HOME/.local
chmod 755 $HOME/.local/bin/protoc
cp $HOME/.local/bin/protoc /usr/local/bin/
cp -R $HOME/.local/include/ /usr/local/include/

go install google.golang.org/protobuf/cmd/protoc-gen-go@v${PROTOC_GEN_GO_VERSION}
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${PROTOC_GEN_GO_GRPC_VERSION}
go install github.com/favadi/protoc-go-inject-tag@v${PROTOC_GEN_GO_INJECT_TAG}

rm -rf /build/install_protoc
8 changes: 5 additions & 3 deletions infra/build/developer-tools/build/install_shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
set -e
set -u

cd /build
mkdir -p /build/install_shellcheck
cd /build/install_shellcheck

wget https://github.com/koalaman/shellcheck/releases/download/v0.6.0/shellcheck-v0.6.0.linux.x86_64.tar.xz
wget -nv "https://github.com/koalaman/shellcheck/releases/download/v0.6.0/shellcheck-v0.6.0.linux.x86_64.tar.xz"
tar -xf shellcheck-v0.6.0.linux.x86_64.tar.xz
install -o 0 -g 0 -m 0755 shellcheck-v0.6.0/shellcheck /usr/local/bin/shellcheck
rm -rf shellcheck-v0.6.0 shellcheck-v0.6.0.linux.x86_64.tar.xz

rm -rf /build/install_shellcheck
9 changes: 6 additions & 3 deletions infra/build/developer-tools/build/install_terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
set -e
set -u

cd /build
mkdir -p /build/install_terraform
cd /build/install_terraform

TERRAFORM_VERSION=$1

wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
unzip ./terraform_${TERRAFORM_VERSION}_linux_amd64.zip
wget -nv "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
unzip -q terraform_${TERRAFORM_VERSION}_linux_amd64.zip
install -o 0 -g 0 -m 0755 terraform /usr/local/bin/terraform

rm -rf /build/install_terraform
9 changes: 6 additions & 3 deletions infra/build/developer-tools/build/install_terraform_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
set -e
set -u

cd /build
mkdir -p /build/install_terraform_docs
cd /build/install_terraform_docs

TERRAFORM_DOCS_VERSION=$1

wget -q "https://github.com/segmentio/terraform-docs/releases/download/v${TERRAFORM_DOCS_VERSION}/terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz"
tar xzf ./terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz
wget -nv "https://github.com/segmentio/terraform-docs/releases/download/v${TERRAFORM_DOCS_VERSION}/terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz"
tar -xzf terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz
install -o 0 -g 0 -m 0755 "terraform-docs" /usr/local/bin/terraform-docs

rm -rf /build/install_terraform_docs
7 changes: 5 additions & 2 deletions infra/build/developer-tools/build/install_terragrunt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
set -e
set -u

cd /build
mkdir -p /build/install_terragrunt
cd /build/install_terragrunt

TERRAGRUNT_VERSION=$1

wget -q https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64
wget -nv "https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64"
install -o 0 -g 0 -m 0755 terragrunt_linux_amd64 /usr/local/bin/terragrunt

rm -rf /build/install_terragrunt
11 changes: 7 additions & 4 deletions infra/build/developer-tools/build/install_tflint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
set -e
set -u

TF_LINT_VERSION=$1
mkdir -p /build/install_tflint
cd /build/install_tflint

cd /build
TF_LINT_VERSION=$1

wget "https://github.com/terraform-linters/tflint/releases/download/v${TF_LINT_VERSION}/tflint_linux_amd64.zip"
unzip tflint_linux_amd64.zip
wget -nv "https://github.com/terraform-linters/tflint/releases/download/v${TF_LINT_VERSION}/tflint_linux_amd64.zip"
unzip -q tflint_linux_amd64.zip
install -o 0 -g 0 -m 0755 tflint /usr/local/bin/tflint

rm -rf /build/install_tflint
15 changes: 7 additions & 8 deletions infra/build/developer-tools/build/install_tinkey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
set -e
set -u

cd /build
mkdir -p /build/install_tinkey
cd /build/install_tinkey

TINKEY_VERSION=$1

mkdir ./tinkey
gsutil cp "gs://tinkey/tinkey-${TINKEY_VERSION}.tar.gz" .
tar -xzf "tinkey-${TINKEY_VERSION}.tar.gz"

gsutil cp "gs://tinkey/tinkey-${TINKEY_VERSION}.tar.gz" ./tinkey
tar -xzvf "./tinkey/tinkey-${TINKEY_VERSION}.tar.gz" -C ./tinkey
install -o 0 -g 0 -m 0755 tinkey_deploy.jar /usr/bin/
install -o 0 -g 0 -m 0755 tinkey /usr/bin/

install -o 0 -g 0 -m 0755 ./tinkey/tinkey_deploy.jar /usr/bin/
install -o 0 -g 0 -m 0755 ./tinkey/tinkey /usr/bin/

rm -rf ./tinkey
rm -rf /build/install_tinkey
Loading