#!/usr/bin/env bash # Copied from helm-template; update GITEA_API_URL and repo details as needed. set -euo pipefail GITEA_API_URL="${GITEA_API_URL:-https://git.olb42.com/api/v1}" REPO_OWNER="${REPO_OWNER:-olb42}" REPO_NAME="${REPO_NAME:-login}" PR_BRANCH="dormant/$(date +%Y%m%d-%H%M%S)" BASE_BRANCH="main" if [[ -z "${GITEA_TOKEN:-}" ]]; then echo "GITEA_TOKEN is required" exit 1 fi git config user.email "ci@olb42.com" git config user.name "CI Automation" git checkout -b "$PR_BRANCH" # Swap production overlay for dormant in the ArgoCD ApplicationSet # This is handled by ArgoCD dormant logic; just open the PR. git push origin "$PR_BRANCH" curl -s -X POST "$GITEA_API_URL/repos/$REPO_OWNER/$REPO_NAME/pulls" \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "{ \"title\": \"Propose dormant mode for login\", \"body\": \"Automated PR to switch login Keycloak to dormant overlay.\", \"head\": \"$PR_BRANCH\", \"base\": \"$BASE_BRANCH\" }" echo "Dormant PR created"