Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add || true to Chart.yaml find command since failures are expected and inconsequential #6237

Merged
merged 3 commits into from
Oct 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 39 additions & 37 deletions buildkite/scripts/helm-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,65 @@

set -eou pipefail

echo "--- Generating change DIFF"

diff=$(
./buildkite/scripts/generate-diff.sh
)
echo "--- Generated change DIFF: ${diff}"

# Identifying modifications to helm charts (based on existence of Chart.yaml at change root)
charts=$(
for val in $diff; do
find $(dirname ${val:-""}) -name 'Chart.yaml';
find $(dirname ${val}) -name 'Chart.yaml' || true; # failures occur when value is undefined due to empty diff
done
)

# filter duplicates
charts=$(echo $charts | xargs -n1 | sort -u | xargs)
dirs=$(dirname $charts | xargs -n1 | sort -u | xargs)
if [ -n "$charts" ]; then
# filter duplicates
charts=$(echo $charts | xargs -n1 | sort -u | xargs)
dirs=$(dirname $charts | xargs -n1 | sort -u | xargs)

if [ -n "${HELM_LINT+x}" ]; then
for dir in $dirs; do
echo "--- Linting: ${dir}"
helm lint $dir
if [ -n "${HELM_LINT+x}" ]; then
for dir in $dirs; do
echo "--- Linting: ${dir}"
helm lint $dir

echo "--- Executing dry-run: ${dir}"
helm install test $dir --dry-run --namespace default
done
fi
echo "--- Executing dry-run: ${dir}"
helm install test $dir --dry-run --namespace default
done
fi

if [ -n "${HELM_RELEASE+x}" ]; then
syncDir="sync_dir"
stageDir="updates"
mkdir -p $stageDir $syncDir
if [ -n "${HELM_RELEASE+x}" ]; then
syncDir="sync_dir"
stageDir="updates"
mkdir -p $stageDir $syncDir

echo "--- Syncing with remote GCS Helm chart repository"
gsutil -m rsync ${CODA_CHART_REPO:-"gs://coda-charts/"} $syncDir
gsutil -m rsync ${CODA_CHART_REPO:-"gs://coda-charts/"} $syncDir

for dir in $dirs; do
echo "--- Preparing chart for Release: ${dir}"
helm package $dir --destination $stageDir
for dir in $dirs; do
echo "--- Preparing chart for Release: ${dir}"
helm package $dir --destination $stageDir

if [ -n "${HELM_EXPERIMENTAL_OCI+x}" ]; then
echo "--- Helm experimental OCI activated - deploying to GCR registry"
helm chart save $(basename $dir)
if [ -n "${HELM_EXPERIMENTAL_OCI+x}" ]; then
echo "--- Helm experimental OCI activated - deploying to GCR registry"
helm chart save $(basename $dir)

echo "--- Configuring Docker auth"
gcloud auth configure-docker
docker login "gcr.io/o1labs-192920/coda-charts/$(basename ${dir})"
gcloud auth configure-docker
docker login "gcr.io/o1labs-192920/coda-charts/$(basename ${dir})"

echo "--- Pushing chart"
helm chart push "gcr.io/o1labs-192920/coda-charts/$(basename ${dir})"
fi
done
helm chart push "gcr.io/o1labs-192920/coda-charts/$(basename ${dir})"
fi
done

cp --force --recursive "${stageDir}" "${syncDir}"
cp --force --recursive "${stageDir}" "${syncDir}"

helm repo index $syncDir
helm repo index $syncDir

if [ -n "${AUTO_DEPLOY+x}" ]; then
echo "--- Deploying/Syncing with remote repository"
gsutil -m rsync $syncDir ${CODA_CHART_REPO:-"gs://coda-charts/"}
if [ -n "${AUTO_DEPLOY+x}" ]; then
echo "--- Deploying/Syncing with remote repository"
gsutil -m rsync $syncDir ${CODA_CHART_REPO:-"gs://coda-charts/"}
fi
fi
else
echo "No Helm chart changes found in DIFF."
fi