Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fail release workflow if no new releases were published #327

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rolodato
Copy link
Member

@rolodato rolodato commented Feb 27, 2025

We previously tried to create a release by running the release workflow after manually creating a tag/release: https://github.com/Flagsmith/flagsmith-charts/actions/runs/13566028719/job/37919249460

This did not work because chart-releaser-action always creates the tag/release, with no option to change this behaviour. However, the release workflow still succeeded, which is confusing.

This PR makes it so that the release workflow fails if no releases were published, which should make this situation easier to understand and manually correct if it happens again.

A better solution would be to fully implement release-please, which I understand means we'd need to implement a more manual release pipeline like this random repository: https://github.com/Mailu/helm-charts/blob/master/.github/workflows/publish-chart.yaml

This PR is not tested - it can be tested by YOLO-merging and trying to run the release workflow again, which should fail.

Tested using act with my personal GitHub token:

INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
WARN[0000] Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name
WARN[0000] Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name
WARN[0000] Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name
WARN[0000] Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name
[Release Charts/release] 🚀  Start image=catthehacker/ubuntu:act-latest
[Release Charts/release]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Release Charts/release] using DockerAuthConfig authentication for docker pull
[Release Charts/release]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Release Charts/release]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Release Charts/release]   ☁  git clone 'https://github.com/azure/setup-helm' # ref=v1
[Release Charts/release]   ☁  git clone 'https://github.com/helm/chart-testing-action' # ref=v2.0.1
[Release Charts/release] ⭐ Run Pre Set up chart-testing
[Release Charts/release]   ✅  Success - Pre Set up chart-testing
[Release Charts/release]   ☁  git clone 'https://github.com/helm/chart-releaser-action' # ref=v1.2.0
[Release Charts/release] ⭐ Run Pre Run chart-releaser
[Release Charts/release]   ✅  Success - Pre Run chart-releaser
[Release Charts/release] ⭐ Run Main Checkout
[Release Charts/release]   🐳  docker cp src=/Users/rolodato/source/flagsmith/charts/. dst=/Users/rolodato/source/flagsmith/charts
[Release Charts/release]   ✅  Success - Main Checkout
[Release Charts/release] ⭐ Run Main Configure Git
[Release Charts/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1] user= workdir=
[Release Charts/release]   ✅  Success - Main Configure Git
[Release Charts/release] ⭐ Run Main Install Helm
[Release Charts/release]   🐳  docker cp src=/Users/rolodato/.cache/act/azure-setup-helm@v1/ dst=/var/run/act/actions/azure-setup-helm@v1/
[Release Charts/release]   🐳  docker exec cmd=[node /var/run/act/actions/azure-setup-helm@v1/lib/run.js] user= workdir=
[Release Charts/release]   💬  ::debug::Downloading v3.5.4
[Release Charts/release]   💬  ::debug::isExplicit: 3.5.4
[Release Charts/release]   💬  ::debug::explicit? true
[Release Charts/release]   💬  ::debug::checking cache: /opt/hostedtoolcache/helm/3.5.4/arm64
[Release Charts/release]   💬  ::debug::Found tool in cache helm 3.5.4 arm64
[Release Charts/release]   💬  ::debug::LICENSE
[Release Charts/release]   💬  ::debug::README.md
[Release Charts/release]   💬  ::debug::helm
| Helm tool version: 'v3.5.4' has been cached at /opt/hostedtoolcache/helm/3.5.4/arm64/linux-amd64/helm
[Release Charts/release]   ⚙  ::set-output:: helm-path=/opt/hostedtoolcache/helm/3.5.4/arm64/linux-amd64/helm
[Release Charts/release]   ✅  Success - Main Install Helm
[Release Charts/release]   ⚙  ::add-path:: /opt/hostedtoolcache/helm/3.5.4/arm64/linux-amd64
[Release Charts/release] ⭐ Run Main Add chart repo dependencies
[Release Charts/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir=
| "stable" has been added to your repositories
| "influxdb2" has been added to your repositories
| "kiwigrid" has been added to your repositories
| "bitnami" has been added to your repositories
[Release Charts/release]   ✅  Success - Main Add chart repo dependencies
[Release Charts/release] ⭐ Run Main Set up chart-testing
[Release Charts/release]   🐳  docker cp src=/Users/rolodato/.cache/act/[email protected]/ dst=/var/run/act/actions/[email protected]/
[Release Charts/release] ⭐ Run Main $GITHUB_ACTION_PATH/ct.sh --version v3.3.0
[Release Charts/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4-composite-0.sh] user= workdir=
| Adding ct directory to PATH...
| Setting CT_CONFIG_DIR...
| Configuring environment variables for virtual environment for subsequent workflow steps...
| Version:	 v3.3.0
| Git commit:	 2a4dfd420d066f821b39724fba89133f930a9953
| Date:		 2020-11-03T19:17:04Z
| License:	 Apache 2.0
[Release Charts/release]   ✅  Success - Main $GITHUB_ACTION_PATH/ct.sh --version v3.3.0
[Release Charts/release]   ⚙  ::set-env:: CT_CONFIG_DIR=/opt/hostedtoolcache/ct/v3.3.0/aarch64/etc
[Release Charts/release]   ⚙  ::set-env:: VIRTUAL_ENV=/opt/hostedtoolcache/ct/v3.3.0/aarch64/venv
[Release Charts/release]   ⚙  ::add-path:: /opt/hostedtoolcache/ct/v3.3.0/aarch64
[Release Charts/release]   ⚙  ::add-path:: /opt/hostedtoolcache/ct/v3.3.0/aarch64/venv/bin
[Release Charts/release]   ✅  Success - Main Set up chart-testing
[Release Charts/release]   ⚙  ::set-env:: CT_CONFIG_DIR=/opt/hostedtoolcache/ct/v3.3.0/aarch64/etc
[Release Charts/release]   ⚙  ::set-env:: VIRTUAL_ENV=/opt/hostedtoolcache/ct/v3.3.0/aarch64/venv
[Release Charts/release]   ⚙  ::add-path:: /opt/hostedtoolcache/ct/v3.3.0/aarch64
[Release Charts/release]   ⚙  ::add-path:: /opt/hostedtoolcache/ct/v3.3.0/aarch64/venv/bin
[Release Charts/release] ⭐ Run Main Run chart-testing (lint)
[Release Charts/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5] user= workdir=
| Linting charts...
| ------------------------------------------------------------------------------------------------------------------------
| No chart changes detected.
| ------------------------------------------------------------------------------------------------------------------------
| All charts linted successfully
[Release Charts/release]   ✅  Success - Main Run chart-testing (lint)
[Release Charts/release] ⭐ Run Main Run chart-releaser
[Release Charts/release]   🐳  docker cp src=/Users/rolodato/.cache/act/[email protected]/ dst=/var/run/act/actions/[email protected]/
[Release Charts/release] ⭐ Run Main owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")

args=(--owner "$owner" --repo "$repo")
args+=(--charts-dir "charts")

if [[ -n "" ]]; then
    args+=(--version "")
fi

if [[ -n "" ]]; then
    args+=(--config "")
fi

if [[ -n "" ]]; then
    args+=(--charts-repo-url "")
fi

"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
[Release Charts/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/chart-releaser-composite-0.sh] user= workdir=
| Looking up latest tag...
| Discovering changed charts since 'flagsmith-0.71.0'...
| Nothing to do. No chart changes detected.
[Release Charts/release]   ✅  Success - Main owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")

args=(--owner "$owner" --repo "$repo")
args+=(--charts-dir "charts")

if [[ -n "" ]]; then
    args+=(--version "")
fi

if [[ -n "" ]]; then
    args+=(--config "")
fi

if [[ -n "" ]]; then
    args+=(--charts-repo-url "")
fi

"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
[Release Charts/release]   ✅  Success - Main Run chart-releaser
[Release Charts/release] ⭐ Run Main Check if release was published
[Release Charts/release]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/7] user= workdir=
| No new releases were published. If a tag and/or release already exist for this version but they have not been published to the Helm repository, delete them and run this workflow again.
[Release Charts/release]   ❌  Failure - Main Check if release was published
[Release Charts/release] exitcode '1': failure
[Release Charts/release] ⭐ Run Post Run chart-releaser
[Release Charts/release]   🐳  docker cp src=/Users/rolodato/.cache/act/[email protected]/ dst=/var/run/act/actions/[email protected]/
[Release Charts/release]   ✅  Success - Post Run chart-releaser
[Release Charts/release] ⭐ Run Post Set up chart-testing
[Release Charts/release]   🐳  docker cp src=/Users/rolodato/.cache/act/[email protected]/ dst=/var/run/act/actions/[email protected]/
[Release Charts/release]   ✅  Success - Post Set up chart-testing
[Release Charts/release] 🏁  Job failed
Error: Job 'release' failed

@rolodato rolodato requested a review from a team as a code owner February 27, 2025 14:21
@rolodato rolodato requested review from gagantrivedi and removed request for a team February 27, 2025 14:21
@rolodato rolodato enabled auto-merge February 28, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant