Skip to content

Commit

Permalink
Avoid deleting the cilium directory every time
Browse files Browse the repository at this point in the history
Replace the removal with some commands to fetch the latest state from
the origin, stash any local changes and check out the target version.

Signed-off-by: Joe Stringer <[email protected]>
  • Loading branch information
joestringer committed Jul 15, 2024
1 parent e420392 commit 9791665
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions generate_helm_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -ex
shopt -s expand_aliases

DOCKER=${DOCKER:-docker}
ORG=${ORG:-cilium}

cosign() {
"${DOCKER}" run --rm gcr.io/projectsigstore/cosign:v2.2.4 "$@"
Expand Down Expand Up @@ -45,8 +46,16 @@ main() {

CWD=$(git rev-parse --show-toplevel)
chart_dir="${PROJECT}/install/kubernetes"
rm -rf "${PROJECT}"
git clone --depth 1 --branch "$version" "https://github.com/cilium/${PROJECT}.git"
if [ -d "${PROJECT}" ]; then
cd "${PROJECT}"
git stash
remote=$(git remote -v | grep "${ORG}/${PROJECT}" | awk '{print $1;exit}')
git fetch "${remote}"
git checkout "$version"
cd -
else
git clone --depth 1 --branch "$version" "https://github.com/cilium/${PROJECT}.git"
fi
cd "${chart_dir}" || exit

## Cilium generate helm from templates (digest substitution)
Expand Down

0 comments on commit 9791665

Please sign in to comment.