Skip to content

Commit 6410f99

Browse files
Merge pull request #114 from NHSDigital/DTOSS-12886/add-ring1-to-preprod-deployment
[DTOSS-12886] - preprod gateway deployment fixes
2 parents 9551fea + 12dbc8e commit 6410f99

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

.azuredevops/pipelines/deploy-app.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ parameters:
1414
displayName: ADO management pool
1515
type: string
1616

17+
- name: githubToken
18+
displayName: GitHub token for release downloads
19+
type: string
20+
default: ""
21+
1722

1823
stages:
1924
- stage: ${{ parameters.environment }}
@@ -46,4 +51,5 @@ stages:
4651
export ARM_OIDC_TOKEN="$idToken"
4752
export ARM_USE_OIDC=true
4853
export ARM_USE_AZUREAD=true
54+
export GITHUB_TOKEN="${{ parameters.githubToken }}"
4955
make ci ${{ parameters.environment }} deploy-app RELEASE_TAG="${{ parameters.releaseTag }}"

.github/workflows/stage-4-deploy-app.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
RELEASE_TAG: ${{ inputs.release_tag }}
4848
COMMIT_SHA: ${{ inputs.commit_sha }}
4949
ADO_PROJECT: ${{ github.event.repository.name }}
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5051
run: |
5152
source "infrastructure/environments/${ENVIRONMENT}/variables.sh"
5253
@@ -56,7 +57,7 @@ jobs:
5657
--name "Deploy Gateway App - ${ENVIRONMENT}" \
5758
--org https://dev.azure.com/nhse-dtos \
5859
--project "${ADO_PROJECT}" \
59-
--parameters releaseTag="${RELEASE_TAG}" environment="${ENVIRONMENT}" pool="${ADO_MANAGEMENT_POOL}" \
60+
--parameters releaseTag="${RELEASE_TAG}" environment="${ENVIRONMENT}" pool="${ADO_MANAGEMENT_POOL}" githubToken="${GITHUB_TOKEN}" \
6061
--output tsv --query id)
6162
6263
echo "See pipeline run in Azure DevOps: https://dev.azure.com/nhse-dtos/${ADO_PROJECT}/_build/results?buildId=${RUN_ID}&view=results"

infrastructure/environments/preprod/variables.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ TERRAFORM_MODULES_REF=main
77
ENABLE_SOFT_DELETE=true
88
ADO_MANAGEMENT_POOL=private-pool-prod-uks
99
CLOUD_API_HOSTNAME=preprod.manage-breast-screening.nhs.uk
10+
GATEWAY_RINGS="ring1"

scripts/powershell/deploy.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,18 @@ if (-not $ZipPath) {
240240
Write-Log "Querying release: $apiUrl" "INFO"
241241
try {
242242
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
243-
$release = Invoke-RestMethod -Uri $apiUrl -Headers $headers -ErrorAction Stop
243+
$response = Invoke-WebRequest -Uri $apiUrl -Headers $headers -UseBasicParsing -ErrorAction Stop
244+
$release = $response.Content | ConvertFrom-Json
244245
} catch {
245-
throw "Could not retrieve release from $apiUrl. If the repo is private, supply -GitHubToken. Error: $_"
246+
$rateLimitMsg = ""
247+
try {
248+
$resetHeader = $_.Exception.Response.Headers["x-ratelimit-reset"]
249+
if ($resetHeader) {
250+
$resetTime = [System.DateTimeOffset]::FromUnixTimeSeconds([long]$resetHeader).ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")
251+
$rateLimitMsg = " Rate limit resets at $resetTime (local time)."
252+
}
253+
} catch {}
254+
throw "Could not retrieve release from $apiUrl. If the repo is private, supply -GitHubToken.$rateLimitMsg Error: $_"
246255
}
247256

248257
Write-Log "Release found: $($release.tag_name) - $($release.name)" "INFO"

0 commit comments

Comments
 (0)