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

chore: setup staging GOV_UK_PAY_TOKEN_GLOUCESTER #2706

Merged
merged 4 commits into from
Jan 26, 2024

Conversation

Mike-Heneghan
Copy link
Contributor

@Mike-Heneghan Mike-Heneghan commented Jan 26, 2024

What:

  • Add GOV_UK_PAY_TOKEN_GLOUCESTER to pulumi staging stack
  • Update .env.example and server.ts accordingly.
  • Locally pull pizza-secrets, add GOV_UK_PAY_TOKEN_GLOUCESTER to .env and push pizza-secrets to allow sandbox gov uk pay to work on pizzas
  • Add Medway and Gloucester to teams to allow gov pay uk to work on staging
  • Refactor generateTeamSecrets to only generate Medway and Gloucester secrets on staging to avoid errors on prod

Why:

  • Gloucester have shared their sandbox gov up pay api key
  • We want this to be wired up on staging to allow testing
  • When pairing with @DafyddLlyr realised that Medway and Gloucester need to be added to teams.ts to allow the key to work on staging: https://editor.planx.dev/medway/gov-pay-staging-test/preview?analytics=false
  • This change would cause errors on prod as Medway and Gloucester don't have prod gov up pay api keys
  • Refactor of generateTeamSecrets to handle the difference in staging/prod creds

Testing:

  • Gov Pay works on pizza for Gloucester: https://2706.planx.pizza/gloucester/gov-pay-pizza-test/preview?analytics=false
  • Gov Pay works on staging for Medway and Gloucester (post merge)
  • Gov Pay work on prod for Buckinghamshire, Lambeth and Southwark but not Medway and Gloucester (post merge)
    • Tested that on prod Gloucester and Medway gov uk pay component gave warning that it wasn't setup
    • Tested that Lambeth gov uk pay component could be used via the "pay-test" flow that the goc uk pay site was successfully loaded.

Follow up PR

Copy link

github-actions bot commented Jan 26, 2024

Removed vultr server and associated DNS entries

@Mike-Heneghan Mike-Heneghan marked this pull request as draft January 26, 2024 12:41
@Mike-Heneghan Mike-Heneghan self-assigned this Jan 26, 2024
- This will allow the credentials for Medway and Gloucester to be read on staging and production
- As there won't be credentials on prod this will break
… environment

- Add optional key of stagingOnly
- Add guard clause in generateSecrets to skip Medway and Gloucester secret generation in production
@Mike-Heneghan Mike-Heneghan marked this pull request as ready for review January 26, 2024 13:26
@Mike-Heneghan Mike-Heneghan requested a review from a team January 26, 2024 13:26
@@ -25,6 +25,7 @@ export const generateTeamSecrets = (
): awsx.ecs.KeyValuePair[] => {
const secrets: awsx.ecs.KeyValuePair[] = [];
teams.forEach((team) => {
if (env === "production" && team?.stagingOnly) return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment:

I think this is a simple change and should work although I guess we can't test it until it's on staging/prod?

Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

One small suggestion!

@@ -14,6 +14,7 @@ interface Team {
name: string;
// Must match "name" in the Digital Land dataset "local-authority-district" (https://www.planning.data.gov.uk/dataset/local-authority-district)
uniformInstances?: string[];
stagingOnly?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: To be totally explicit here we should link this to GovPay, e.g. govPayStagingOnly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did consider this although I think as it's at a top level it would skip all secret generation on prod? Although we're only using it at the pay level it's not specific to gov pay?

I'm happy to go with that though as I guess it does better match how we're using it right now?

Copy link
Contributor Author

@Mike-Heneghan Mike-Heneghan Jan 26, 2024

Choose a reason for hiding this comment

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

I think I maybe misunderstood your suggestion, I'll refactor to put it inline with the uniformInstances pattern 👍

Added here: 55fff27

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect!

- Rename from stagingOnly to govPayStagingOnly to be more specific
- Rather than a general guard clause specifically only add govPay secret if either sandbox or staging
@Mike-Heneghan Mike-Heneghan merged commit 2bc7b7b into main Jan 26, 2024
12 checks passed
@Mike-Heneghan Mike-Heneghan deleted the mh/gloucester-gov-pay-staging-key branch January 29, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants