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

Failed to push charts with index when multiple charts are being updated #3

Open
tomhuang12 opened this issue Nov 5, 2021 · 1 comment

Comments

@tomhuang12
Copy link

Describe the bug
YACR fails to upload charts tarball to gh-pages branch when multiple charts are being released due to push conflict. I think it is due to pushing to remote for every package and when second package is being pushed, remote is already ahead of local work dir. https://github.com/stecky/yet-another-chart-releaser/blob/e599f1d5dbd5364830b7232454b12e98aba44797/pkg/releaser/releaser.go#L345-L367

To Reproduce
Steps to reproduce the behavior:
Action configuration:

      - name: Run chart-releaser
        uses: stecky/yet-another-chart-releaser-action@v1
        with:
          charts_dir: charts
          charts_repo_url: xxx
          packages_with_index: true
        env:
          YACR_TOKEN: "${{ secrets.TOKEN }}"

Have charts/chart1 and charts/chart2 both updated.
See error in actions tab

Expected behavior
All packages that are being released should be pushed without any issues.

Logs

Run stecky/yet-another-chart-releaser-action@v1
Run owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
Looking up latest tag...
Discovering changed charts since 'xxx'...
Installing yacr v0.4.4...
Adding yacr directory to PATH...
Packaging chart 'xxx'...
Successfully packaged chart in /home/runner/work/xxx and saved it to: .yacr-release-packages/xxx.tgz
Packaging chart 'xxx'...
Successfully packaged chart in /home/runner/work/xxx and saved it to: .yacr-release-packages/xxx.tgz
Packaging chart 'xxx'...
Successfully packaged chart in /home/runner/work/xxx and saved it to: .yacr-release-packages/xxx.tgz
Releasing charts...
Preparing worktree (detached HEAD a5e0099)
HEAD is now at a5e0099 Update index.yaml
[detached HEAD 98bff8b] Publishing chart package for xxx
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 xxx.tgz
Pushing to branch "gh-pages"
To https://github.com/xxx
   a5e0099..98bff8b  HEAD -> gh-pages
Executing command git [push ***github.com/xxx HEAD:refs/heads/gh-pages]Preparing worktree (detached HEAD a5e0099)
HEAD is now at a5e0099 Update index.yaml
[detached HEAD 9ca2ae8] Publishing chart package for xxx
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 xxx.tgz
Pushing to branch "gh-pages"
To https://github.com/xxx
 ! [rejected]        HEAD -> gh-pages (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxx'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: exit status 1
Usage:
  yet-another-chart-releaser upload [flags]

Flags:
  -c, --commit string                  Target commit for release
  -b, --git-base-url string            GitHub Base URL (only needed for private GitHub) (default "https://api.github.com/")
  -r, --git-repo string                GitHub repository
  -u, --git-upload-url string          GitHub Upload URL (only needed for private GitHub) (default "https://uploads.github.com/")
  -h, --help                           help for upload
  -o, --owner string                   GitHub username or organization
  -p, --package-path string            Path to directory with chart packages (default ".yacr-release-packages")
      --packages-with-index            Save a copy of the package files to the GitHub Pages branch
      --pages-branch string            The GitHub pages branch (default "gh-pages")
      --pr                             Create a pull request for index.yaml against the GitHub Pages branch (must not be set if --push is set)
      --push                           Push index.yaml to the GitHub Pages branch (must not be set if --pr is set)
      --release-name-template string   Go template for computing release names, using chart metadata (default "{{ .Name }}-{{ .Version }}")
      --remote string                  The Git remote used when creating a local worktree for the GitHub Pages branch (default "origin")
      --skip-existing                  Skip upload if release exists
  -t, --token string                   GitHub Auth Token

Global Flags:
      --config string   config file (default is $HOME/.yet-another-chart-releaser.yaml)

Error: exit status 1
Executing command git [push ***github.com/xxx HEAD:refs/heads/gh-pages]
Error: Process completed with exit code 1.
@annabarnes1138
Copy link
Owner

Unfortunately I don't have the time right now to fix this. If you want to submit a pull request I am happy to merge it. I would also be open to transferring the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants