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

Does not seem to work when running locally with act #116

Open
RafalSkolasinski opened this issue Jun 9, 2022 · 0 comments
Open

Does not seem to work when running locally with act #116

RafalSkolasinski opened this issue Jun 9, 2022 · 0 comments

Comments

@RafalSkolasinski
Copy link

RafalSkolasinski commented Jun 9, 2022

There is a nice tool to run github actions locally: https://github.com/nektos/act

Unfortunately, it seems that it fails on committing index.yaml step.

My workflow

name: Release Charts

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Configure Git
        run: |
          git config user.name "$GITHUB_USER"
          git config user.email "$GITHUB_USER@users.noreply.github.com"

      - name: Install Helm
        uses: azure/setup-helm@v1
        with:
          version: v3.8.1

      - name: Run chart-releaser
        uses: helm/chart-releaser-action@v1.4.0
        env:
          CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        with:
          charts_dir: helm-charts

Run command:

act --secret-file secret-file -j release --env GITHUB_USER=rafalskolasinski

where secret-file contains valid GITHUB_TOKEN.

Logs:

[Release Charts/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4-composite-0.sh] user= workdir=
| Looking up latest tag...
| Discovering changed charts since 'mock-model-0.6.0'...
| Installing chart-releaser on /opt/hostedtoolcache/cr/v1.4.0/x86_64...
| Adding cr directory to PATH...
| Packaging chart 'helm-charts/mock-model'...
| Successfully packaged chart in /home/rskolasinski/work/seldon-models/helm-charts/mock-model and saved it to: .cr-release-packages/mock-model-0.7.0.tgz
| Releasing charts...
| Updating charts repo index...
| ATTENTION: Flag --charts-repo is deprecated. It does not have any effect.
| The index.yaml is read from the 'gh-pages' branch instead.
| Loading index.yaml directly from the charts repository lead to problems as there is a delay between
| pushing to the GitHub pages branch until things appear online.
| The flag will be removed with the next major release.Loading index file from git repository .cr-index/index.yaml
| Preparing worktree (detached HEAD a357179)
| HEAD is now at a357179 Update index.yaml
| Found mock-model-0.7.0.tgz
| Extracting chart metadata from .cr-release-packages/mock-model-0.7.0.tgz
| Calculating Hash for .cr-release-packages/mock-model-0.7.0.tgz
| Updating index .cr-index/index.yaml
| [detached HEAD 8195182] Update index.yaml
|  1 file changed, 11 insertions(+), 1 deletion(-)
| panic: runtime error: index out of range [1] with length 1
| 
| goroutine 1 [running]:
| github.com/helm/chart-releaser/pkg/git.(*Git).GetPushURL(0x191a461, {0x19174e9, 0x1e}, {0xc00003e149, 0x28})
| 	/home/runner/work/chart-releaser/chart-releaser/pkg/git/git.go:80 +0x1df
| github.com/helm/chart-releaser/pkg/releaser.(*Releaser).UpdateIndexFile(0xc000517da8)
| 	/home/runner/work/chart-releaser/chart-releaser/pkg/releaser/releaser.go:216 +0xb9f
| github.com/helm/chart-releaser/cr/cmd.glob..func1(0x2903a80, {0x191598a, 0x7, 0x7})
| 	/home/runner/work/chart-releaser/chart-releaser/cr/cmd/index.go:52 +0x1b9
| github.com/spf13/cobra.(*Command).execute(0x2903a80, {0xc00027cd90, 0x7, 0x7})
| 	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:856 +0x60e
| github.com/spf13/cobra.(*Command).ExecuteC(0x2903f80)
| 	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3bc
| github.com/spf13/cobra.(*Command).Execute(...)
| 	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
| github.com/helm/chart-releaser/cr/cmd.Execute()
| 	/home/runner/work/chart-releaser/chart-releaser/cr/cmd/root.go:35 +0x25
| main.main()
| 	/home/runner/work/chart-releaser/chart-releaser/cr/main.go:20 +0x17
[Release Charts/release]   ❌  Failure - owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")

args=(--owner "$owner" --repo "$repo")
args+=(--charts-dir "${{ inputs.charts_dir }}")

if [[ -n "${{ inputs.version }}" ]]; then
    args+=(--version "${{ inputs.version }}")
fi

if [[ -n "${{ inputs.config }}" ]]; then
    args+=(--config "${{ inputs.config }}")
fi

if [[ -n "${{ inputs.charts_repo_url }}" ]]; then
    args+=(--charts-repo-url "${{ inputs.charts_repo_url }}")
fi

if [[ -z "${{ inputs.install_dir }}" ]]; then
  install="$RUNNER_TOOL_CACHE/cr/${{ inputs.version }}/$(uname -m)"
  echo "$install" >> "$GITHUB_PATH"
  args+=(--install-dir "$install")
else
  echo ${{ inputs.install_dir }} >> "$GITHUB_PATH"
  args+=(--install-dir "${{ inputs.install_dir }}")
fi

if [[ -n "${{ inputs.install_only }}" ]]; then
    args+=(--install-only "${{ inputs.install_only }}")
fi

"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
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

1 participant