Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions .github/actions/proxy/configure-proxygen/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@ runs:
proxygen --version

- name: Configure proxygen account details
env:
API_NAME: "${{ inputs.proxygen-api-name }}"
KEY_SECRET: "${{ inputs.proxygen-key-secret }}"
KEY_ID: "${{ inputs.proxygen-key-id }}"
CLIENT_ID: "${{ inputs.proxygen-client-id }}"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
shell: bash
working-directory: proxygen
run: |
cp settings.template.yaml $HOME/.proxygen/settings.yaml
yq eval '.api = "${{ inputs.proxygen-api-name }}"' -i $HOME/.proxygen/settings.yaml
yq eval '.api = env(API_NAME)' -i $HOME/.proxygen/settings.yaml
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

printf "%s" "${{ inputs.proxygen-key-secret }}" > /tmp/proxygen_private_key.pem
printf "%s" "$KEY_SECRET" > /tmp/proxygen_private_key.pem
cp credentials.template.yaml $HOME/.proxygen/credentials.yaml
yq eval '.private_key_path = "/tmp/proxygen_private_key.pem"' -i $HOME/.proxygen/credentials.yaml
yq eval '.key_id = "${{ inputs.proxygen-key-id }}"' -i $HOME/.proxygen/credentials.yaml
yq eval '.client_id = "${{ inputs.proxygen-client-id }}"' -i $HOME/.proxygen/credentials.yaml
yq eval '.key_id = env(KEY_ID)' -i $HOME/.proxygen/credentials.yaml
yq eval '.client_id = env(CLIENT_ID)' -i $HOME/.proxygen/credentials.yaml
14 changes: 12 additions & 2 deletions .github/actions/proxy/deploy-proxy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ inputs:
proxygen-api-name:
description: 'Proxygen API name'
required: true
proxygen-environment:
description: 'Proxygen environment'
required: true

runs:
using: composite
Expand All @@ -36,13 +39,20 @@ runs:
proxygen-api-name: ${{ inputs.proxygen-api-name }}

- name: Inject secrets into openapi.yaml for deploying proxy
env:
TARGET_URL: "${{ inputs.target-url }}"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
MTLS_SECRET_NAME: "${{ inputs.mtls-secret-name }}"
shell: bash
run: |
cat pathology-api/openapi.yaml proxygen/x-nhsd-apim.template.yaml > /tmp/proxy-specification.yaml

yq eval '.x-nhsd-apim.target.url = "${{ inputs.target-url }}" | .x-nhsd-apim.target.security.secret = "${{ inputs.mtls-secret-name }}"' -i /tmp/proxy-specification.yaml
yq eval '.x-nhsd-apim.target.url = env(TARGET_URL) | .x-nhsd-apim.target.security.secret = env(MTLS_SECRET_NAME)' -i /tmp/proxy-specification.yaml

- name: Deploy API proxy
env:
ENVIRONMENT: "${{ inputs.proxygen-environment }}"
BASE_PATH: "${{ inputs.proxy-base-path }}"
shell: bash
run: |
proxygen instance deploy internal-dev ${{ inputs.proxy-base-path }} /tmp/proxy-specification.yaml --no-confirm

proxygen instance deploy "$ENVIRONMENT" "$BASE_PATH" /tmp/proxy-specification.yaml --no-confirm
8 changes: 7 additions & 1 deletion .github/actions/proxy/tear-down-proxy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
proxygen-api-name:
description: 'Proxygen API name'
required: true
proxygen-environment:
description: 'Proxygen environment'
required: true

runs:
using: composite
Expand All @@ -30,6 +33,9 @@ runs:
proxygen-api-name: ${{ inputs.proxygen-api-name }}

- name: Tear down preview API proxy
env:
ENVIRONMENT: "${{ inputs.proxygen-environment }}"
BASE_PATH: "${{ inputs.proxy-base-path }}"
shell: bash
run: |
proxygen instance delete internal-dev ${{ inputs.proxy-base-path }} --no-confirm
proxygen instance delete "$ENVIRONMENT" "$BASE_PATH" --no-confirm
7 changes: 5 additions & 2 deletions .github/actions/run-test-suite/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ runs:
env:
APIGEE_ACCESS_TOKEN: ${{ inputs.apigee-access-token }}
ENV: ${{ inputs.env }}
TEST_TYPE: ${{ inputs.test-type }}
run: |
if [[ -n "${APIGEE_ACCESS_TOKEN}" ]]; then
echo "::add-mask::${APIGEE_ACCESS_TOKEN}"
fi
make test-${{ inputs.test-type }}
make test-${TEST_TYPE}

- name: "Upload ${{ inputs.test-type }} test results"
if: always()
Expand All @@ -44,8 +45,10 @@ runs:
id: check
if: always()
shell: bash
env:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
TEST_TYPE: ${{ inputs.test-type }}
run: |
if [[ -f "pathology-api/test-artefacts/${{ inputs.test-type }}-tests.xml" ]]; then
if [[ -f "pathology-api/test-artefacts/${TEST_TYPE}-tests.xml" ]]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
Expand Down
5 changes: 3 additions & 2 deletions .github/actions/start-local-lambda/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ runs:
shell: bash
env:
PYTHON_VERSION: ${{ inputs.python-version }}
DEPLOY_COMMAND: ${{ inputs.deploy-command }}
run: |
set -euo pipefail
echo "Starting local Lambda: '${{ inputs.deploy-command }}'"
bash -c "${{ inputs.deploy-command }}"
echo "Starting local Lambda: '$DEPLOY_COMMAND'"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
bash -c "$DEPLOY_COMMAND"
2 changes: 1 addition & 1 deletion .github/workflows/cicd-1-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')}
echo "Current branch is '$branch_name'"
if gh pr list --head $branch_name | grep -q .; then
if gh pr list --head "$branch_name" | grep -q .; then
echo "Pull request exists"
echo "does_pull_request_exist=true" >> $GITHUB_OUTPUT
else
Expand Down
Loading
Loading