-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add script to update lts dependencies
- Loading branch information
1 parent
1138d7f
commit b482f71
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The Skaffold Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -euo pipefail | ||
# NOTE: This scripts expects be run from skaffold root "skaffold/" NOT "skaffold/hack" | ||
# TODO script should likely not write files to where script is done but most likely should write to tmp or out/ | ||
|
||
|
||
ARCH=amd64 | ||
DOCKERFILE_DIR="deploy/skaffold" | ||
DIGESTS_DIR="${DOCKERFILE_DIR}/digests" | ||
|
||
KUBECTL_REPO="kubernetes/kubernetes" | ||
KUBECTL_VERSION=$(curl --silent "https://api.github.com/repos/$KUBECTL_REPO/releases/latest" | jq -r .tag_name) | ||
KUBECTL_URL=https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl | ||
echo "Updating kubectl to version: $KUBECTL_VERSION" | ||
wget -q -O kubectl "${KUBECTL_URL}" | ||
|
||
# take the shasum and put into correct digests/ dir | ||
sha512sum kubectl > ${DIGESTS_DIR}/kubectl.amd64.sha512 | ||
|
||
HELM_REPO="helm/helm" | ||
HELM_VERSION=$(curl --silent "https://api.github.com/repos/$HELM_REPO/releases/latest" | jq -r .tag_name) | ||
echo "Updating helm to version: $HELM_VERSION" | ||
HELM_URL=https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz | ||
wget -q -O helm.tar.gz "${HELM_URL}" | ||
|
||
# upload the binary to skaffold gcs bucket | ||
gsutil -q cp helm.tar.gz gs://skaffold/deps/helm/helm-${HELM_VERSION}-linux-amd64.tar.gz | ||
|
||
# take the shasum and put into correct digests/ dir | ||
sha256sum helm.tar.gz > ${DIGESTS_DIR}/helm.amd64.sha256 | ||
|
||
KUSTOMIZE_REPO="kubernetes-sigs/kustomize" | ||
KUSTOMIZE_VERSION=$(curl --silent "https://api.github.com/repos/$KUSTOMIZE_REPO/releases/latest" | jq -r .tag_name) | ||
KUSTOMIZE_VERSION=${KUSTOMIZE_VERSION#kustomize/v}; #Remove "kustomize/v" prefix | ||
echo "Updating kustomize to version: $KUSTOMIZE_VERSION" | ||
KUSTOMIZE_URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_${ARCH}.tar.gz | ||
wget -q -O kustomize.tar.gz "${KUSTOMIZE_URL}" | ||
|
||
# upload the binary to skaffold gcs bucket | ||
gsutil -q cp kustomize.tar.gz gs://skaffold/deps/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | ||
|
||
# take the shasum and put into correct digests/ dir | ||
sha256sum kustomize.tar.gz > ${DIGESTS_DIR}/kustomize.amd64.sha256 | ||
|
||
KPT_REPO="GoogleContainerTools/kpt" | ||
KPT_VERSION=$(curl --silent "https://api.github.com/repos/GoogleContainerTools/kpt/tags" | jq -r .[0].name) | ||
KPT_VERSION=${KPT_VERSION#v}; #Remove "v" prefix | ||
echo "Updating kpt to version: $KPT_VERSION" | ||
KPT_URL=https://github.com/GoogleContainerTools/kpt/releases/download/v${KPT_VERSION}/kpt_linux_amd64 | ||
wget -q -O kpt "${KPT_URL}" | ||
|
||
# upload the binary to skaffold gcs bucket | ||
gsutil -q cp kpt gs://skaffold/deps/kpt/v${KPT_VERSION}/kpt_linux_amd64 | ||
|
||
# take the shasum and put into correct digests/ dir | ||
sha256sum kpt > ${DIGESTS_DIR}/kpt.amd64.sha256 | ||
|
||
GCLOUD_VERSION=$(gcloud version --format json| jq -r '."Google Cloud SDK"') | ||
echo "Updating gcloud to version: $GCLOUD_VERSION" | ||
GCLOUD_URL=https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz | ||
wget -q -O gcloud.tar.gz $GCLOUD_URL | ||
|
||
# take the shasum and put into correct digests/ dir | ||
sha256sum gcloud.tar.gz > ${DIGESTS_DIR}/gcloud.amd64.sha256 | ||
|
||
|
||
for dockerfile in "Dockerfile.deps" "Dockerfile.deps.lts" "Dockerfile.deps.slim"; do | ||
sed -i "s/ENV KUBECTL_VERSION .*/ENV KUBECTL_VERSION ${KUBECTL_VERSION}/" ${DOCKERFILE_DIR}/${dockerfile} | ||
sed -i "s/ENV HELM_VERSION .*/ENV HELM_VERSION ${HELM_VERSION}/" ${DOCKERFILE_DIR}/${dockerfile} | ||
sed -i "s/ENV KUSTOMIZE_VERSION .*/ENV KUSTOMIZE_VERSION ${KUSTOMIZE_VERSION}/" ${DOCKERFILE_DIR}/${dockerfile} | ||
sed -i "s/ENV KPT_VERSION .*/ENV KPT_VERSION ${KPT_VERSION}/" ${DOCKERFILE_DIR}/${dockerfile} | ||
sed -i "s/ENV GCLOUD_VERSION .*/ENV GCLOUD_VERSION ${GCLOUD_VERSION}/" ${DOCKERFILE_DIR}/${dockerfile} | ||
done | ||
|
||
for artifact in "gcloud.tar.gz" "helm.tar.gz" "kpt" "kubectl" "kustomize.tar.gz"; do | ||
rm ${artifact} | ||
done |