scripts: add missing quotes, and minor linting issues

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2021-07-20 12:06:02 +02:00
parent 0cb656860f
commit dba0ef4eb5
14 changed files with 58 additions and 53 deletions

View File

@@ -22,10 +22,13 @@ set -o errexit
set -o nounset
set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/build-utils.sh
source $(dirname "${BASH_SOURCE[0]}")/init-buildx.sh
: "${PROJECT:=k8s-cri-containerd}"
basedir="$(dirname "${BASH_SOURCE[0]}")"
source "${basedir}/build-utils.sh"
source "${basedir}/init-buildx.sh"
cd "${ROOT}"
# ignore errors if the image already exists
make -C integration/images/volume-copy-up push PROJ="gcr.io/${PROJECT:-k8s-cri-containerd}" || true
make -C integration/images/volume-ownership push PROJ="gcr.io/${PROJECT:-k8s-cri-containerd}" || true
make -C integration/images/volume-copy-up push PROJ="gcr.io/${PROJECT}" || true
make -C integration/images/volume-ownership push PROJ="gcr.io/${PROJECT}" || true

View File

@@ -20,7 +20,7 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
PROJECT=${PROJECT:-"k8s-cri-containerd"}
# GOOGLE_APPLICATION_CREDENTIALS is the path of service account file.
if [ -z ${GOOGLE_APPLICATION_CREDENTIALS:-""} ]; then
if [ -z "${GOOGLE_APPLICATION_CREDENTIALS:-""}" ]; then
echo "GOOGLE_APPLICATION_CREDENTIALS is not set"
exit 1
fi
@@ -33,6 +33,6 @@ apt-get update
apt-get install -y libseccomp2 libseccomp-dev
# PULL_REFS is from prow.
if [ ! -z "${PULL_REFS:-""}" ]; then
if [ -n "${PULL_REFS:-""}" ]; then
DEPLOY_DIR=$(echo "${PULL_REFS}" | sha1sum | awk '{print $1}')
fi

View File

@@ -22,7 +22,7 @@ set -o errexit
set -o nounset
set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/build-utils.sh
source "$(dirname "${BASH_SOURCE[0]}")/build-utils.sh"
cd "${ROOT}"
# Make sure output directory is clean.
@@ -35,16 +35,16 @@ BUILDDIR=$(mktemp -d)
cleanup() {
if [[ ${BUILDDIR} == /tmp/* ]]; then
echo "[-] REMOVING ${BUILDDIR}"
rm -rf ${BUILDDIR}
rm -rf "${BUILDDIR}"
fi
}
trap cleanup EXIT
set -x
latest=$(readlink ./releases/cri-cni-containerd.tar.gz)
tarball=$(echo ${latest} | sed -e 's/cri-containerd-cni/containerd-cni/g' | sed -e 's/-linux-amd64/.linux-amd64/g')
cp releases/${latest} ${BUILDDIR}/${tarball}
cp releases/${latest}.sha256sum ${BUILDDIR}/${tarball}.sha256
tarball=$(echo "${latest}" | sed -e 's/cri-containerd-cni/containerd-cni/g' | sed -e 's/-linux-amd64/.linux-amd64/g')
cp "releases/${latest}" "${BUILDDIR}/${tarball}"
cp "releases/${latest}.sha256sum" "${BUILDDIR}/${tarball}.sha256"
# Push test tarball to Google cloud storage.
VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always)
@@ -55,4 +55,4 @@ else
DEPLOY_DIR="containerd/${DEPLOY_DIR}"
fi
PUSH_VERSION=true DEPLOY_DIR=${DEPLOY_DIR} TARBALL=${tarball} VERSION=${VERSION#v} BUILD_DIR=${BUILDDIR} ${ROOT}/test/push.sh
PUSH_VERSION=true DEPLOY_DIR=${DEPLOY_DIR} TARBALL=${tarball} VERSION=${VERSION#v} BUILD_DIR=${BUILDDIR} "${ROOT}/test/push.sh"

View File

@@ -74,7 +74,7 @@ fi
# Ensure qemu is in binfmt_misc
# NOTE: Please always pin this to a digest for predictability/auditability
# Last updated: 08/21/2020
if [ "$(uname)" == 'Linux' ]; then
if [ "$(uname)" = 'Linux' ]; then
docker run --rm --privileged multiarch/qemu-user-static@sha256:c772ee1965aa0be9915ee1b018a0dd92ea361b4fa1bcab5bbc033517749b2af4 --reset -p yes
fi

View File

@@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
# DEPLOY_BUCKET is the gcs bucket where the tarball should be stored in.
DEPLOY_BUCKET=${DEPLOY_BUCKET:-"cri-containerd-staging"}
@@ -41,7 +41,7 @@ if [[ ! -e ${release_tar} || ! -e ${release_tar_checksum} ]]; then
fi
if ! gsutil ls "gs://${DEPLOY_BUCKET}" > /dev/null; then
create_ttl_bucket ${DEPLOY_BUCKET}
create_ttl_bucket "${DEPLOY_BUCKET}"
fi
if [ -z "${DEPLOY_DIR}" ]; then
@@ -50,8 +50,8 @@ else
DEPLOY_PATH="${DEPLOY_BUCKET}/${DEPLOY_DIR}"
fi
gsutil cp ${release_tar} "gs://${DEPLOY_PATH}/"
gsutil cp ${release_tar_checksum} "gs://${DEPLOY_PATH}/"
gsutil cp "${release_tar}" "gs://${DEPLOY_PATH}/"
gsutil cp "${release_tar_checksum}" "gs://${DEPLOY_PATH}/"
echo "Release tarball is uploaded to:
https://storage.googleapis.com/${DEPLOY_PATH}/${TARBALL}"
@@ -60,7 +60,7 @@ if ${PUSH_VERSION}; then
echo "VERSION is not set"
exit 1
fi
echo ${VERSION} | gsutil cp - "gs://${DEPLOY_PATH}/${LATEST}"
echo "${VERSION}" | gsutil cp - "gs://${DEPLOY_PATH}/${LATEST}"
echo "Latest version is uploaded to:
https://storage.googleapis.com/${DEPLOY_PATH}/${LATEST}"
fi

View File

@@ -26,11 +26,11 @@ upload_logs_to_gcs() {
local -r dir=$2
local -r result=$3
if ! gsutil ls "gs://${bucket}" > /dev/null; then
create_ttl_bucket ${bucket}
create_ttl_bucket "${bucket}"
fi
local -r upload_log_path=${bucket}/${dir}
gsutil cp -r "${result}" "gs://${upload_log_path}"
echo "Test logs are uploaed to:
echo "Test logs are uploaded to:
http://gcsweb.k8s.io/gcs/${upload_log_path}/"
}
@@ -43,7 +43,7 @@ create_ttl_bucket() {
gsutil mb "gs://${bucket}"
local -r bucket_rule=$(mktemp)
# Set 30 day TTL for logs inside the bucket.
echo '{"rule": [{"action": {"type": "Delete"},"condition": {"age": 30}}]}' > ${bucket_rule}
echo '{"rule": [{"action": {"type": "Delete"},"condition": {"age": 30}}]}' > "${bucket_rule}"
gsutil lifecycle set "${bucket_rule}" "gs://${bucket}"
rm "${bucket_rule}"