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

Don't remove existing version from kumahq/charts index #13252

Open
jijiechen opened this issue Mar 28, 2025 · 5 comments
Open

Don't remove existing version from kumahq/charts index #13252

jijiechen opened this issue Mar 28, 2025 · 5 comments
Labels
area/ci-cd kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it

Comments

@jijiechen
Copy link
Member

Kuma Version

2.8.8

Describe the bug

Our current GitHub Actions CI sometimes removes existing versions from the charts repo when publishing a new helm chart version.

Problematic CI run:

Commits that removes an existing chart vesion:

In the example above, version 2.10.1 was removed when we ran the CI for publishing the helm chart version 2.8.8`

To Reproduce

No response

Expected behavior

No response

Additional context (optional)

No response

@jijiechen jijiechen added kind/bug A bug triage/pending This issue will be looked at on the next triage meeting labels Mar 28, 2025
@lukidzi
Copy link
Contributor

lukidzi commented Mar 31, 2025

Triage: we should check this since helm/package/git? might be doing git push -f. When you have 2 runs simultaneously, it might override the previous one. We should avoid force push.

@lukidzi lukidzi added area/ci-cd triage/accepted The issue was reviewed and is complete enough to start working on it and removed triage/pending This issue will be looked at on the next triage meeting labels Mar 31, 2025
@lahabana
Copy link
Contributor

odd: seems like we're doing a regular git push

function release {
if [ -z "${GH_TOKEN}" ] || [ -z "${GH_USER}" ] || [ -z "${GH_EMAIL}" ]; then
msg_err "GH_TOKEN, GH_USER and GH_EMAIL required"
fi
if [ -n "${GITHUB_APP}" ]; then
[ -z "$GH_REPO_URL" ] && GH_REPO_URL="https://x-access-token:${GH_TOKEN}@github.com/${GH_OWNER}/${GH_REPO}.git"
else
[ -z "$GH_REPO_URL" ] && GH_REPO_URL="https://${GH_TOKEN}@github.com/${GH_OWNER}/${GH_REPO}.git"
fi
git clone --single-branch --branch "${GH_PAGES_BRANCH}" "$GH_REPO_URL"
# First upload the packaged charts to the release
cr upload \
--owner "${GH_OWNER}" \
--git-repo "${GH_REPO}" \
--token "${GH_TOKEN}" \
--package-path "${CHARTS_PACKAGE_PATH}"
# Then build and upload the index file to github pages
cr index \
--owner "${GH_OWNER}" \
--git-repo "${GH_REPO}" \
--charts-repo "${CHARTS_REPO_URL}" \
--package-path "${CHARTS_PACKAGE_PATH}" \
--index-path "${GH_REPO}/${CHARTS_INDEX_FILE}"
pushd ${GH_REPO}
git config user.name "${GH_USER}"
git config user.email "${GH_EMAIL}"
git add "${CHARTS_INDEX_FILE}"
git commit -m "ci(helm): publish charts"
git push
popd
rm -rf ${GH_REPO}
}

@lahabana
Copy link
Contributor

Maybe we should close after upload as upload can be long.

@lahabana
Copy link
Contributor

First run:

PATH=/home/runner/work/kuma/kuma/.ci_tools/bin:$PATH ./tools/releases/helm.sh  --release
Cloning into 'charts'...
Using existing index at charts/index.yaml
Found kuma-2.10.1.tgz
Extracting chart metadata from .cr-release-packages/kuma-2.10.1.tgz
Calculating Hash for .cr-release-packages/kuma-2.10.1.tgz
Updating index charts/index.yaml
~/work/kuma/kuma/charts ~/work/kuma/kuma
[gh-pages e8e4264] ci(helm): publish charts
 1 file changed, 26 insertions(+), 1 deletion(-)
To https://github.com/kumahq/charts.git
   a3da9c7..e8e4264  gh-pages -> gh-pages

2nd run:

PATH=/home/runner/work/kuma/kuma/.ci_tools/bin:$PATH ./tools/releases/helm.sh  --release
Cloning into 'charts'...
Using existing index at charts/index.yaml
Found kuma-2.8.8.tgz
Extracting chart metadata from .cr-release-packages/kuma-2.8.8.tgz
Calculating Hash for .cr-release-packages/kuma-2.8.8.tgz
Updating index charts/index.yaml
~/work/kuma/kuma/charts ~/work/kuma/kuma
[gh-pages a9f2d28] ci(helm): publish charts
 1 file changed, 26 insertions(+), 26 deletions(-)
To https://github.com/kumahq/charts.git
   e8e4264..a9f2d28  gh-pages -> gh-pages
~/work/kuma/kuma

If you look the 2nd commit is based on the commit of the 1st run so it's not a race to commit but more a mix when computing the index.

@lahabana
Copy link
Contributor

cr index might cache in some ways or something like this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci-cd kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

No branches or pull requests

3 participants