mirror of https://github.com/linkerd/linkerd2.git
61 lines
2.6 KiB
Bash
Executable File
61 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
setValues() {
|
|
sed -i "s/$1/$2/" charts/linkerd2/values.yaml
|
|
sed -i "s/$1/$2/" charts/linkerd2-cni/values.yaml
|
|
sed -i "s/$1/$2/" charts/linkerd2-multicluster/values.yaml
|
|
}
|
|
|
|
showErr() {
|
|
printf "Error on exit:\n Exit code: %d\n Failed command: \"%s\"\n" $? "$BASH_COMMAND"
|
|
setValues "$fullVersion" "linkerdVersionValue"
|
|
}
|
|
|
|
# trap the last failed command
|
|
trap 'showErr' ERR
|
|
|
|
bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
|
|
rootdir=$( cd "$bindir"/.. && pwd )
|
|
|
|
"$bindir"/helm lint "$rootdir"/charts/linkerd2-multicluster
|
|
"$bindir"/helm lint "$rootdir"/charts/linkerd2-multicluster-link
|
|
"$bindir"/helm lint "$rootdir"/charts/partials
|
|
"$bindir"/helm dep up "$rootdir"/charts/linkerd2-cni
|
|
"$bindir"/helm lint "$rootdir"/charts/linkerd2-cni
|
|
"$bindir"/helm dep up "$rootdir"/charts/linkerd2
|
|
"$bindir"/helm dep up "$rootdir"/charts/patch
|
|
"$bindir"/helm lint --set global.identityTrustAnchorsPEM="fake-trust" --set identity.issuer.tls.crtPEM="fake-cert" --set identity.issuer.tls.keyPEM="fake-key" --set identity.issuer.crtExpiry="fake-expiry-date" "$rootdir"/charts/linkerd2
|
|
"$bindir"/helm lint "$rootdir"/charts/linkerd2-cni
|
|
|
|
# `bin/helm-build package` assumes the presence of "$rootdir"/target/helm/index-pre.yaml which is downloaded in the chart_deploy CI job
|
|
if [ "$1" = package ]; then
|
|
# shellcheck source=_tag.sh
|
|
. "$bindir"/_tag.sh
|
|
tag=$(named_tag)
|
|
clean_head || { echo 'There are uncommitted changes'; exit 1; }
|
|
|
|
regex='(edge|stable)-([0-9]+\.[0-9]+\.[0-9]+)'
|
|
if [[ ! "$tag" =~ $regex ]]; then
|
|
echo 'Version tag is malformed'
|
|
exit 1
|
|
fi
|
|
fullVersion=${BASH_REMATCH[0]}
|
|
repo=${BASH_REMATCH[1]}
|
|
version=${BASH_REMATCH[2]}
|
|
|
|
# set version in Values files
|
|
setValues "linkerdVersionValue" "$fullVersion"
|
|
|
|
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/charts/linkerd2
|
|
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/charts/linkerd2-cni
|
|
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/charts/linkerd2-multicluster
|
|
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/charts/linkerd2-multicluster-link
|
|
mv "$rootdir"/target/helm/index-pre.yaml "$rootdir"/target/helm/index-pre-"$version".yaml
|
|
"$bindir"/helm repo index --url "https://helm.linkerd.io/$repo/" --merge "$rootdir"/target/helm/index-pre-"$version".yaml "$rootdir"/target/helm
|
|
|
|
# restore version in Values files
|
|
setValues "$fullVersion" "linkerdVersionValue"
|
|
fi
|