stefanprodan / helm-gh-pages

A GitHub Action for publishing Helm charts to Github Pages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

user specified "charts_dir" argument doesnt work with the Action

OmkarG1986 opened this issue · comments

I have multiple charts in my repo. I am setting up workflow to run it for specific chart i.e. charts/common
I am passing my charts dir path to Github action as below:

- name: Publish Helm charts
        uses: stefanprodan/helm-gh-pages@master
        with:
          charts_dir: charts/common
          token: ${{ secrets.GITHUB_TOKEN }}

however workflow fails while executing the action with below error. Not sure why cant it locate Chart.yaml in the charts dir "charts/common" even though its present there.

Screenshot 2021-02-03 152956

Screenshot 2021-02-03 152737

Run stefanprodan/helm-gh-pages@master
/usr/bin/docker run --name fff47541574080a7dd09b76af1afed_ae0358 --label 442333 --workdir /github/workspace --rm -e INPUT_CHARTS_DIR -e INPUT_TOKEN -e INPUT_CHARTS_URL -e INPUT_OWNER -e INPUT_REPOSITORY -e INPUT_BRANCH -e INPUT_TARGET_DIR -e INPUT_HELM_VERSION -e INPUT_LINTING -e INPUT_COMMIT_USERNAME -e INPUT_COMMIT_EMAIL -e INPUT_APP_VERSION -e INPUT_CHART_VERSION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/bb-helmcharts/bb-helmcharts":"/github/workspace" 442333:12fff47541574080a7dd09b76af1afed "" "charts/common" "" "" "" "" "" "" "" "" "*****@users.noreply.github.com" "" ""
Ignoring non-chart directory charts/common/templates
Error: 1 chart(s) linted, 1 chart(s) failed
==> Linting .
Error unable to check Chart.yaml file in chart: stat Chart.yaml: no such file or directory

@OmkarG1986 I found out chart_dir need to set nested folder.

maybe your case, chart_dir: charts.

The code responsible for looking up the Charts.yaml does this via

find "${CHARTS_DIR}" -type d -mindepth 1 -maxdepth 1.

This seems broken to me, I think it should be either -mindepth 0 or the author expected mandatory subfolders in ${CHARTS_DIR}.

So you have two workarounds:

  1. Create a subfolder in ${CHARTS_DIR}
  2. Set ${CHARTS_DIR} to .

I was also quite confused about this at first; here is my solution/configuration for reference; assuming the chart is in project1/charts/project1/Chart.yaml and project2/charts/..., the following works:

publish-linux:
    runs-on: ubuntu-latest
    needs: build-linux
    strategy:
      matrix:
        project:
          - project1/charts
          - project2/charts

    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build and publish chart
        uses: stefanprodan/helm-gh-pages@master
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          token: ${{ secrets.HELM_REPO_GITHUB_TOKEN }}
          charts_dir: ${{ matrix.project }}
          charts_url: https://pojntfx.github.io/charts/
          owner: pojntfx
          repository: charts
          branch: gh-pages