diff --git a/.github/workflows/diff-changes.yml b/.github/workflows/diff-changes.yml new file mode 100644 index 00000000000..4707b7e51c1 --- /dev/null +++ b/.github/workflows/diff-changes.yml @@ -0,0 +1,65 @@ +name: Diff chart changes +on: + pull_request: + types: [opened, reopened, synchronize] +concurrency: + group: ${{ github.workflow }}-${{ github.repository }}-${{ github.ref_name }} + cancel-in-progress: false + +jobs: + render-charts-base: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.base.ref }} + show-progress: false + - name: Run govuk-app-render + run: ./govuk-app-render.sh + - name: Archive rendered charts + uses: actions/upload-artifact@v4 + with: + name: rendered-charts-base + path: output/ + retention-days: 1 + render-charts-head: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + show-progress: false + - name: Run govuk-app-render + run: ./govuk-app-render.sh + - name: Archive rendered charts + uses: actions/upload-artifact@v4 + with: + name: rendered-charts-head + path: output/ + retention-days: 1 + diff-charts: + runs-on: ubuntu-latest + needs: [render-charts-base, render-charts-head] + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + show-progress: false + - uses: actions/download-artifact@v4 + with: + name: rendered-charts-base + path: base-r/ + - uses: actions/download-artifact@v4 + with: + name: rendered-charts-head + path: head-r/ + - name: Diff charts and comment on PR + env: + GH_TOKEN: ${{ github.token }} + PR_URL: ${{ github.event.pull_request.html_url }} + run: ./create-diff-pr.sh diff --git a/charts/app-config/values-staging.yaml b/charts/app-config/values-staging.yaml index d936fee4b6b..02e95e8af0c 100644 --- a/charts/app-config/values-staging.yaml +++ b/charts/app-config/values-staging.yaml @@ -169,7 +169,7 @@ govukApplications: memory: 4Gi requests: cpu: 10m - memory: 2Gi + memory: 4Gi redis: enabled: true ingress: diff --git a/charts/generic-govuk-app/templates/ingress.yaml b/charts/generic-govuk-app/templates/ingress.yaml index 137e4e7418e..26c32720d19 100644 --- a/charts/generic-govuk-app/templates/ingress.yaml +++ b/charts/generic-govuk-app/templates/ingress.yaml @@ -10,6 +10,7 @@ metadata: app: {{ $fullName }} app.kubernetes.io/name: {{ $fullName }} app.kubernetes.io/component: app + some-other-label: something annotations: {{- (tpl (toYaml .Values.ingress.annotations) .) | trim | nindent 4 }} spec: diff --git a/create-diff-pr.sh b/create-diff-pr.sh new file mode 100755 index 00000000000..f6060bda6f2 --- /dev/null +++ b/create-diff-pr.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "directories" + +mkdir base head + +mv base-r/rendered-charts/* base/ +mv head-r/rendered-charts/* head/ + +echo "diff" + +diff -r base/ head/ + +DIFF=$(diff -r base/ head/) + +echo "before if" + +if [ -z "$DIFF" ]; then + cat <<'EOF' > pr.md +No changes detected in rendered charts. +EOF +else + echo "there are changes" + echo "${DIFF}" +cat <<'EOF' > pr.md +
+Rendered charts diff +This PR results in the following changes to rendered charts: + +```diff +EOF + { + echo "$DIFF" + echo '```' + echo '
' + } >> pr.md +fi + +gh pr comment "${PR_URL}" --create-if-none --edit-last --body-file pr.md