Skip to content

Commit 93e7e31

Browse files
committed
feat(ftrs): FTRS-978 FTRS(978) main merge
2 parents c07c34a + a27f765 commit 93e7e31

File tree

119 files changed

+8917
-3720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+8917
-3720
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: 'Cleardown API Proxy from APIM environment'
2+
description: 'Remove an API Proxy from an APIM environment'
3+
4+
inputs:
5+
api_name:
6+
description: 'Name of the API to cleardown'
7+
required: true
8+
workspace:
9+
description: 'Workspace identifier (e.g., ftrs-000). If specified, a workspaced proxy will be cleared from the APIM environment'
10+
required: false
11+
environment:
12+
description: 'The environment (e.g., dev, test, prod)'
13+
required: true
14+
apim_env:
15+
description: 'APIM environment to cleardown the API Proxy from (e.g., internal-dev, internal-qa, int, ref, prod)'
16+
required: true
17+
aws_region:
18+
description: 'AWS region for Secrets Manager'
19+
required: true
20+
proxygen_url:
21+
description: 'Proxygen API URL'
22+
required: true
23+
24+
outputs:
25+
cleardown_status:
26+
description: 'Status of the cleardown'
27+
value: ${{ steps.cleardown.outputs.status }}
28+
29+
runs:
30+
using: 'composite'
31+
steps:
32+
- name: Get Proxygen Access Token
33+
id: get-token
34+
uses: ./.github/actions/authenticate-apim
35+
with:
36+
api_name: ${{ inputs.api_name }}
37+
environment: ${{ inputs.environment }}
38+
aws_region: ${{ inputs.aws_region }}
39+
40+
- name: Cleardown API Proxy from APIM environment
41+
id: cleardown
42+
shell: bash
43+
run: |
44+
export API_NAME="${{ inputs.api_name }}"
45+
export WORKSPACE="${{ inputs.workspace }}"
46+
export PROXY_ENV="${{ inputs.apim_env }}"
47+
export ACCESS_TOKEN="${{ steps.get-token.outputs.access_token }}"
48+
export PROXYGEN_URL="${{ inputs.proxygen_url }}"
49+
50+
STATUS=$(./scripts/workflow/cleardown-apim-proxy.sh | tail -n1)
51+
echo "status=$STATUS" >> $GITHUB_OUTPUT
52+
53+
- name: Output cleardown details
54+
shell: bash
55+
run: |
56+
echo "Cleardown Summary:"
57+
echo "- API Name: ${{ inputs.api_name }}"
58+
echo "- Workspace: ${{ inputs.workspace }}"
59+
echo "- Environment: ${{ inputs.environment }}"
60+
echo "- APIM Environment: ${{ inputs.apim_env }}"
61+
echo "- Status: ${{ steps.cleardown.outputs.status }}"

.github/actions/deploy-to-apim/action.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ inputs:
2020
proxygen_url:
2121
description: 'Proxygen API URL'
2222
required: true
23+
version_tag:
24+
description: 'Version applied to the deployed proxy'
25+
required: false
2326

2427
outputs:
2528
deployment_status:
@@ -36,6 +39,7 @@ runs:
3639
pip install pyyaml
3740
3841
- name: Validate workspace format
42+
if: ${{ !contains(inputs.apim_env, 'sandbox') }}
3943
shell: bash
4044
run: |
4145
if [[ ! "${{ inputs.workspace }}" =~ ^ftrs-[0-9]+$ ]]; then
@@ -45,6 +49,7 @@ runs:
4549
echo "Workspace format validated: ${{ inputs.workspace }}"
4650
4751
- name: Modify OAS Specification
52+
if: ${{ !contains(inputs.apim_env, 'sandbox') }}
4853
id: modify-spec
4954
shell: bash
5055
run: |
@@ -63,6 +68,27 @@ runs:
6368
exit 1
6469
fi
6570
71+
- name: Modify Sandbox OAS Specification
72+
if: ${{ contains(inputs.apim_env, 'sandbox') }}
73+
id: modify-sandbox-spec
74+
shell: bash
75+
run: |
76+
export API_NAME="${{ inputs.api_name }}"
77+
export PROXY_ENV="${{ inputs.apim_env }}"
78+
export VERSION_TAG="${{ inputs.version_tag }}"
79+
80+
chmod +x ./scripts/workflow/modify-oas-sandbox-spec.sh
81+
read -r MODIFIED_SPEC_PATH TARGET_SPEC_FILE < <(./scripts/workflow/modify-oas-sandbox-spec.sh)
82+
83+
if [ $? -eq 0 ]; then
84+
echo "modified_spec_path=$MODIFIED_SPEC_PATH" >> $GITHUB_OUTPUT
85+
echo "target_spec_file_abs=$TARGET_SPEC_FILE" >> $GITHUB_OUTPUT
86+
echo "OAS spec modified successfully"
87+
else
88+
echo "Failed to modify OAS spec"
89+
exit 1
90+
fi
91+
6692
- name: Deploy API Proxy to APIM environment
6793
id: deploy
6894
shell: bash
@@ -71,8 +97,16 @@ runs:
7197
export WORKSPACE="${{ inputs.workspace }}"
7298
export PROXY_ENV="${{ inputs.apim_env }}"
7399
export ACCESS_TOKEN="${{ inputs.access_token }}"
74-
export MODIFIED_SPEC_PATH="${{ steps.modify-spec.outputs.modified_spec_path }}"
75100
export PROXYGEN_URL="${{ inputs.proxygen_url }}"
101+
export VERSION_TAG="${{ inputs.version_tag }}"
102+
export IS_SANDBOX="${{ contains(inputs.apim_env, 'sandbox') }}"
103+
104+
if [[ "$IS_SANDBOX" == 'true' ]]; then
105+
export MODIFIED_SPEC_PATH="${{ steps.modify-sandbox-spec.outputs.modified_spec_path }}"
106+
export TARGET_SPEC_FILE="${{ steps.modify-sandbox-spec.outputs.target_spec_file_abs }}"
107+
else
108+
export MODIFIED_SPEC_PATH="${{ steps.modify-spec.outputs.modified_spec_path }}"
109+
fi
76110
77111
chmod +x ./scripts/workflow/deploy-to-apim.sh
78112
./scripts/workflow/deploy-to-apim.sh
@@ -89,9 +123,13 @@ runs:
89123
- name: Output deployment details
90124
shell: bash
91125
run: |
126+
VERSION_TAG="${{ inputs.version_tag }}"
92127
echo "Deployment Summary:"
93128
echo "- API Name: ${{ inputs.api_name }}"
94129
echo "- Workspace: ${{ inputs.workspace }}"
95130
echo "- Environment: ${{ inputs.environment }}"
96131
echo "- APIM Environment: ${{inputs.apim_env }}"
132+
if [ -n "$VERSION_TAG" ]; then
133+
echo "- Version Tag: $VERSION_TAG"
134+
fi
97135
echo "- Status: ${{ steps.deploy.outputs.status }}"

.github/actions/derive-workspace/action.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: "Derive Workspace action"
22
description: "Derives the name of the workspace for subsequent actions to run against"
33

44
outputs:
5-
workspace:
6-
description: "The derived workspace name"
7-
value: ${{ steps.derive-workspace.outputs.workspace }}
5+
workspace:
6+
description: "The derived workspace name"
7+
value: ${{ steps.derive-workspace.outputs.workspace }}
88

99
runs:
1010
using: "composite"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Parse APIM sandbox tag"
2+
description: "Run the sandbox tag parsing script and emit deployment metadata"
3+
inputs:
4+
ref_name:
5+
description: "Git ref name (tag)"
6+
required: true
7+
ref_type:
8+
description: "Git ref type (e.g. tag)"
9+
required: true
10+
commit_sha:
11+
description: "Commit SHA associated with the ref"
12+
required: true
13+
runs:
14+
using: "composite"
15+
steps:
16+
- id: parse
17+
name: Run parser
18+
shell: bash
19+
env:
20+
GITHUB_REF_NAME: ${{ inputs.ref_name }}
21+
GITHUB_REF_TYPE: ${{ inputs.ref_type }}
22+
GITHUB_SHA: ${{ inputs.commit_sha }}
23+
run: ./scripts/workflow/parse-apim-sandbox-tag.sh
24+
25+
outputs:
26+
sandbox_environment:
27+
value: ${{ steps.parse.outputs.sandbox_environment }}
28+
service:
29+
value: ${{ steps.parse.outputs.service }}
30+
version:
31+
value: ${{ steps.parse.outputs.version }}
32+
should_deploy:
33+
value: ${{ steps.parse.outputs.should_deploy }}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: APIM Proxy Cleardown
2+
3+
permissions:
4+
id-token: write
5+
contents: read
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
environment:
11+
description: "Defines the Github environment in which to pull environment variables from"
12+
required: true
13+
type: string
14+
workspace:
15+
description: "Name of the workspace"
16+
required: true
17+
type: string
18+
apim_env:
19+
description: "APIM environment to cleardown from"
20+
required: true
21+
type: string
22+
api_names:
23+
description: "JSON array of API names to cleardown"
24+
required: true
25+
type: string
26+
27+
jobs:
28+
cleardown-apim-proxy:
29+
name: "Cleardown APIM proxy (${{ matrix.api_name }})"
30+
runs-on: ubuntu-latest
31+
environment: ${{ inputs.environment }}
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
api_name: ${{ fromJSON(inputs.api_names) }}
36+
37+
steps:
38+
- name: "Checkout code"
39+
uses: actions/checkout@v6
40+
41+
- name: "Configure AWS Credentials"
42+
uses: ./.github/actions/configure-credentials
43+
with:
44+
aws_account_id: ${{ secrets.ACCOUNT_ID }}
45+
aws_region: ${{ vars.AWS_REGION }}
46+
type: app
47+
environment: ${{ inputs.environment }}
48+
49+
- name: "Cleardown proxy"
50+
uses: ./.github/actions/cleardown-apim-proxy
51+
with:
52+
api_name: ${{ matrix.api_name }}
53+
workspace: ${{ inputs.workspace }}
54+
environment: ${{ inputs.environment }}
55+
apim_env: ${{ inputs.apim_env }}
56+
aws_region: ${{ vars.AWS_REGION }}
57+
proxygen_url: ${{ secrets.PROXYGEN_URL }}

.github/workflows/authenticate-and-deploy-to-apim.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
steps:
4444
- name: Checkout repository
45-
uses: actions/checkout@v5
45+
uses: actions/checkout@v6
4646

4747
- name: Configure AWS Credentials
4848
uses: ./.github/actions/configure-credentials

.github/workflows/build-project.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868

6969
- name: "Cache asdf tools"
7070
id: asdf-cache
71-
uses: actions/cache@v4
71+
uses: actions/cache@v5
7272
with:
7373
path: ~/.asdf
7474
key: asdf-${{ runner.os }}-${{ hashFiles('.tool-versions') }}
@@ -112,7 +112,7 @@ jobs:
112112
working-directory: ${{ steps.get-directories.outputs.working_directory }}
113113

114114
- name: "Publish coverage report to GitHub"
115-
uses: actions/upload-artifact@v5
115+
uses: actions/upload-artifact@v6
116116
with:
117117
name: coverage-${{ inputs.name }}.xml
118118
path: ${{ steps.get-directories.outputs.working_directory }}/coverage-${{ inputs.name }}.xml
@@ -142,7 +142,7 @@ jobs:
142142
RELEASE_BUILD: ${{ inputs.release_build }}
143143

144144
- name: "Publish artefacts to GitHub"
145-
uses: actions/upload-artifact@v5
145+
uses: actions/upload-artifact@v6
146146
with:
147147
name: ${{ inputs.name }}-${{ inputs.build_type }}-artefacts
148148
path: ${{ steps.get-directories.outputs.build_directory }}

.github/workflows/build-sandbox-images.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
echo "API_NAME=$CLEAN_NAME" >> "$GITHUB_ENV"
5151
5252
- name: "Checkout code"
53-
uses: actions/checkout@v5
53+
uses: actions/checkout@v6
5454
with:
5555
ref: ${{ inputs.application_tag && inputs.application_tag != 'latest' && inputs.application_tag || '' }}
5656

@@ -61,7 +61,7 @@ jobs:
6161

6262
- name: "Cache asdf tools"
6363
id: asdf-cache
64-
uses: actions/cache@v4
64+
uses: actions/cache@v5
6565
with:
6666
path: ~/.asdf
6767
key: asdf-${{ runner.os }}-${{ hashFiles('.tool-versions') }}
@@ -97,7 +97,7 @@ jobs:
9797
working-directory: ${{ steps.get-directories.outputs.working_directory }}
9898

9999
- name: "Publish artefacts to GitHub"
100-
uses: actions/upload-artifact@v5
100+
uses: actions/upload-artifact@v6
101101
env:
102102
ENVIRONMENT: ${{ inputs.environment }}
103103
with:

.github/workflows/deploy-infrastructure.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
environment: ${{ inputs.environment }}
9292

9393
- name: "Download Terraform Plan Artifact"
94-
uses: actions/download-artifact@v6
94+
uses: actions/download-artifact@v7
9595
if: ${{ inputs.action == 'apply' }}
9696
with:
9797
name: ${{ matrix.stack }}_terraform_plan_${{ inputs.account_type }}_${{ inputs.environment }}
@@ -112,7 +112,7 @@ jobs:
112112
mgmt_account_id: ${{ secrets.MGMT_ACCOUNT_ID }}
113113

114114
- name: "Upload Terraform Plan Artifact"
115-
uses: actions/upload-artifact@v5
115+
uses: actions/upload-artifact@v6
116116
if: ${{ inputs.action == 'plan' }}
117117
with:
118118
name: ${{ matrix.stack }}_terraform_plan_${{ inputs.account_type }}_${{ inputs.environment }}

0 commit comments

Comments
 (0)