Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXUI-266: Configure github action to update preview deployment id #3230

Merged
merged 50 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c967db0
EXUI-266: Initial commit of HMC required changes
Aug 17, 2023
f7077eb
EXUI-266: Configure github action to update preview deployment id
Aug 17, 2023
d2fe453
Merge branch 'master' into EXUI-266
tomxelliott Aug 17, 2023
36b51ea
EXUI-266: Clean up github action script
Aug 17, 2023
42c559c
Merge branch 'EXUI-266' of github.com:hmcts/rpx-xui-webapp into EXUI-266
Aug 17, 2023
b762593
EXUI-266: Create shell script to alter value in preview values yaml
Aug 18, 2023
55295d6
EXUI-266: Update folder the script is pointed to
Aug 18, 2023
e3e3e00
EXUI-266: Remove chmod for testing purposes
Aug 18, 2023
79124ff
EXUI-266: Tweak script
Aug 18, 2023
570c6c0
EXUI-266: Update to github action after local testing
Aug 21, 2023
d764afb
EXUI-266: Resolve typo with unterminated sed command
Aug 21, 2023
0d52000
EXUI-266: Change working directory for the running of sed script in a…
Aug 21, 2023
642ce54
EXUI-266: Add extra bash commands for testing
Aug 21, 2023
f7dd9cc
EXUI-266: Add further commands for testing
Aug 21, 2023
fcb86bc
EXUI-266: Tweak sed command so that it works on Linux vm
Aug 21, 2023
8942ff7
EXUI-266: Alter bash script in action
Aug 21, 2023
acc1764
EXUI-266: Add user name and email
Aug 21, 2023
4f2e8f0
EXUI-266: Add extra commands for testing
Aug 21, 2023
eb52561
EXUI-266: Alter action to use auto commit
Aug 21, 2023
225f88b
EXUI-266: Add git commit to script
Aug 21, 2023
14b611b
EXUI-266: Add -e flag to sed command
Aug 21, 2023
79ec34c
EXUI-266: Add extra commands for debugging
Aug 21, 2023
70788bf
Trigger build
Aug 21, 2023
6dbf166
EXUI-266: Update action to remove reference to using master branch
Aug 21, 2023
1d09689
EXUI-266: Add debugging
Aug 21, 2023
aef2ce7
EXUI-266: Remove branch reference to master on checkout
Aug 21, 2023
edd2048
EXUI-266: Push to head of branch
Aug 21, 2023
4e93ca4
EXUI-266: Use auto commit
Aug 21, 2023
126cfbc
EXUI-266: Give githubv actions write permissions
Aug 21, 2023
6277771
EXUI-266: move permissions
Aug 21, 2023
21f9e7e
EXUI-266: Verify token being generated
Aug 21, 2023
78b8b44
EXUI-266: Remove debug log
Aug 21, 2023
05cc46d
EXUI-266: Use bash script instead of auto commit
Aug 21, 2023
3843bd8
EXUI-266: Push to origin head
Aug 21, 2023
659d356
EXUI-266: Revert back
Aug 21, 2023
8bc34ed
refs/pull/3230/merge: Setting Preview Deployment ID
tomxelliott Aug 21, 2023
d6c2e8d
EXUI-266: Fix commit message ref
Aug 21, 2023
1f29525
EXUI-266: Clear deployment id for testing purposes
Aug 21, 2023
35c4f75
3230/merge: Setting Preview Deployment ID
tomxelliott Aug 21, 2023
660269f
EXUI-266: Resolve commit message base_ref
Aug 21, 2023
ac7ad62
master: Setting Preview Deployment ID
tomxelliott Aug 21, 2023
8f1d8ee
EXUI-266: Use ref
Aug 21, 2023
b814acd
refs/pull/3230/merge: Setting Preview Deployment ID
tomxelliott Aug 21, 2023
3fdb451
EXUI-266: Use GITHUB_HEAD_REF
Aug 21, 2023
8e12224
${GITHUB_HEAD_REF}: Setting Preview Deployment ID
tomxelliott Aug 21, 2023
b135768
EXUI-266: Use head ref for commit prefix
Aug 21, 2023
d43059e
EXUI-266: Setting Preview Deployment ID
tomxelliott Aug 21, 2023
fd3cfad
EXUI-266: Update deployment id reference in index.ts
Aug 21, 2023
8666cb8
EXUI-266: Add logging for testing purposes (to be removed once testin…
Aug 22, 2023
7b5c500
EXUI-266: Remove logging after testing is completed
Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/populate-preview-deployment-id.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Populate Preview Deployment ID

on:
pull_request:
branches:
- master

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.HMCTS_GITHUB_EXUI_APP_ID }}
private_key: ${{ secrets.HMCTS_GITHUB_EXUI_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Populate preview deployment ID
run: |
sed -i 's/PREVIEW_DEPLOYMENT_ID:.*/PREVIEW_DEPLOYMENT_ID: exui-preview-deployment-${{ github.event.number }}/' charts/xui-webapp/values.preview.template.yaml
tomxelliott marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "${{ github.event.pull_request.head.ref }}: Setting Preview Deployment ID"
4 changes: 4 additions & 0 deletions api/lib/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import axios, { AxiosInstance } from 'axios';
import { errorInterceptor, requestInterceptor, successInterceptor } from '../interceptors';

export const http: AxiosInstance = axios.create({});
const deploymentId: string = process.env.DEPLOYMENT_ID;

if (deploymentId) {
axios.defaults.headers.common['hmcts-deployment-id'] = deploymentId;
}
axios.defaults.headers.common['Content-Type'] = 'application/json';
http.interceptors.request.use(requestInterceptor);
http.interceptors.response.use(successInterceptor, errorInterceptor);
1 change: 1 addition & 0 deletions charts/xui-webapp/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ nodejs:
SERVICES_CASE_JUDICIAL_API: http://rd-judicial-api-aat.service.core-compute-aat.internal
SERVICES_LOCATION_REF_API_URL: http://rd-location-ref-api-aat.service.core-compute-aat.internal
FEATURE_ACCESS_MANAGEMENT_ENABLED: true
PREVIEW_DEPLOYMENT_ID: exui-preview-deployment-3230
keyVaults:
rpx:
secrets:
Expand Down