Skip to content

CPP-2497 Support setting custom Hako environments in containerised-app plugins #936

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 4 commits into
base: main
Choose a base branch
from

Conversation

ivomurrell
Copy link
Contributor

Description

This allows flexibility for when apps want to deploy to custom environments.

We drop the old multiregion option as part of this change as it can now be better expressed by setting the hakoProductionEnvironments option, rather than carving out a special case for the ft-com environments. We could have preserved backwards-compatibility with this change – or even continued supporting the option – but it feels better to rip the bandage off now whilst not many apps have it set and to encourage one way of defining multiple environments.

Closes #892.

Checklist:

  • My branch has been rebased onto the latest commit on main (don't merge main into your branch)
  • My commit messages are conventional commits, for example: feat(circleci): add support for nightly workflows, fix: set Heroku app name for staging apps too

This allows flexibility for when apps want to deploy to custom
environments.

We drop the old `multiregion` option as part of this change as it can
now be better expressed by setting the `hakoProductionEnvironments`
option, rather than carving out a special case for the ft-com
environments. We could have preserved backwards-compatibility with this
change – or even continued supporting the option – but it feels better
to rip the bandage off now whilst not many apps have it set and to
encourage one way of defining multiple environments.
@ivomurrell ivomurrell requested a review from a team May 16, 2025 16:51
Copy link
Member

@rowanmanning rowanmanning left a comment

Choose a reason for hiding this comment

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

The stuff in the containerised app plugins looks good to me and this is a great improvement. The rest of the stuff makes sense but I'm not super familiar with these internals so you may also want Kara to take a look?

Copy link
Contributor

@olusoladavid olusoladavid left a comment

Choose a reason for hiding this comment

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

Great and thoughtful implementation! Added some thoughts. Thank you

@@ -21,6 +21,7 @@
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking: should we use an exact pinned version of this package? Given that it has not been maintained in a while and only has one author. Just to reduce our supply chain attack surface (thankfully it has no deps at the moment)

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 don't think that's necessary for a dev dependency. If a security bug is found in the package presumably it would be easier to update if the version isn't pinned?

@@ -5,13 +5,16 @@ import * as fs from 'node:fs/promises'
import type { Valid } from '@dotcom-tool-kit/validated'
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: should we also add a test for substituting non-string values?

environments:
- ft-com-prod-eu
- ft-com-prod-us
environments: !toolkit/option '@dotcom-tool-kit/containerised-app.hakoProductionEnvironments'
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Do we need to have a discussion around how and where we store this environment config? It's currently hardcoded in the Hako plugin but since we are now allowing free user input, I think it would make sense to have a place to store them independently of plugin code changes. Also, I expect eng users would naturally not know what values are supported and from what I can see atm, we are not doing much error-handling in the Hako deploy task for bad user input

Copy link
Member

Choose a reason for hiding this comment

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

I'd be tempted to leave this for now as the list of environments is likely to change a lot. We don't have a specific error for a nonexistent environment but the hako command will error with a descriptive message that says the environment doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aha this might be tangential to the original question but this highlighted to me that we'll still get errors if we pass alternative environments to the containerised-app plugin as the HakoDeploy task will fail to validate them. i'll update the HakoDeploy schema in a separate revision to allow any string (or something similar that will still allow the rest of the mapping logic to work.)

back to the original point, what kind of environment config are you thinking of here, Shola?

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.

Support configurable environments in containerised-app plugins
3 participants