helm / chart-testing-action

A GitHub Action to lint and test Helm charts
https://github.com/helm/chart-testing
Apache License 2.0
251 stars 71 forks source link

v2.5.0 is giving an error of `targetBranch main does not exist` #133

Closed jessebot closed 1 year ago

jessebot commented 1 year ago

After #132 was fixed (which it was for me), I seem to be seeing the following error with my job:

Run changed=$(ct list-changed --target-branch main)
  changed=$(ct list-changed --target-branch main)
  if [[ -n "$changed" ]]; then
    echo "changed=true" >> "$GITHUB_OUTPUT"
  fi
  shell: /usr/bin/bash -e {0}
  env:
    CT_CONFIG_DIR: /opt/hostedtoolcache/ct/3.9.0/amd64/etc
    VIRTUAL_ENV: /opt/hostedtoolcache/ct/3.9.0/amd64/venv
Error: targetBranch 'main' does not exist
Error: Process completed with exit code 1.
Here is my full workflow file ```yaml name: Lint and Test Chart on: pull_request: paths: - 'charts/matrix/**' permissions: contents: read jobs: lint: name: Lint runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: "0" - name: Install Helm uses: azure/setup-helm@v3.5 - name: Add dependency chart repos run: | helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add coturn https://jessebot.github.io/coturn-chart - name: Set up chart-testing uses: helm/chart-testing-action@v2.5.0 - name: Run chart-testing (list-changed) id: list-changed run: | changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then echo "changed=true" >> "$GITHUB_OUTPUT" fi - name: Run chart-testing (lint) id: lint if: steps.list-changed.outputs.changed == 'true' run: ct lint --target-branch ${{ github.event.repository.default_branch }} ```

In my own repos, I have moved forward, so this probably won't affect me personally for another week or two, but if I understand correctly, this is also affecting others.

Previous comments pertaining to this issue just for record: https://github.com/helm/chart-testing-action/issues/132#issuecomment-1786998688 https://github.com/helm/chart-testing-action/issues/132#issuecomment-1787140055

Eusebiotrigo commented 1 year ago

Happening the same over here.

Seems to be related to https://github.com/helm/chart-testing/issues/577 and https://github.com/helm/chart-testing/pull/601

I thought I was getting mad about this output.

cpanato commented 1 year ago

@jessebot i will try to figure out what is going on today, but be kind i do that in my free time

tboerger commented 1 year ago

You are doing a great job @cpanato, thanks for your effort! ;)

eyenx commented 1 year ago

Thanks for your effort @cpanato !

jessebot commented 1 year ago

@jessebot i will try to figure out what is going on today, but be kind i do that in my free time

Thanks for your hard work, friend! Updated my language, sorry for my tone :blue_heart:

stevehipwell commented 1 year ago

I suspect that this issue might be caused by https://github.com/helm/chart-testing/pull/511; I'm just running a test to revert the ct binary back to v3.8.0 to see if that fixes the issue.

stevehipwell commented 1 year ago

I can confirm that setting version: v3.8.0 in the with block fixes the error by reverting the ct version.

patrick-stephens commented 1 year ago

thanks @stevehipwell for being everywhere I need you :) I can confirm this is working for us now as well:

      - name: Set up chart-testing
        uses: helm/chart-testing-action@v2.5.0
        with:
          version: v3.8.0
cpanato commented 1 year ago

ack, this https://github.com/helm/chart-testing/pull/601 should fix the issue, already tested the main branch here https://github.com/cpanato/testing-ci-providers/actions/runs/6707913084/job/18227518159?pr=1839 and seems to work again

running a v3.10.0 release and will update the action soon

cpanato commented 1 year ago

ok this https://github.com/helm/chart-testing/releases/tag/v3.10.0 and the chart-testing-action release https://github.com/helm/chart-testing-action/releases/tag/v2.6.0 should fix this issue

a test run here: https://github.com/cpanato/testing-ci-providers/actions/runs/6708194049/job/18228414875?pr=1839

srinath92 commented 5 months ago

Hello,

I'm still seeing the problem and the error says origin/main doesn't exist.

image

Below is the config that I've. Any ideas on what I'm missing please?

workflow.yaml:

image

ct.yaml

image
LazyKeru commented 2 months ago

@srinath92 Can you show how you checkout the git repo ? I had the same issue, however I just forgot to set the git checkout with the option fetch-depth: 0. Now everything is working as normal

sonnysideup commented 4 weeks ago

chart-testing-action: v2.6.1 ct: v3.10.1

I can verify that omitting fetch-depth: 0 from the checkout action will result in this error. Adding that argument resolves the issue for me.

cpanato commented 4 weeks ago

you need the fetch-depth: 0