googleapis / googleapis/release-please-action

Path is not taken into account

Open
#741 6 comments 9 reactions 1 assignee Claimed by @chingor13 View on GitHub
priority: p3 type: bug
Dominant language
TypeScript
Stars
2.5k
Forks
327
PR merge metrics
No merged PRs in 30d

Description

### TL;DR

When you add a `path` parameter to the action, it doesn't use it to configure the strategy.
We have a Helm chart with a `Chart.yaml` in `/chart/Chart.yaml`, but when we configure the action with a `path: chart` it continues to lookup from git root.

### Expected behavior

Path directive is used like a package in `release-please-config.json`, and so this:

```json
{
"packages": {
"chart": {
"release-type": "helm"
}
}
}
```

Should be equivalent to:

```yaml
- uses: google-github-actions/release-please-action@v3
id: release
with:
path: chart
release-type: helm
```

### Observed behavior

We have the following error in our github action:

```
Run google-github-actions/release-please-action@v3
❯ Fetching Chart.yaml from branch releases/v3.0
Error: release-please failed: Helm (mirakl/manifests-app-mailing): Missing required file: Chart.yaml
```

Please note it tries to fetch `Chart.yaml` from the repo's root folder, not the provided `chart` path.

### Action YAML

```yaml
name: Release the Chart

on:
push:
branches:
- master
- releases/v*

permissions:
contents: write
pull-requests: write

env:
CHART_NAME: XXX
HELM_REGISTRY: XXX
HELM_VERSION: XXX
PYTHON_VERSION: 3

jobs:
release-please:
name: Release the Chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Sets env var for main release
id: rp_config
run: |
if [[ ${{github.ref}} == refs/heads/releases/v* ]]; then
echo "::set-output name=versioning::always-bump-patch"
else
echo "::set-output name=versioning::default"
fi
shell: bash
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: helm
bump-minor-pre-major: true # Remove this line and push a breaking change in order to release your first v1.x.y version
default-branch: releases/v3.0 # TODO fix the env.GITHUB_REF_NAME that set to null :/
versioning-strategy: ${{ steps.rp_config.outputs.versioning }}
path: chart
- name: Set up Helm
if: ${{ steps.release.outputs.chart--release_created }}
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Set up Python
uses: actions/setup-python@v4
if: ${{ steps.release.outputs.chart--release_created }}
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Login to GCP artifact registry
if: ${{ steps.release.outputs.chart--release_created }}
uses: docker/login-action@v2
with:
registry: https://${{ env.HELM_REGISTRY }}
username: _json_key_base64
password: ${{ secrets.GCP_ARTIFACT_REGISTRY_HELM }}
- name: Package and push the Chart
if: ${{ steps.release.outputs.chart--release_created }}
run: |
helm package -u --version ${{ steps.release.outputs.chart--major }}.${{ steps.release.outputs.chart--minor }}.${{ steps.release.outputs.chart--patch }} chart -d chart/packages
helm push chart/packages/${{ env.CHART_NAME }}-${{ steps.release.outputs.chart--major }}.${{ steps.release.outputs.chart--minor }}.${{ steps.release.outputs.chart--patch }}.tgz oci://${{ env.HELM_REGISTRY }}
```

### Log output

```text
Run google-github-actions/release-please-action@v3
❯ Fetching Chart.yaml from branch releases/v3.0
Error: release-please failed: Helm (mirakl/manifests-app-mailing): Missing required file: Chart.yaml
```

### Additional information

When using a `release-please-config.json` we can see in logs:

```
Run google-github-actions/release-please-action@v3
❯ Fetching release-please-config.json from branch releases/v3.0
❯ Fetching .release-please-manifest.json from branch releases/v3.0
✔ Building pull requests
✔ Building strategies by path
❯ chart: helm
❯ Fetching chart/Chart.yaml from branch releases/v3.0
```

I think it is caused because `path` is not injected [here](https://github.com/googleapis/release-please/blob/70f7b25f9e34f8de82798f4fea64f545f0d222e0/src/manifest.ts#L449) (as it is [here](https://github.com/googleapis/release-please/blob/70f7b25f9e34f8de82798f4fea64f545f0d222e0/src/manifest.ts#L1218)), so [this call](https://github.com/googleapis/release-please/blob/70f7b25f9e34f8de82798f4fea64f545f0d222e0/src/manifest.ts#L453) fails because [helm strategy tries to load the package name](https://github.com/googleapis/release-please/blob/70f7b25f9e34f8de82798f4fea64f545f0d222e0/src/strategies/helm.ts#L56) (because the [base strategy](https://github.com/googleapis/release-please/blob/70f7b25f9e34f8de82798f4fea64f545f0d222e0/src/strategies/base.ts#L172) uses the overloaded function [here](https://github.com/googleapis/release-please/blob/70f7b25f9e34f8de82798f4fea64f545f0d222e0/src/strategies/base.ts#L168))

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.