|
72 | 72 | RESOURCE: nais/naiserator.yaml
|
73 | 73 | VARS: nais/dev-fss.json
|
74 | 74 |
|
75 |
| - close-old-deployment-reviews: |
76 |
| - runs-on: ubuntu-latest |
77 |
| - needs: [ build, test, deploy-dev ] |
78 |
| - permissions: |
79 |
| - deployments: write |
80 |
| - steps: |
81 |
| - - name: Close older deployment reviews |
82 |
| - env: |
83 |
| - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
84 |
| - run: | |
85 |
| - echo "Fetching pending deployment reviews..." |
86 |
| - PENDING_REVIEWS=$(gh api \ |
87 |
| - repos/${{ github.repository }}/environments/prod-fss:k9saksbehandling/deployment_protection_rules/pending_deployments \ |
88 |
| - --jq '.pending_deployments[] | {run_id: .deployment.workflow_run_id, deploy_id: .deployment.id}') |
89 |
| - |
90 |
| - if [ -z "$PENDING_REVIEWS" ]; then |
91 |
| - echo "No pending deployment reviews found." |
92 |
| - exit 0 |
93 |
| - fi |
94 |
| -
|
95 |
| - echo "Found pending reviews: $PENDING_REVIEWS" |
96 |
| - |
97 |
| - # Close all deployment reviews except for this run |
98 |
| - echo "$PENDING_REVIEWS" | jq -c '.' | while read -r review; do |
99 |
| - RUN_ID=$(echo "$review" | jq -r '.run_id') |
100 |
| - DEPLOY_ID=$(echo "$review" | jq -r '.deploy_id') |
101 |
| - |
102 |
| - if [[ "$RUN_ID" != "${{ github.run_id }}" ]]; then |
103 |
| - echo "Closing deployment review for Run ID: $RUN_ID, Deploy ID: $DEPLOY_ID" |
104 |
| - gh api \ |
105 |
| - --method POST \ |
106 |
| - repos/${{ github.repository }}/actions/deployments/$DEPLOY_ID/reject \ |
107 |
| - -f environment_name="prod-fss:k9saksbehandling" \ |
108 |
| - -f state="rejected" \ |
109 |
| - -f comment="Automatically rejected - newer deployment is available" |
110 |
| - else |
111 |
| - echo "Skipping current run's deployment review: $RUN_ID" |
112 |
| - fi |
113 |
| - done |
114 |
| -
|
115 | 75 | deploy-prod:
|
116 | 76 | runs-on: ubuntu-latest
|
117 |
| - needs: [ deploy-dev, close-old-deployment-reviews ] |
| 77 | + needs: [ deploy-dev ] |
118 | 78 | environment: "prod-fss:k9saksbehandling"
|
119 | 79 | concurrency: "prod-fss:k9saksbehandling"
|
120 | 80 | steps:
|
|
0 commit comments