Skip to content
Open
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
98 changes: 49 additions & 49 deletions azure/templates/post-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,55 +35,55 @@ steps:
profile: "apim-dev"
aws_account: "dev"

- bash: |
set -e
if ! [[ $APIGEE_ENVIRONMENT =~ .*-*sandbox ]]; then
export AWS_PROFILE=apim-dev
aws_account_no="$(aws sts get-caller-identity --query Account --output text)"

service_name=$(FULLY_QUALIFIED_SERVICE_NAME)

introspection_client_id=$(INTROSPECTION_CLIENT_ID)
introspection_client_secret=$(INTROSPECTION_CLIENT_SECRET)
if [[ $APIGEE_ENVIRONMENT = int ]]; then
introspection_client_id=$(INTROSPECTION_CLIENT_ID_INT)
introspection_client_secret=$(INTROSPECTION_CLIENT_SECRET_INT)
fi

pr_no=$(echo $service_name | { grep -oE '[0-9]+$' || true; })
if [ -z $pr_no ]; then
workspace=$APIGEE_ENVIRONMENT
else
workspace=pr-$pr_no
fi

echo Deploy mock provider with following parameters:
echo service_name: $service_name
echo workspace: $workspace
echo Apigee environment: $APIGEE_ENVIRONMENT
echo pr_no: $pr_no
echo introspection client id: $introspection_client_id

cd terraform

make init
make apply aws_account_no=${aws_account_no} environment=$workspace \
client_id=$introspection_client_id \
client_secret=$introspection_client_secret \
keycloak_environment=$APIGEE_ENVIRONMENT
cd ..

if [ -n "$pr_no" ]; then
echo add KVM for PR-$pr_no
source .venv/bin/activate
domain_name=https://$(make -C terraform -s output name=service_domain_name)
oauth_endpoint="https://identity.ptl.api.platform.nhs.uk/realms/gpconnect-pfs-mock-$APIGEE_ENVIRONMENT/protocol/openid-connect/token"
python scripts/apigee_kvm.py --env $APIGEE_ENVIRONMENT --access-token $(secret.AccessToken) populate-interaction-ids gp-connect-user-permissions-endpoints-pr-$pr_no --ods H81109 --provider-endpoint $domain_name --oauth-endpoint $oauth_endpoint
fi
fi
displayName: Deploy mock provider
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)"
retryCountOnTaskFailure: 2
#- bash: |
# set -e
# if ! [[ $APIGEE_ENVIRONMENT =~ .*-*sandbox ]]; then
# export AWS_PROFILE=apim-dev
# aws_account_no="$(aws sts get-caller-identity --query Account --output text)"

# service_name=$(FULLY_QUALIFIED_SERVICE_NAME)

# introspection_client_id=$(INTROSPECTION_CLIENT_ID)
# introspection_client_secret=$(INTROSPECTION_CLIENT_SECRET)
# if [[ $APIGEE_ENVIRONMENT = int ]]; then
# introspection_client_id=$(INTROSPECTION_CLIENT_ID_INT)
# introspection_client_secret=$(INTROSPECTION_CLIENT_SECRET_INT)
# fi

# pr_no=$(echo $service_name | { grep -oE '[0-9]+$' || true; })
# if [ -z $pr_no ]; then
# workspace=$APIGEE_ENVIRONMENT
# else
# workspace=pr-$pr_no
# fi

# echo Deploy mock provider with following parameters:
# echo service_name: $service_name
# echo workspace: $workspace
# echo Apigee environment: $APIGEE_ENVIRONMENT
# echo pr_no: $pr_no
# echo introspection client id: $introspection_client_id

# cd terraform

# make init
# make apply aws_account_no=${aws_account_no} environment=$workspace \
# client_id=$introspection_client_id \
# client_secret=$introspection_client_secret \
# keycloak_environment=$APIGEE_ENVIRONMENT
# cd ..

# if [ -n "$pr_no" ]; then
# echo add KVM for PR-$pr_no
# source .venv/bin/activate
# domain_name=https://$(make -C terraform -s output name=service_domain_name)
# oauth_endpoint="https://identity.ptl.api.platform.nhs.uk/realms/gpconnect-pfs-mock-$APIGEE_ENVIRONMENT/protocol/openid-connect/token"
# python scripts/apigee_kvm.py --env $APIGEE_ENVIRONMENT --access-token $(secret.AccessToken) populate-interaction-ids gp-connect-user-permissions-endpoints-pr-$pr_no --ods H81109 --provider-endpoint $domain_name --oauth-endpoint $oauth_endpoint
# fi
# fi
# displayName: Deploy mock provider
# workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)"
# retryCountOnTaskFailure: 2

- bash: |
set -e
Expand Down
Loading
Loading