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

Error: failed installing charts: failed identifying charts to process: failed running process: exit status 128 #102

Closed BartoszZawadzki closed 1 year ago

BartoszZawadzki commented 2 years ago

Hi,

I'm trying to use this but it fails on:

  ct install
  shell: /usr/bin/bash -e {0}
  env:
    HELM_VERSION: 3.10.1
    pythonLocation: /opt/hostedtoolcache/Python/3.11.0/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.0/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.0/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.0/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.0/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.0/x64/lib
    CT_CONFIG_DIR: /opt/hostedtoolcache/ct/v3.7.1/x86_64/etc
    VIRTUAL_ENV: /opt/hostedtoolcache/ct/v3.7.1/x86_64/venv
Installing charts...
Error: failed installing charts: failed identifying charts to process: failed running process: exit status 128
------------------------------------------------------------------------------------------------------------------------
No chart changes detected.
------------------------------------------------------------------------------------------------------------------------
failed installing charts: failed identifying charts to process: failed running process: exit status 128
Error: Process completed with exit code 1.

My wokrflow:


env:
  HELM_VERSION: 3.10.1

on:
  pull_request:
    branches: [ "main" ]

  workflow_dispatch:

jobs:
  lint-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Set up Helm
        uses: azure/setup-helm@v3
        with:
          version: v${{ env.HELM_VERSION }}
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - name: Set up chart-testing
        uses: helm/chart-testing-action@v2.3.1
      - 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 "::set-output name=changed::true"
          fi
      - name: Run chart-testing (lint)
        run: ct lint --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }}
      - name: Create kind cluster
        uses: helm/kind-action@v1.4.0
        if: steps.list-changed.outputs.changed == 'true'
      - name: Run chart-testing (install)
        run: ct install
BartoszZawadzki commented 2 years ago

It's worth mentioning that all steps before this pass successfully (ct lint)

tstromberg commented 1 year ago

I ran into this today with ct v3.7.1, and it seemed to be relate to the git command returning with error 128:

[pid 154575] execve("/sbin/git", ["git", "merge-base", "origin/master", "HEAD"], 0xc0000aa000 /* 64 vars */ <unfinished ...>
[pid 154575] <... execve resumed>)      = 0
[pid 154575] write(2, "fatal: Not a valid object name origin/master\n", 45) = 45
[pid 154575] exit_group(128 <unfinished ...>
[pid 154575] <... exit_group resumed>)  = ?
[pid 154575] +++ exited with 128 +++

To debug this on your end, I suggest invoking ct lint with strace, such as:

strace -s 1024 -f ct lint 2>&1 | egrep 'execve|write|exit'

The error you are seeing could be related to any number of git problems, but for myself, the workaround was to use ct lint --target-branch main.

It'd be nice if ct output the error message from git instead of swallowing it.

FushuWang commented 1 year ago

You can see there is an output No chart changes detected. in the error messages of ct install.

It is caused by the step list-changed. Because there are no chart changes detected, this command will still make the changed true.

          changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
          if [[ -n "$changed" ]]; then
            echo "::set-output name=changed::true"
          fi

Becase the output of ct list-changed will have other strings even if the chart is not changed. So the check of if [[ -n "$changed" ]] will always be true.

Linting charts...
>>> helm version --template {{ .Version }}
>>> git rev-parse --is-inside-work-tree
>>> git merge-base origin/main HEAD
>>> git diff --find-renames --name-only c8b9381a98059c07b5b65510b8162c5df3f43cd0 -- charts

The output with chart changes will output a chart name, like this.

Found changes
>>> helm version --template {{ .Version }}
>>> git rev-parse --is-inside-work-tree
>>> git merge-base origin/main HEAD
>>> git diff --find-renames --name-only c8b9381a98059c07b5b65510b8162c5df3f43cd0 -- charts
charts/pulsar-resources-operator
cpanato commented 1 year ago

hello, I was not able to reproduce this issue, see https://github.com/cpanato/testing-ci-providers/actions/runs/4510324297/jobs/7941131580?pr=1802

the workflow

name: Lint and Test Charts

on:
  pull_request:

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

      - name: Set up Helm
        uses: azure/setup-helm@v3
        with:
          version: v3.11.0

      - uses: actions/setup-python@v4
        with:
          python-version: '3.9'
          check-latest: true

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

      - 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)
        if: steps.list-changed.outputs.changed == 'true'
        run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }}

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

      - name: Run chart-testing (install)
        if: steps.list-changed.outputs.changed == 'true'
        run: ct install --config ct.yaml --target-branch ${{ github.event.repository.default_branch }}
cpanato commented 1 year ago

will close this issue, but feel free to reopen or open a new one