Skip to content

Commit

Permalink
Add csi-external-health-monitor-controller sidecar build (#940)
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <[email protected]>
Co-authored-by: Praveen raj Mani <[email protected]>
  • Loading branch information
balamurugana and Praveenrajmani authored Sep 11, 2024
1 parent c16fb69 commit 2edc6b0
Showing 1 changed file with 14 additions and 66 deletions.
80 changes: 14 additions & 66 deletions sidecars/release-csi-external-health-monitor-controller.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# This file is part of MinIO DirectPV
# Copyright (c) 2023 MinIO, Inc.
# 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
Expand All @@ -18,73 +18,21 @@
ME=$(basename "$0"); export ME
cd "$(dirname "$0")" || exit 255

set -o errexit
set -o nounset
set -o pipefail
export GITHUB_PROJECT_NAME=external-health-monitor
export PROJECT_NAME=csi-external-health-monitor-controller
export PROJECT_DESCRIPTION="CSI External Health Monitor Controller"

declare BUILD_VERSION PODMAN IMG BUILD_DIR

function init() {

if [ "$#" -eq 1 ]; then
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
cat <<EOF
if [ "$#" -ne 1 ]; then
cat <<EOF
USAGE:
${ME} [VERSION]
${ME} <VERSION>
EXAMPLES:
# Release with the latest release tag of the upstream
$ ${ME}
# Release the image with tag 0.10.0
$ ${ME} 0.10.0
EOF
exit 255
fi
fi

if [ $# -eq 0 ]; then
BUILD_VERSION=$(curl -sfL https://api.github.com/repos/kubernetes-csi/external-health-monitor/releases/latest | awk '/tag_name/ { print substr($2, 3, length($2)-4) }')
else
BUILD_VERSION="${1/v/}"
fi

IMG="quay.io/minio/csi-external-health-monitor-controller:v${BUILD_VERSION}"

if which podman >/dev/null 2>&1; then
PODMAN=podman
elif which docker >/dev/null 2>&1; then
PODMAN=docker
else
echo "no podman or docker found; please install"
exit 255
fi

if "${PODMAN}" pull --quiet "${IMG}" >/dev/null 2>&1; then
echo "image ${IMG} is already pushed"
exit 0
fi

BUILD_DIR="$(mktemp -d -p "${PWD}" health-monitor-build.XXXXXXXX)"
}

function main() {
curl --silent --location --insecure --fail "https://github.com/kubernetes-csi/external-health-monitor/archive/refs/tags/v${BUILD_VERSION}.tar.gz" | tar -zxf -
cd "external-health-monitor-${BUILD_VERSION}" || return
make build
"${PODMAN}" buildx build --platform linux/amd64 --tag "${IMG}" -f - . <<EOF
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10
LABEL maintainers="[email protected]"
LABEL description="Rebuild of CSI External Health Monitor Controller for Red Hat Marketplace"
COPY ./bin/csi-external-health-monitor-controller csi-external-health-monitor-controller
COPY ./LICENSE /licenses/LICENSE
ENTRYPOINT ["/csi-external-health-monitor-controller"]
# Release ${PROJECT_NAME} v0.13.0
$ ${ME} v0.13.0
EOF
"${PODMAN}" push "${IMG}"
cd - || return
}
exit 255
fi

init "$@"
cd "${BUILD_DIR}" || exit 255
main
cd - || exit 255
rm -fr "${BUILD_DIR}"
# shellcheck source=/dev/null
source release.sh
release "$1"

0 comments on commit 2edc6b0

Please sign in to comment.