helm / chart-releaser

Hosting Helm Charts via GitHub Pages and Releases
Apache License 2.0
673 stars 108 forks source link

.cr-index folder must be manually created #187

Open ralgozino opened 2 years ago

ralgozino commented 2 years ago

Hello!

Maybe I'm doing something wrong here, but I needed to manually create the .cr-index folder for the cr index command to work.

This is what I did:

$ docker run --rm --entrypoint=sh -it -v $PWD:/app quay.io/helmpack/chart-releaser:v1.4.0
/app # cr package chart
Successfully packaged chart in /app/chart and saved it to: .cr-release-packages/gatekeeper-policy-manager-0.2.0.tgz
/app # cr index --owner sighupio --git-repo gatekeeper-policy-manager
Loading index file from git repository .cr-index/index.yaml
Preparing worktree (detached HEAD e1f5fee)
HEAD is now at e1f5fee Clean branch for Helm Chart Repository with GitHub Pages
Found gatekeeper-policy-manager-0.2.0.tgz
Extracting chart metadata from .cr-release-packages/gatekeeper-policy-manager-0.2.0.tgz
Calculating Hash for .cr-release-packages/gatekeeper-policy-manager-0.2.0.tgz
Updating index .cr-index/index.yaml
Error: open .cr-index/index.yaml3862730865: no such file or directory
Usage:
  cr index [flags]

Flags:
  -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 index
  -i, --index-path string              Path to index file (default ".cr-index/index.yaml")
  -o, --owner string                   GitHub username or organization
  -p, --package-path string            Path to directory with chart packages (default ".cr-release-packages")
      --pages-branch string            The GitHub pages branch (default "gh-pages")
      --pages-index-path string        The GitHub pages index path (default "index.yaml")
      --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")
  -t, --token string                   GitHub Auth Token (only needed for private repos)

Global Flags:
      --config string   Config file (default is $HOME/.cr.yaml)

/app # cat .cr-index/index.yaml
cat: can't open '.cr-index/index.yaml': No such file or directory
/app # mkdir .cr-index
/app # cr index --owner sighupio --git-repo gatekeeper-policy-manager
Loading index file from git repository .cr-index/index.yaml
Preparing worktree (detached HEAD e1f5fee)
HEAD is now at e1f5fee Clean branch for Helm Chart Repository with GitHub Pages
Found gatekeeper-policy-manager-0.2.0.tgz
Extracting chart metadata from .cr-release-packages/gatekeeper-policy-manager-0.2.0.tgz
Calculating Hash for .cr-release-packages/gatekeeper-policy-manager-0.2.0.tgz
Updating index .cr-index/index.yaml
/app # cat .cr-index/index.yaml
apiVersion: v1
entries:
  gatekeeper-policy-manager:
[...] # truncated output

EDIT: I got the same behaviour in CI and locally.

Kerwood commented 2 months ago

I know this is an old bug, but I am experiencing the exact same issue with v1.6.1

GitVersion:  v1.6.1
GitCommit:   0102fa30dd78df0d0f8093c4607e6080972ff82d
BuildDate:   2023-10-31T07:28:18Z
GoVersion:   go1.20.10
Compiler:    gc
Platform:    linux/amd64
License:     Apache 2.0