From ffd782cfa6879a619ff57686ca6d41f528a15466 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Nov 2026 20:01:05 -0500 Subject: [PATCH] Pin the Gitea chart and tag the runner tasks - Add gitea_chart_version (12.7.0, the deployed chart) so a rerun can't upgrade Gitea unexpectedly. - Import the task files statically with tags, so `ansible-playbook gitea.yaml --tags actions` applies only the runner release. The Helm repo tasks carry both tags because the runner chart comes from the same repo. - Use pullPolicy IfNotPresent for Gitea's image. The tag follows the pinned chart, so pulling on every restart adds a registry dependency without changing what runs. Refs DevOps/software-infrastructure#35 Co-Authored-By: Claude Opus 5.5 --- defaults/main.yml | 6 ++++++ tasks/gitea.yaml | 11 ++++++++++- tasks/main.yml | 9 +++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index d34e168..ebc11b8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,6 +29,12 @@ gitea_postgresql_resources: memory: 2Gi ephemeral-storage: 2Gi +# Gitea's Helm chart (gitea/gitea). Pinned so a rerun of the role never +# upgrades Gitea by surprise. 12.7.0 ships Gitea 1.27.0 and is the version +# deployed on 2026-11-09. Bump it deliberately, after reading the chart's +# release notes. +gitea_chart_version: 12.7.0 + # Gitea Actions runner (gitea/actions chart) gitea_actions_enabled: true gitea_actions_chart_version: 0.1.2 diff --git a/tasks/gitea.yaml b/tasks/gitea.yaml index bb9e592..058f8d1 100644 --- a/tasks/gitea.yaml +++ b/tasks/gitea.yaml @@ -5,15 +5,19 @@ name: gitea repo_url: https://dl.gitea.com/charts/ register: repo_update + # The runner's chart comes from this repo too. + tags: [actions] - name: update repos command: helm repo update when: repo_update.changed + tags: [actions] - name: deploy gitea kubernetes.core.helm: name: gitea chart_ref: gitea/gitea + chart_version: "{{ gitea_chart_version }}" release_namespace: gitea create_namespace: true values: @@ -30,8 +34,13 @@ matchLabels: app.kubernetes.io/component: controller app.kubernetes.io/name: ingress-nginx + # The image tag comes from the pinned chart's appVersion (1.27.0 for + # 12.7.0), so it only changes when gitea_chart_version is bumped. + # IfNotPresent keeps a restart from pulling a re-pushed tag or + # failing because the registry is unreachable; the pinned version + # is what decides which Gitea runs. image: - pullPolicy: Always + pullPolicy: IfNotPresent service: ssh: type: LoadBalancer diff --git a/tasks/main.yml b/tasks/main.yml index ea9b4cc..f0f21d3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,14 @@ #SPDX-License-Identifier: MIT-0 --- # tasks file for ansible-role-gitea +# Static imports so tags reach every task. Apply just the runner with +# ansible-playbook gitea.yaml --tags actions +# which leaves the main Gitea release untouched. - name: gitea - include_tasks: gitea.yaml + import_tasks: gitea.yaml + tags: [gitea] - name: gitea actions runner - include_tasks: actions.yaml + import_tasks: actions.yaml when: gitea_actions_enabled | bool + tags: [actions]