From 3b32a04b9c4fa007473ad789942abef321d23f7b Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Mon, 7 Apr 2025 09:16:22 +0000 Subject: [PATCH] chore(actions): check actions is not configured (#849) This is @ChristopherHX's PR ### Description of the change Do not silently ignore actions.enabled set by user. ### Benefits Everybody who has enabled actions act_runner do not silently end up without runners, but directly see an actionable error message. ### Possible drawbacks You need to remove the actions section from your own values.yml to upgrade/install this chart. The Migration Guide has not been written yet, I consider this issue as a community wiki where other maintainers are free to edit my initial post. ### Applicable issues N/A ### Additional information I couldn't add helm-gitea as a dependency, because of - conflict with https://gitea.com/gitea/helm-gitea/src/commit/a7035ca4e56ed5cdff3e6130a83d9c1742b29ccf/templates/_helpers.tpl#L223-L230 with one difference helm-actions did not have the referenced values and failed to render - after resolving the above by either renaming in the helm-actions chart or removal of this leftover code in helm-gitea - helm does not allow me to derive dynamic default values for the `actions` section for the subchart - using yaml anchors only provided default values into helm-actions, without respecting user changes - I only found a feature request - It is not feasible for me in short term to add support of this section back using helm-actions ### Checklist - [X] Helm templating unittests are added (required when changing anything in `templates` folder) Co-authored-by: Christopher Homberger Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/849 Reviewed-by: pat-s Co-authored-by: techknowlogick Co-committed-by: techknowlogick --- templates/gitea/check-actions-not-present.yaml | 3 +++ unittests/helm/check-actions-not-present.yaml | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 templates/gitea/check-actions-not-present.yaml create mode 100644 unittests/helm/check-actions-not-present.yaml diff --git a/templates/gitea/check-actions-not-present.yaml b/templates/gitea/check-actions-not-present.yaml new file mode 100644 index 0000000..ad17bf6 --- /dev/null +++ b/templates/gitea/check-actions-not-present.yaml @@ -0,0 +1,3 @@ +{{- if .Values.actions -}} + {{- fail "The actions sub-chart has been outsourced to a dedicated chart available at https://gitea.com/gitea/helm-actions. For assistance with the migration process, check https://gitea.com/gitea/helm-actions/issues/9." -}} +{{- end -}} diff --git a/unittests/helm/check-actions-not-present.yaml b/unittests/helm/check-actions-not-present.yaml new file mode 100644 index 0000000..b08b679 --- /dev/null +++ b/unittests/helm/check-actions-not-present.yaml @@ -0,0 +1,12 @@ +suite: Check if actions raises an error +release: + name: gitea-unittests + namespace: testing +tests: + - it: fails when trying to configure actions due to removal + set: + actions: + enabled: true + asserts: + - failedTemplate: + errorMessage: The actions sub-chart has been outsourced to a dedicated chart available at https://gitea.com/gitea/helm-actions. For assistance with the migration process, check https://gitea.com/gitea/helm-actions/issues/9.