diff --git a/release-csi-external-health-monitor-controller.sh b/sidecars/release-csi-external-health-monitor-controller.sh similarity index 100% rename from release-csi-external-health-monitor-controller.sh rename to sidecars/release-csi-external-health-monitor-controller.sh diff --git a/sidecars/release-csi-provisioner.sh b/sidecars/release-csi-provisioner.sh new file mode 100755 index 00000000..0f233153 --- /dev/null +++ b/sidecars/release-csi-provisioner.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# This file is part of MinIO DirectPV +# Copyright (c) 2024 MinIO, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +ME=$(basename "$0"); export ME +cd "$(dirname "$0")" || exit 255 + +export GITHUB_PROJECT_NAME=external-provisioner +export PROJECT_NAME=csi-provisioner +export PROJECT_DESCRIPTION="CSI External Provisioner" + +if [ "$#" -ne 1 ]; then + cat < +EXAMPLES: + # Release ${PROJECT_NAME} v5.0.2 + $ ${ME} v5.0.2 +EOF + exit 255 +fi + +# shellcheck source=/dev/null +source release.sh +release "$1" diff --git a/sidecars/release-csi-resizer.sh b/sidecars/release-csi-resizer.sh new file mode 100755 index 00000000..45a75dde --- /dev/null +++ b/sidecars/release-csi-resizer.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# This file is part of MinIO DirectPV +# Copyright (c) 2024 MinIO, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +ME=$(basename "$0"); export ME +cd "$(dirname "$0")" || exit 255 + +export GITHUB_PROJECT_NAME=external-resizer +export PROJECT_NAME=csi-resizer +export PROJECT_DESCRIPTION="CSI External Resizer" + +if [ "$#" -ne 1 ]; then + cat < +EXAMPLES: + # Release ${PROJECT_NAME} v1.22.0 + $ ${ME} v1.22.0 +EOF + exit 255 +fi + +# shellcheck source=/dev/null +source release.sh +release "$1" diff --git a/sidecars/release-livenessprobe.sh b/sidecars/release-livenessprobe.sh new file mode 100755 index 00000000..741ebbc4 --- /dev/null +++ b/sidecars/release-livenessprobe.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# This file is part of MinIO DirectPV +# Copyright (c) 2024 MinIO, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +ME=$(basename "$0"); export ME +cd "$(dirname "$0")" || exit 255 + +export GITHUB_PROJECT_NAME=livenessprobe +export PROJECT_NAME=livenessprobe +export PROJECT_DESCRIPTION="CSI Drive Liveness Probe" + +if [ "$#" -ne 1 ]; then + cat < +EXAMPLES: + # Release ${PROJECT_NAME} v2.14.0 + $ ${ME} v2.14.0 +EOF + exit 255 +fi + +# shellcheck source=/dev/null +source release.sh +release "$1" diff --git a/sidecars/release-node-driver-registrar.sh b/sidecars/release-node-driver-registrar.sh new file mode 100755 index 00000000..78da96c3 --- /dev/null +++ b/sidecars/release-node-driver-registrar.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# This file is part of MinIO DirectPV +# Copyright (c) 2024 MinIO, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +ME=$(basename "$0"); export ME +cd "$(dirname "$0")" || exit 255 + +export GITHUB_PROJECT_NAME=node-driver-registrar +export PROJECT_NAME=csi-node-driver-registrar +export PROJECT_DESCRIPTION="CSI Node Driver Registrar" + +if [ "$#" -ne 1 ]; then + cat < +EXAMPLES: + # Release ${PROJECT_NAME} v2.12.0 + $ ${ME} v2.12.0 +EOF + exit 255 +fi + +# shellcheck source=/dev/null +source release.sh +release "$1" diff --git a/sidecars/release.sh b/sidecars/release.sh new file mode 100644 index 00000000..6696fa65 --- /dev/null +++ b/sidecars/release.sh @@ -0,0 +1,190 @@ +#!/usr/bin/env bash +# This file is part of MinIO DirectPV +# Copyright (c) 2024 MinIO, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +function generate_dockerfile() { + cat >Dockerfile.minio <.goreleaser.yml < +function release() { + if [ -z "${GITHUB_PROJECT_NAME}" ]; then + echo "GITHUB_PROJECT_NAME environment variable must be set" + exit 255 + fi + + if [ -z "${PROJECT_NAME}" ]; then + echo "PROJECT_NAME environment variable must be set" + exit 255 + fi + + if [ -z "${PROJECT_DESCRIPTION}" ]; then + echo "PROJECT_DESCRIPTION environment variable must be set" + exit 255 + fi + + if [ "$#" -ne 1 ]; then + echo "VERSION tag must be passed" + exit 255 + fi + + set -o errexit + set -o nounset + set -o pipefail + + tag="$1" + if ! curl -sfL "https://api.github.com/repos/kubernetes-csi/${GITHUB_PROJECT_NAME}/releases" | jq -r ".[].tag_name | select(. == \"${tag}\")" | grep -q .; then + echo "ERROR: build tag ${tag} not found in https://github.com/kubernetes-csi/${GITHUB_PROJECT_NAME}.git" + exit 1 + fi + + last_tag=$(curl -sfL "https://quay.io/api/v1/repository/minio/${PROJECT_NAME}" | jq -r ".tags | keys_unsorted[] | select(startswith(\"${tag}-\"))" | sort --reverse --version-sort | head -n1) + if [ -z "${last_tag}" ]; then + prev_tag=$(curl -sfL "https://quay.io/api/v1/repository/minio/${PROJECT_NAME}" | jq -r '.tags | keys_unsorted[]' | sort --reverse --version-sort | head -n1) + if [ "${tag}" == "${prev_tag}" ]; then + curr_tag="${tag}-1" + else + curr_tag="${tag}-0" + fi + else + prev_tag="${last_tag}" + build=${last_tag/"$tag"-/} + (( build = build + 1 )) + curr_tag="${tag}-${build}" + fi + + mkdir -p "${GOPATH}/src/github.com/kubernetes-csi" + cd "${GOPATH}/src/github.com/kubernetes-csi" + git clone "https://github.com/kubernetes-csi/${GITHUB_PROJECT_NAME}.git" + cd "${GITHUB_PROJECT_NAME}" + git checkout -b "tag-${tag}" "${tag}" + git tag "${curr_tag}" "${tag}" + + generate_dockerfile + generate_goreleaser_yaml + + export GORELEASER_CURRENT_TAG="${curr_tag}" + export GORELEASER_PREVIOUS_TAG="${prev_tag}" + if [ -z "${DRY_RUN}" ]; then + goreleaser release --snapshot --clean + else + goreleaser release + fi +}