helm / chart-testing-action

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

list-changed command fails without error #69

Closed sundowndev closed 2 years ago

sundowndev commented 3 years ago

I try to set up a basic helm chart repo but I'm stuck with this issue :

image

I also tried running ct list-changed directly but it does not show anything.

my workflow:

name: Lint and Test Charts

on:
  pull_request:
    paths-ignore:
      - 'README.md'
      - 'charts/**/README.md'
      - 'LICENSE'

jobs:
  lint-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0        

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

      - name: Set up chart-testing
        uses: helm/chart-testing-action@v2.0.1

      - name: Run chart-testing (list-changed) # <- stuck here
        id: list-changed
        run: |
          changed=$(ct list-changed)
          if [[ -n "$changed" ]]; then
            echo "::set-output name=changed::true"
          fi

      - name: Run chart-testing (lint)
        id: lint
        if: steps.list-changed.outputs.changed == 'true'
        run: ct lint --config ct.yaml

      - name: Create kind cluster
        uses: helm/kind-action@v1.1.0
        with:
          install_local_path_provisioner: true
        if: steps.list-changed.outputs.changed == 'true'

      - name: Run chart-testing (install)
        id: install
        if: steps.list-changed.outputs.changed == 'true'
        run: ct install --config ct.yaml

ct.yaml

helm-extra-args: --timeout 600s
chart-dirs:
  - charts
target-branch: main

file structure :

$ tree
.
├── charts
│   └── driftctl
│       ├── Chart.yaml
│       ├── templates
│       │   ├── _helpers.tpl
│       │   ├── job.yaml
│       │   ├── NOTES.txt
│       │   └── volume-cm.yaml
│       └── values.yaml
├── ct.yaml
├── LICENSE
└── README.md

3 directories, 9 files
afritzler commented 3 years ago

Running into the same issue here. @sundowndev where you able to fix the problem?

sundowndev commented 3 years ago

Running into the same issue here. @sundowndev where you able to fix the problem?

No. I ended up removing this step from my workflow.

wissamataleh commented 3 years ago

Same issue

AymanMagdy commented 3 years ago

It's working fine with me and returns the changed charts under dir helm/ [ where all my charts are listed ] changed=$(ct list-changed --remote origin --target-branch=staging --chart-dirs helm/)

You must pass the following: --remote, for your where your source code --target-branch, [ optional and its default is main/master ] --chart-dirs, where you point to the helm chart dir

mathewmeconry commented 3 years ago

@sundowndev , @wissamataleh , @afritzler you probably have the same issues as we had. Github changed the naming of the default branch from master to main. This causes an issue because cts default target branch is master and not main

To get it working add the option --target-branch and the value main

      - name: Run chart-testing (list-changed)
        id: list-changed
        run: |
          changed=$(ct list-changed --target-branch main)
          if [[ -n "$changed" ]]; then
            echo "::set-output name=changed::true"
          fi

the same thing applies to the ct lint and ct install command.

sundowndev commented 3 years ago

@mathewmeconry Look at my OP, I have this option in the ct.yaml

helm-extra-args: --timeout 600s
chart-dirs:
  - charts
target-branch: main
troyfontaine commented 2 years ago

@mathewmeconry Look at my OP, I have this option in the ct.yaml

helm-extra-args: --timeout 600s
chart-dirs:
  - charts
target-branch: main

After testing it looks like ct.yaml is ignored/not used by chart tester in this action. You must specify the flags for the commands individually.