Skip to content

PYIC-7872: Add AppConfigService #3117

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

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
09d671f
Revert "Revert "PYIC-7872: Add AppConfigService""
MikeCollingwood Feb 24, 2025
6503503
PYIC-7872: Use AWS powertools version of AppConfigProvider now it is …
MikeCollingwood Apr 10, 2025
48e4d9c
PYIC-7872: Update appConfigProvider definition to use getAppConfigPro…
MikeCollingwood Apr 10, 2025
2ac3422
PYIC-7872: Update CONFIG_SOURCE tp app-config
MikeCollingwood Apr 10, 2025
947af71
PYIC-7872: Update APP_CONFIG variable setting
MikeCollingwood Apr 10, 2025
d67ed3e
PYIC-7872: Hardcode profile id
MikeCollingwood Apr 10, 2025
b718244
PYIC-7872: Hardcode appconfig app & environment id
MikeCollingwood Apr 11, 2025
e89306b
PYIC-7872: Add debugging logging
MikeCollingwood Apr 11, 2025
28981fd
PYIC-7872: Add config to run API tests against dev01
MikeCollingwood Apr 11, 2025
691989f
PYIC-7872: Update api test workflow for dev
MikeCollingwood Apr 15, 2025
558b2d9
PYIC-7872: Lint fix Build, tag, push, and sign api testing image to b…
MikeCollingwood Apr 15, 2025
d2eb321
PYIC-7872: Update build-test-images-if-needed to pass through the env…
MikeCollingwood Apr 15, 2025
514f0d3
PYIC-7872: Update api tests to use environment passed to it
MikeCollingwood Apr 15, 2025
aee0c6e
PYIC-7872: Add temporary logging to getIdentity for debugging API tes…
MikeCollingwood Apr 17, 2025
4cc0425
PYIC-7872: Add temporary logging to getIdentity for debugging API tes…
MikeCollingwood Apr 17, 2025
9bfdb1f
PYIC-7872: Fix temporary logging to getIdentity for debugging API tes…
MikeCollingwood Apr 17, 2025
8157994
Merge remote-tracking branch 'origin/main' into pyic-7872
MikeCollingwood Apr 17, 2025
c0e3367
PYIC-7872: Remove temporary logging
MikeCollingwood Apr 17, 2025
308cc36
Merge branch 'main' into pyic-7872
MikeCollingwood Apr 17, 2025
87739a7
PYIC-7872: Update CORE_BACK_INTERNAL_API_URL to use https://
MikeCollingwood Apr 17, 2025
9d9d3a7
PYIC-7872: Add temporary logging
MikeCollingwood Apr 17, 2025
e680c4a
PYIC-7872: Remove breaking temporary logging
MikeCollingwood Apr 17, 2025
b003d0f
PYIC-7872: Add KEY literal to .env.dev01
MikeCollingwood Apr 22, 2025
76793f5
PYIC-7872: Remove .env manipulation
MikeCollingwood Apr 22, 2025
b489a74
Merge branch 'main' into pyic-7872
MikeCollingwood Apr 30, 2025
a239042
Merge branch 'main' into pyic-7872
MikeCollingwood Apr 30, 2025
2dde2c9
PYIC-7872: Refactor api-tests/run-tests.sh
MikeCollingwood May 1, 2025
05460fe
PYIC-7872: Fix secure-post-merge.yml to reference main
MikeCollingwood May 1, 2025
d49df54
Merge branch 'main' into pyic-7872
MikeCollingwood May 1, 2025
bb69391
PYIC-7872: Fix secure-post-merge.yml to reference current branch
MikeCollingwood May 1, 2025
df86363
PYIC-7872: Revert secure-post-merge.yml changes
MikeCollingwood May 1, 2025
40ab496
PYIC-7872: Revert secure-post-merge.yml refactor
MikeCollingwood May 1, 2025
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
12 changes: 9 additions & 3 deletions .github/workflows/secure-pipeline-api-tests-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ name: Build api-tests image

on:
workflow_call:
inputs:
environment:
required: true
type: string

jobs:
build-image-and-push:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
ENVIRONMENT: ${{ inputs.environment }}
permissions:
id-token: write
packages: read
Expand All @@ -23,7 +29,7 @@ jobs:
- name: Set up build AWS creds
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.BUILD_API_TESTS_IMAGE_ECR_REPO_GHA_ROLE_ARN }}
role-to-assume: ${{ env.ENVIRONMENT == 'build' && secrets.BUILD_API_TESTS_IMAGE_ECR_REPO_GHA_ROLE_ARN || secrets.BUILD_API_TESTS_IMAGE_ECR_REPO_GHA_ROLE_ARN_DEV }}
aws-region: eu-west-2

- name: Login to build ECR
Expand All @@ -33,9 +39,9 @@ jobs:
- name: Build, tag, push, and sign api testing image to build
env:
BUILD_ECR_REG: ${{ steps.login-build-ecr.outputs.registry }}
BUILD_API_TESTS_ECR_REPO: ${{ secrets.BUILD_API_TESTS_IMAGE_ECR_REPO_NAME }}
BUILD_API_TESTS_ECR_REPO: ${{ env.ENVIRONMENT == 'build' && secrets.BUILD_API_TESTS_IMAGE_ECR_REPO_NAME || secrets.BUILD_API_TESTS_IMAGE_ECR_REPO_NAME_DEV }}
SHA: ${{ github.sha }}
BUILD_CONTAINER_SIGN_KMS_KEY: ${{ secrets.CONTAINER_SIGN_KMS_KEY }}
BUILD_CONTAINER_SIGN_KMS_KEY: ${{ env.ENVIRONMENT == 'build' && secrets.CONTAINER_SIGN_KMS_KEY || secrets.CONTAINER_SIGN_KMS_KEY_DEV }}
run: |
docker build --build-arg GITHUB_PAT="${{ secrets.GITHUB_TOKEN }}" \
-t "${BUILD_ECR_REG}/${BUILD_API_TESTS_ECR_REPO}:latest" \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/secure-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ jobs:
build-test-images-if-needed:
needs: check-if-api-tests-changed
if: ${{ needs.check-if-api-tests-changed.outputs.api-tests-changed == 'true' }}
uses: govuk-one-login/ipv-core-back/.github/workflows/secure-pipeline-api-tests-image.yml@main
uses: govuk-one-login/ipv-core-back/.github/workflows/secure-pipeline-api-tests-image.yml@pyic-7872
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change this main before merging

with:
environment: ${{ github.event_name == 'workflow_dispatch' && 'dev01' || 'build' }}
secrets: inherit # pragma: allowlist secret
permissions:
id-token: write
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ api-tests/.env*
!api-tests/.env.template
!api-tests/.env.dev.template
!api-tests/.env.local
!api-tests/.env.dev01
!api-tests/.env.build
2 changes: 1 addition & 1 deletion api-tests/.env.dev.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Build env config
# Dev env config
CORE_BACK_COMPONENT_ID="https://dev-danc.02.dev.identity.account.gov.uk"
CORE_BACK_INTERNAL_API_URL="https://internal-test-api-dev-danc.02.dev.identity.account.gov.uk"
CORE_BACK_EXTERNAL_API_URL="https://api-dev-danc.02.dev.identity.account.gov.uk"
Expand Down
23 changes: 23 additions & 0 deletions api-tests/.env.dev01
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dev01 env config
CORE_BACK_COMPONENT_ID="https://dev.01.dev.identity.account.gov.uk"
CORE_BACK_INTERNAL_API_URL="https://internal-test-api-dev.01.dev.identity.account.gov.uk"
CORE_BACK_INTERNAL_API_KEY=${CORE_BACK_INTERNAL_API_KEY}-dev
CORE_BACK_EXTERNAL_API_URL="https://api-dev.01.dev.identity.account.gov.uk"
CORE_BACK_CRI_CLIENT_ID="ipv-core-dev"
ORCHESTRATOR_REDIRECT_URL="https://orch.stubs.account.gov.uk/callback"
# The below private key is a test key that is already in the public domain. It is not used for anything sensitive.
JAR_SIGNING_KEY='{"kty":"EC","d":"OXt0P05ZsQcK7eYusgIPsqZdaBCIJiW4imwUtnaAthU","crv":"P-256","x":"E9ZzuOoqcVU4pVB9rpmTzezjyOPRlOmPGJHKi8RSlIM","y":"KlTMZthHZUkYz5AleTQ8jff0TJiS3q2OB9L5Fw4xA04", "kid":"orch-signing-stubs-prod-FI4xysvMVdRtkt6xmO5gqcaTF4Tf9NKD1zdg3T8y69M"}' # pragma: allowlist secret
ASYNC_QUEUE_NAME="stubQueue_criResponseQueue_dev"
ASYNC_QUEUE_DELAY=5
EVCS_STUB_BASE_URL="https://evcs.stubs.account.gov.uk"
TICF_STUB_BASE_URL="https://ticf.stubs.account.gov.uk"
CIMIT_INTERNAL_API_URL="https://cimit-api.stubs.account.gov.uk"
CIMIT_STUB_BASE_URL="https://cimit.stubs.account.gov.uk"

# Also requires the following to be specified in .env or as an env variable
# CORE_BACK_INTERNAL_API_KEY
# CRI_STUB_GEN_CRED_API_KEY
# EVCS_STUB_API_KEY
# MANAGEMENT_TICF_API_KEY
# MANAGEMENT_CIMIT_STUB_API_KEY
# CIMIT_INTERNAL_API_KEY
6 changes: 3 additions & 3 deletions api-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"test": "cucumber-js",
"test:dev": "CORE_ENV=dev cucumber-js",
"test:dev01": "CORE_ENV=dev01 cucumber-js",
"test:build": "CORE_ENV=build cucumber-js --tags '@Build'",
"test:local": "CORE_ENV=local cucumber-js",
"test:ci": "start-server-and-test run-local-core-back 'http://localhost:4502' test:local",
Expand Down
16 changes: 11 additions & 5 deletions api-tests/secure-pipeline/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ get_current_status() {
generate_traffic() {
while true; do
echo "Running @TrafficGeneration tests"
npm run test:build -- --profile trafficGeneration --tags '@TrafficGeneration' || true
npm run test:"$TEST_ENV" -- --profile trafficGeneration --tags '@TrafficGeneration' || true
done
}

# Ensure the test report dir exists
[ -e "$TEST_REPORT_ABSOLUTE_DIR" ] && mkdir -p "$TEST_REPORT_ABSOLUTE_DIR"

ENVIRONMENT_SECRET=$(aws secretsmanager get-secret-value --secret-id ApiTestEnvironment | jq -r .SecretString)
if echo "$ENVIRONMENT_SECRET" | grep -qi "dev01"; then
TEST_ENV="dev01"
else
TEST_ENV="build"
fi

CORE_BACK_INTERNAL_API_KEY=$(aws secretsmanager get-secret-value --secret-id CoreBackInternalTestingApiKey | jq -r .SecretString)
export CORE_BACK_INTERNAL_API_KEY

Expand Down Expand Up @@ -60,14 +67,13 @@ if [[ "${DEV_PLATFORM_STAGE}" == "TRAFFIC_TEST" ]]; then
exit 0

else
echo "Running API tests against the build environment"
npm run test:build -- --profile codepipeline
echo "Running API tests against the $TEST_ENV environment"
npm run test:"$TEST_ENV" -- --profile codepipeline

api_tests_exit_code=$?
cp reports/api-tests-cucumber-report.json "$TEST_REPORT_ABSOLUTE_DIR"

if [ $api_tests_exit_code != 0 ]
then
if [ $api_tests_exit_code != 0 ]; then
echo "API tests failed with exit code ${api_tests_exit_code}"
exit $api_tests_exit_code
else
Expand Down
Loading