|
1 | 1 | #!/usr/bin/env bash
|
2 | 2 | # This file is part of MinIO DirectPV
|
3 |
| -# Copyright (c) 2023 MinIO, Inc. |
| 3 | +# Copyright (c) 2024 MinIO, Inc. |
4 | 4 | #
|
5 | 5 | # This program is free software: you can redistribute it and/or modify
|
6 | 6 | # it under the terms of the GNU Affero General Public License as published by
|
|
18 | 18 | ME=$(basename "$0"); export ME
|
19 | 19 | cd "$(dirname "$0")" || exit 255
|
20 | 20 |
|
21 |
| -set -o errexit |
22 |
| -set -o nounset |
23 |
| -set -o pipefail |
| 21 | +export GITHUB_PROJECT_NAME=external-health-monitor |
| 22 | +export PROJECT_NAME=csi-external-health-monitor-controller |
| 23 | +export PROJECT_DESCRIPTION="CSI External Health Monitor Controller" |
24 | 24 |
|
25 |
| -declare BUILD_VERSION PODMAN IMG BUILD_DIR |
26 |
| - |
27 |
| -function init() { |
28 |
| - |
29 |
| - if [ "$#" -eq 1 ]; then |
30 |
| - if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then |
31 |
| - cat <<EOF |
| 25 | +if [ "$#" -ne 1 ]; then |
| 26 | + cat <<EOF |
32 | 27 | USAGE:
|
33 |
| - ${ME} [VERSION] |
| 28 | + ${ME} <VERSION> |
34 | 29 | EXAMPLES:
|
35 |
| - # Release with the latest release tag of the upstream |
36 |
| - $ ${ME} |
37 |
| -
|
38 |
| - # Release the image with tag 0.10.0 |
39 |
| - $ ${ME} 0.10.0 |
40 |
| -EOF |
41 |
| - exit 255 |
42 |
| - fi |
43 |
| - fi |
44 |
| - |
45 |
| - if [ $# -eq 0 ]; then |
46 |
| - 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) }') |
47 |
| - else |
48 |
| - BUILD_VERSION="${1/v/}" |
49 |
| - fi |
50 |
| - |
51 |
| - IMG="quay.io/minio/csi-external-health-monitor-controller:v${BUILD_VERSION}" |
52 |
| - |
53 |
| - if which podman >/dev/null 2>&1; then |
54 |
| - PODMAN=podman |
55 |
| - elif which docker >/dev/null 2>&1; then |
56 |
| - PODMAN=docker |
57 |
| - else |
58 |
| - echo "no podman or docker found; please install" |
59 |
| - exit 255 |
60 |
| - fi |
61 |
| - |
62 |
| - if "${PODMAN}" pull --quiet "${IMG}" >/dev/null 2>&1; then |
63 |
| - echo "image ${IMG} is already pushed" |
64 |
| - exit 0 |
65 |
| - fi |
66 |
| - |
67 |
| - BUILD_DIR="$(mktemp -d -p "${PWD}" health-monitor-build.XXXXXXXX)" |
68 |
| -} |
69 |
| - |
70 |
| -function main() { |
71 |
| - curl --silent --location --insecure --fail "https://github.com/kubernetes-csi/external-health-monitor/archive/refs/tags/v${BUILD_VERSION}.tar.gz" | tar -zxf - |
72 |
| - cd "external-health-monitor-${BUILD_VERSION}" || return |
73 |
| - make build |
74 |
| - "${PODMAN}" buildx build --platform linux/amd64 --tag "${IMG}" -f - . <<EOF |
75 |
| -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10 |
76 |
| -LABEL maintainers="[email protected]" |
77 |
| -LABEL description="Rebuild of CSI External Health Monitor Controller for Red Hat Marketplace" |
78 |
| -COPY ./bin/csi-external-health-monitor-controller csi-external-health-monitor-controller |
79 |
| -COPY ./LICENSE /licenses/LICENSE |
80 |
| -ENTRYPOINT ["/csi-external-health-monitor-controller"] |
| 30 | + # Release ${PROJECT_NAME} v0.13.0 |
| 31 | + $ ${ME} v0.13.0 |
81 | 32 | EOF
|
82 |
| - "${PODMAN}" push "${IMG}" |
83 |
| - cd - || return |
84 |
| -} |
| 33 | + exit 255 |
| 34 | +fi |
85 | 35 |
|
86 |
| -init "$@" |
87 |
| -cd "${BUILD_DIR}" || exit 255 |
88 |
| -main |
89 |
| -cd - || exit 255 |
90 |
| -rm -fr "${BUILD_DIR}" |
| 36 | +# shellcheck source=/dev/null |
| 37 | +source release.sh |
| 38 | +release "$1" |
0 commit comments