Skip to content

Commit

Permalink
remove CI, release, PR build types (#3056)
Browse files Browse the repository at this point in the history
using shellcheck from koalaman/shellcheck:stable
  • Loading branch information
divyenpatel authored Sep 19, 2024
1 parent 13dd49a commit c683622
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 161 deletions.
2 changes: 1 addition & 1 deletion hack/check-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ shift $((OPTIND-1))
if [ ! "${DO_DOCKER-}" ] && command -v shellcheck >/dev/null 2>&1; then
find . -path ./vendor -prune -o -name "*.*sh" -type f -print0 | xargs -0 shellcheck
else
docker run --rm -t -v "$(pwd)":/build:ro gcr.io/cluster-api-provider-vsphere/extra/shellcheck:v0.7.1
find . -path ./vendor -prune -o -name "*.*sh" -type f -print0 | xargs -0 docker run --rm -v "$PWD:/mnt" koalaman/shellcheck:stable
fi
2 changes: 1 addition & 1 deletion hack/make.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Copyright 2018 The Kubernetes Authors.
#
Expand Down
108 changes: 0 additions & 108 deletions hack/match-release-tag.sh

This file was deleted.

53 changes: 7 additions & 46 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,9 @@ DO_WINDOWS_BUILD=${DO_WINDOWS_BUILD_ENV:-true}
# BASE_REPO is the root path of the image repository
readonly BASE_IMAGE_REPO=us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere

# Release images
readonly CSI_IMAGE_RELEASE=${BASE_IMAGE_REPO}/release/driver
readonly SYNCER_IMAGE_RELEASE=${BASE_IMAGE_REPO}/release/syncer

# PR images
readonly CSI_IMAGE_PR=${BASE_IMAGE_REPO}/pr/driver
readonly SYNCER_IMAGE_PR=${BASE_IMAGE_REPO}/pr/syncer

# CI images
readonly CSI_IMAGE_CI=${BASE_IMAGE_REPO}/ci/driver
readonly SYNCER_IMAGE_CI=${BASE_IMAGE_REPO}/ci/syncer
readonly CSI_IMAGE_CI=${BASE_IMAGE_REPO}/driver
readonly SYNCER_IMAGE_CI=${BASE_IMAGE_REPO}/syncer

PUSH=
LATEST=
Expand Down Expand Up @@ -73,24 +65,13 @@ REGISTRY=
# The manifest command is still experimental as of Docker 18.09.3
export DOCKER_CLI_EXPERIMENTAL=enabled

# If BUILD_RELEASE_TYPE is not set then check to see if this is a PR
# or release build. This may still be overridden below with the "-t" flag.
if [ -z "${BUILD_RELEASE_TYPE}" ]; then
if hack/match-release-tag.sh >/dev/null 2>&1; then
BUILD_RELEASE_TYPE=release
else
BUILD_RELEASE_TYPE=ci
fi
fi

USAGE="
usage: ${0} [FLAGS]
Builds and optionally pushes new images for vSphere CSI driver
Honored environment variables:
GCR_KEY_FILE
GOPROXY
BUILD_RELEASE_TYPE
FLAGS
-h show this help and exit
Expand All @@ -99,8 +80,6 @@ FLAGS
-l tag the images as \"latest\" in addition to their version
when used with -p, both tags will be pushed
-p push the images to the public container registry
-t the build/release type (defaults to: ${BUILD_RELEASE_TYPE})
one of [ci,pr,release]
-r push the image to custom registry, specify the registry to be used
"

Expand Down Expand Up @@ -129,7 +108,7 @@ function build_driver_images_windows() {
docker buildx use vsphere-csi-builder-win || docker buildx create --driver-opt image=moby/buildkit:v0.10.6 --name vsphere-csi-builder-win --platform windows/amd64 --use
echo "building ${CSI_IMAGE_NAME}:${VERSION} for windows"
# some registry do not allow uppercase tags
osv=$(lcase ${OSVERSION})
osv=$(lcase "${OSVERSION}")
tag="${CSI_IMAGE_NAME}-windows-${osv}-${ARCH}:${VERSION}"
docker buildx build \
--platform "windows" \
Expand Down Expand Up @@ -180,24 +159,9 @@ function build_syncer_image_linux() {
}

function build_images() {
case "${BUILD_RELEASE_TYPE}" in
ci)
# A non-PR, non-release build. This is usually a build off of master
CSI_IMAGE_NAME=${CSI_IMAGE_CI}
SYNCER_IMAGE_NAME=${SYNCER_IMAGE_CI}
LATEST="latest"
;;
pr)
# A PR build
CSI_IMAGE_NAME=${CSI_IMAGE_PR}
SYNCER_IMAGE_NAME=${SYNCER_IMAGE_PR}
;;
release)
# On an annotated tag
CSI_IMAGE_NAME=${CSI_IMAGE_RELEASE}
SYNCER_IMAGE_NAME=${SYNCER_IMAGE_RELEASE}
;;
esac
CSI_IMAGE_NAME=${CSI_IMAGE_CI}
SYNCER_IMAGE_NAME=${SYNCER_IMAGE_CI}
LATEST="latest"

# build images for linux platform
build_driver_images_linux
Expand Down Expand Up @@ -289,7 +253,7 @@ function push_syncer_images() {
}

# Start of main script
while getopts ":hk:lptr:" opt; do
while getopts ":hk:lpr:" opt; do
case ${opt} in
h)
error "${USAGE}" && exit 1
Expand All @@ -303,9 +267,6 @@ while getopts ":hk:lptr:" opt; do
p)
PUSH=1
;;
t)
BUILD_RELEASE_TYPE="${OPTARG}"
;;
r)
REGISTRY="${OPTARG}"
;;
Expand Down
2 changes: 1 addition & 1 deletion manifests/vanilla/validatingwebhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ spec:
dnsPolicy: "Default"
containers:
- name: vsphere-webhook
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/ci/syncer:latest
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/syncer:latest
args:
- "--operation-mode=WEBHOOK_SERVER"
- "--fss-name=internal-feature-states.csi.vsphere.vmware.com"
Expand Down
8 changes: 4 additions & 4 deletions manifests/vanilla/vsphere-csi-driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ spec:
- mountPath: /csi
name: socket-dir
- name: vsphere-csi-controller
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/ci/driver:latest
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/driver:latest
args:
- "--fss-name=internal-feature-states.csi.vsphere.vmware.com"
- "--fss-namespace=$(CSI_NAMESPACE)"
Expand Down Expand Up @@ -338,7 +338,7 @@ spec:
- name: socket-dir
mountPath: /csi
- name: vsphere-syncer
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/ci/syncer:latest
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/syncer:latest
args:
- "--leader-election"
- "--leader-election-lease-duration=30s"
Expand Down Expand Up @@ -471,7 +471,7 @@ spec:
- --mode=kubelet-registration-probe
initialDelaySeconds: 3
- name: vsphere-csi-node
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/ci/driver:latest
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/driver:latest
args:
- "--fss-name=internal-feature-states.csi.vsphere.vmware.com"
- "--fss-namespace=$(CSI_NAMESPACE)"
Expand Down Expand Up @@ -616,7 +616,7 @@ spec:
- --mode=kubelet-registration-probe
initialDelaySeconds: 3
- name: vsphere-csi-node
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/ci/driver:latest
image: us-central1-docker.pkg.dev/k8s-staging-images/csi-vsphere/driver:latest
args:
- "--fss-name=internal-feature-states.csi.vsphere.vmware.com"
- "--fss-namespace=$(CSI_NAMESPACE)"
Expand Down

0 comments on commit c683622

Please sign in to comment.