feat: use oci
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2023-05-17 23:26:29 +03:00
parent 79c4c3ff42
commit 29ec37e678
2 changed files with 6 additions and 19 deletions

View File

@ -1,9 +1,8 @@
FROM alpine/helm:3.11.1 as helm
FROM alpine/helm:3.11.3 as helm
RUN set -ex \
&& apk upgrade \
&& apk add --no-cache bash \
&& helm plugin install https://github.com/chartmuseum/helm-push \
\
&& wget -qO- https://github.com/mikefarah/yq/releases/download/v4.30.8/yq_linux_amd64 -O /usr/local/bin/yq \
&& chmod +x /usr/local/bin/yq \

View File

@ -2,31 +2,19 @@
set -e
# Add current repo
export HELM_REPO_USERNAME="$PLUGIN_USERNAME"
export HELM_REPO_PASSWORD="$PLUGIN_PASSWORD"
REGISTRY=${PLUGIN_REGISTRY:-"https://harbor.grachevko.ru/chartrepo"}
REPO=${PLUGIN_NAME:-${DRONE_REPO_OWNER}}
repo="$REGISTRY"/"$REPO"
helm repo add "$REPO" "$repo"
REGISTRY=${PLUGIN_REGISTRY:-"oci://harbor.grachevko.ru/"}
repo="$REGISTRY/$DRONE_REPO_OWNER/chart/$PLUGIN_NAME"
# Dependencies
eval "$(yq '.dependencies' Chart.yaml | yq 'unique_by(.repository)' - | yq '.[] | "helm repo add " + .name + " " + .repository' -)"
helm dependency build
helm dependency update
# Lint
helm lint --strict .
# Bump version
previousVersion=$(helm search repo "$REPO" -o yaml | yq '.[0].version')
bump="patch"
case "${DRONE_COMMIT_MESSAGE:0:8}" in
Major* ) bump="major";;
feat* ) bump="minor";;
esac
new_version=$(semver bump "$bump" "$previousVersion")
yq -i '.version = "'"$new_version"'"' Chart.yaml
helm package --version "${PLUGIN_TAG}"
# Push new version
helm cm-push . "$repo"
helm push ./*.tgz "$repo"