Compare commits

..

1 Commits

Author SHA1 Message Date
cs_savannah 6d4147ce03 fix(ci): replace docker/login-action with direct docker login (CAR-994)
CI / build-and-push (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped
The docker/login-action@v3 does not work with Gitea's token. Replaced
with direct docker login command using ${{ github.token }}.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-24 18:10:34 +00:00
6 changed files with 32 additions and 207 deletions
-1
View File
@@ -1 +0,0 @@
# CI trigger 20260525231507 - post-DinD verification (CAR-1042)
+25 -180
View File
@@ -37,17 +37,13 @@ jobs:
run: | run: |
DATE_TAG=$(date -u +%Y.%m.%d) DATE_TAG=$(date -u +%Y.%m.%d)
EXISTING=$(git tag -l "v${DATE_TAG}*" | sort -V | tail -1) EXISTING=$(git tag -l "v${DATE_TAG}*" | sort -V | tail -1)
if [ -z "$EXISTING" ]; then if [ -z "$EXISTING" ]; then VERSION="$DATE_TAG"
VERSION="$DATE_TAG" elif [ "$EXISTING" = "v${DATE_TAG}" ]; then VERSION="${DATE_TAG}.2"
elif [ "$EXISTING" = "v${DATE_TAG}" ]; then else BUILD_NUM=$(echo "$EXISTING" | sed "s/v${DATE_TAG}\.//"); VERSION="${DATE_TAG}.$((BUILD_NUM + 1))"; fi
VERSION="${DATE_TAG}.2"
else
BUILD_NUM=$(echo "$EXISTING" | sed "s/v${DATE_TAG}\.//"); VERSION="${DATE_TAG}.$((BUILD_NUM + 1))";
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ env.REGISTRY }} -u "${{ github.actor }}" --password-stdin run: echo "${{ github.token }}" | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
- name: Extract metadata - name: Extract metadata
id: meta id: meta
@@ -59,41 +55,11 @@ jobs:
type=raw,value=${{ steps.calver.outputs.version }},enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=${{ steps.calver.outputs.version }},enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build Docker image - name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Scan Docker image
uses: anchore/scan-action@v5
id: scan
env:
GRYPE_CONFIG: .grype.yaml
with:
image: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}"
fail-build: true
severity-cutoff: high
only-fixed: "true"
output-format: sarif
- name: Push Docker image
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
push: true push: true
# CAR-1446: git.farh.net does not implement the OCI referrers API.
# Verified 2026-06-23: GET /v2/cartsnitch/auth/referrers/{digest} →
# HTTP 404 "page not found" (plain proxy 404, not an OCI error — the path
# does not exist in this Gitea registry version). OCI Distribution Spec
# >=1.1 is required for provenance/SBOM attestation manifests; without it
# the docker/build-push-action would fail at the attestation PUT.
# Compensating control: the Grype scan step above fails the build on any
# unfixed HIGH-severity CVE before the image reaches the registry.
provenance: false
sbom: false
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
@@ -106,27 +72,16 @@ jobs:
deploy-dev: deploy-dev:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build-and-push] needs: [build-and-push]
if: always() && !cancelled() && github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main')
steps: steps:
- name: Checkout infra repo - uses: actions/checkout@v4
uses: actions/checkout@v4
with: with:
repository: cartsnitch/infra repository: cartsnitch/infra
token: ${{ secrets.CI_GITEA_TOKEN }} token: ${{ secrets.GITEA_TOKEN }}
ref: ${{ github.ref == 'refs/heads/main' && 'main' || (github.ref == 'refs/heads/uat' && 'uat' || 'dev') }} ref: main
path: infra path: infra
- name: Install kustomize - uses: imranismail/setup-kustomize@v2
# Install kustomize binary directly. Avoids imranismail/setup-kustomize@v2
# which calls the Gitea API to record "kubernetes-sigs" user metrics
# against a user that does not exist in this Gitea instance.
run: |
set -euo pipefail
version="5.4.3"
url="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${version}/kustomize_v${version}_linux_amd64.tar.gz"
curl -fsSL --retry 3 "$url" | tar -xz -C /tmp kustomize
sudo mv /tmp/kustomize /usr/local/bin/kustomize
kustomize version
- name: Determine image tag - name: Determine image tag
id: tag id: tag
@@ -138,96 +93,34 @@ jobs:
fi fi
- name: Update auth image tag in dev overlay - name: Update auth image tag in dev overlay
if: needs.build-and-push.result == 'success'
run: | run: |
cd infra/apps/overlays/dev cd infra/apps/overlays/dev
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.tag.outputs.tag }} kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.tag.outputs.tag }}
- name: Commit and push to infra (via PR) - name: Commit and push to infra
if: needs.build-and-push.result == 'success'
env:
CI_GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }}
run: | run: |
set -euo pipefail
cd infra cd infra
git config user.name "cartsnitch-ci[bot]" git config user.name "cartsnitch-ci[bot]"
git config user.email "cartsnitch-ci[bot]@users.noreply.github.com" git config user.email "cartsnitch-ci[bot]@users.noreply.github.com"
git add apps/overlays/dev/kustomization.yaml git add apps/overlays/dev/kustomization.yaml
git diff --cached --quiet && { echo "No image changes to deploy"; exit 0; } git diff --cached --quiet && echo "No changes" && exit 0
BRANCH="ci/deploy-dev-${GITHUB_SHA}" git commit -m "ci(dev): update auth image from cartsnitch/auth CI"
git checkout -b "$BRANCH" git pull --rebase origin main
git commit -m "ci(dev): update auth image (${GITHUB_SHA::12})" git push origin main
git push origin "$BRANCH" 2>&1 | tee /tmp/push.log
if grep -q "You are not allowed to push code to protected branches" /tmp/push.log; then
echo "::notice::Refusing to push directly to protected branch — falling back to contents API"
exit 0
fi
TITLE="ci(dev): update auth image (${GITHUB_SHA::12})"
PR_BODY=$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base main --arg title "$TITLE" --arg body "Bumps apps/overlays/dev/kustomization.yaml auth newTag to \`${{ steps.tag.outputs.tag }}\` from cartsnitch/auth CI build $GITHUB_SHA." \
'{head: $head, base: $base, title: $title, body: $body}')
PR_JSON=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "$PR_BODY" \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls")
PR_NUM=$(echo "$PR_JSON" | jq -r '.number // empty')
if [ -z "$PR_NUM" ]; then
echo "::error::Failed to open infra PR: $PR_JSON"
exit 1
fi
echo "Opened cartsnitch/infra PR #${PR_NUM}"
REVIEW_HTTP=$(curl -sS -o /dev/null -w '%{http_code}' -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"reviewers":["cs_savannah"]}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/requested_reviewers")
if [ "${REVIEW_HTTP}" -lt 200 ] || [ "${REVIEW_HTTP}" -ge 300 ]; then
echo "::notice::Failed to request reviewers for cartsnitch/infra PR #${PR_NUM} (HTTP ${REVIEW_HTTP}); continuing"
fi
# CAR-1216: the in-job merge attempt is a best-effort fast-path only.
# `cartsnitch/infra` main requires a human approving review; the CI bot
# cannot self-approve. Treat any non-merged outcome (approvals pending,
# checks pending, any other Gitea message) as the GitOps approval gate
# — the PR is already opened and cs_savannah is requested as reviewer.
MERGE_RESP=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"Do":"merge","delete_branch_after_merge":true}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
if [ "$MERGED" = "true" ]; then
echo "PR #${PR_NUM} merged into cartsnitch/infra dev"
else
# CAR-1438: PR opened successfully; any non-merged outcome (empty body,
# approval-gate, pending checks) is the GitOps gate — not a failure.
echo "::notice::infra PR #${PR_NUM} opened — auto-merge not available (${MERGE_RESP:-empty response}); awaiting CTO (cs_savannah) approve+merge"
exit 0
fi
deploy-uat: deploy-uat:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build-and-push] needs: [build-and-push]
if: always() && !cancelled() && github.event_name == 'push' && (github.ref == 'refs/heads/uat' || github.ref == 'refs/heads/main') if: github.event_name == 'push' && (github.ref == 'refs/heads/uat' || github.ref == 'refs/heads/main')
steps: steps:
- name: Checkout infra repo - uses: actions/checkout@v4
uses: actions/checkout@v4
with: with:
repository: cartsnitch/infra repository: cartsnitch/infra
token: ${{ secrets.CI_GITEA_TOKEN }} token: ${{ secrets.GITEA_TOKEN }}
ref: ${{ github.ref == 'refs/heads/main' && 'main' || (github.ref == 'refs/heads/uat' && 'uat' || 'dev') }} ref: main
path: infra path: infra
- name: Install kustomize - uses: imranismail/setup-kustomize@v2
# Install kustomize binary directly. Avoids imranismail/setup-kustomize@v2
# which calls the Gitea API to record "kubernetes-sigs" user metrics
# against a user that does not exist in this Gitea instance.
run: |
set -euo pipefail
version="5.4.3"
url="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${version}/kustomize_v${version}_linux_amd64.tar.gz"
curl -fsSL --retry 3 "$url" | tar -xz -C /tmp kustomize
sudo mv /tmp/kustomize /usr/local/bin/kustomize
kustomize version
- name: Determine image tag - name: Determine image tag
id: tag id: tag
@@ -239,65 +132,17 @@ jobs:
fi fi
- name: Update auth image tag in uat overlay - name: Update auth image tag in uat overlay
if: needs.build-and-push.result == 'success'
run: | run: |
cd infra/apps/overlays/uat cd infra/apps/overlays/uat
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.tag.outputs.tag }} kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.tag.outputs.tag }}
- name: Commit and push to infra (via PR) - name: Commit and push to infra
if: needs.build-and-push.result == 'success'
env:
CI_GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }}
run: | run: |
set -euo pipefail
cd infra cd infra
git config user.name "cartsnitch-ci[bot]" git config user.name "cartsnitch-ci[bot]"
git config user.email "cartsnitch-ci[bot]@users.noreply.github.com" git config user.email "cartsnitch-ci[bot]@users.noreply.github.com"
git add apps/overlays/uat/kustomization.yaml git add apps/overlays/uat/kustomization.yaml
git diff --cached --quiet && { echo "No image changes to deploy"; exit 0; } git diff --cached --quiet && echo "No changes" && exit 0
BRANCH="ci/deploy-uat-${GITHUB_SHA}" git commit -m "ci(uat): update auth image from cartsnitch/auth CI"
git checkout -b "$BRANCH" git pull --rebase origin main
git commit -m "ci(uat): update auth image (${GITHUB_SHA::12})" git push origin main
git push origin "$BRANCH" 2>&1 | tee /tmp/push.log
if grep -q "You are not allowed to push code to protected branches" /tmp/push.log; then
echo "::notice::Refusing to push directly to protected branch — falling back to contents API"
exit 0
fi
TITLE="ci(uat): update auth image (${GITHUB_SHA::12})"
PR_BODY=$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base main --arg title "$TITLE" --arg body "Bumps apps/overlays/uat/kustomization.yaml auth newTag to \`${{ steps.tag.outputs.tag }}\` from cartsnitch/auth CI build $GITHUB_SHA." \
'{head: $head, base: $base, title: $title, body: $body}')
PR_JSON=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "$PR_BODY" \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls")
PR_NUM=$(echo "$PR_JSON" | jq -r '.number // empty')
if [ -z "$PR_NUM" ]; then
echo "::error::Failed to open infra PR: $PR_JSON"
exit 1
fi
echo "Opened cartsnitch/infra PR #${PR_NUM}"
REVIEW_HTTP=$(curl -sS -o /dev/null -w '%{http_code}' -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"reviewers":["cs_savannah"]}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/requested_reviewers")
if [ "${REVIEW_HTTP}" -lt 200 ] || [ "${REVIEW_HTTP}" -ge 300 ]; then
echo "::notice::Failed to request reviewers for cartsnitch/infra PR #${PR_NUM} (HTTP ${REVIEW_HTTP}); continuing"
fi
# CAR-1216: see deploy-dev — same never-fail on merge outcome.
MERGE_RESP=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"Do":"merge","delete_branch_after_merge":true}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
if [ "$MERGED" = "true" ]; then
echo "PR #${PR_NUM} merged into cartsnitch/infra uat"
else
# CAR-1438: PR opened successfully; any non-merged outcome (empty body,
# approval-gate, pending checks) is the GitOps gate — not a failure.
echo "::notice::infra PR #${PR_NUM} opened — auto-merge not available (${MERGE_RESP:-empty response}); awaiting CTO (cs_savannah) approve+merge"
exit 0
fi
-11
View File
@@ -1,11 +0,0 @@
{
"mcpServers": {
"gitea": {
"type": "http",
"url": "https://git-mcp.farh.net/mcp",
"headers": {
"Authorization": "Bearer ${GITEA_TOKEN}"
}
}
}
}
+6 -6
View File
@@ -818,9 +818,9 @@
} }
}, },
"node_modules/defu": { "node_modules/defu": {
"version": "6.1.7", "version": "6.1.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
"integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/esbuild": { "node_modules/esbuild": {
@@ -909,9 +909,9 @@
} }
}, },
"node_modules/kysely": { "node_modules/kysely": {
"version": "0.28.17", "version": "0.28.14",
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.28.17.tgz", "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.28.14.tgz",
"integrity": "sha512-nbD8lB9EB3wNdMhOCdx5Li8DxnLbvKByylRLcJ1h+4SkrowVeECAyZlyiKMThF7xFdRz0jSQ2MoJr+wXux2y0Q==", "integrity": "sha512-SU3lgh0rPvq7upc6vvdVrCsSMUG1h3ChvHVOY7wJ2fw4C9QEB7X3d5eyYEyULUX7UQtxZJtZXGuT6U2US72UYA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=20.0.0"
+1 -6
View File
@@ -21,10 +21,5 @@
"@types/pg": "^8.11.0", "@types/pg": "^8.11.0",
"tsx": "^4.19.0", "tsx": "^4.19.0",
"typescript": "^5.7.0" "typescript": "^5.7.0"
},
"overrides": {
"picomatch": "^4.0.4",
"defu": "^6.1.5",
"kysely": "^0.28.17"
} }
} }
-3
View File
@@ -115,9 +115,6 @@ export const auth = betterAuth({
trustedOrigins: [ trustedOrigins: [
"http://localhost:3000", "http://localhost:3000",
"http://localhost:5173", "http://localhost:5173",
"https://cartsnitch.farh.net",
"https://cartsnitch.dev.farh.net",
"https://cartsnitch.uat.farh.net",
"https://cartsnitch.com", "https://cartsnitch.com",
"https://dev.cartsnitch.com", "https://dev.cartsnitch.com",
"https://uat.cartsnitch.com", "https://uat.cartsnitch.com",