Skip to content

feat(manifest): Loaded manifest includes all environment and group names #1897

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

Conversation

arthurpitman
Copy link
Contributor

@arthurpitman arthurpitman commented May 15, 2025

Why this PR?

This PR is an alternative to #1876 and this time adds all environment and environment group names seen during loading directly to the manifest data structure.

This PR is more robust because manifest.Environments.SelectedEnvironments is identical to the current manifest.Environments, meaning it avoids the effort of having to explicitly deal with Skip. However, a lot of effort had to be invested in updating the tests.

What has changed?

The Environments field of manifest.Manifest is now a struct of type manifest.Environments that holds selected environments as well as the names of all environments and environment groups seen during loading. This extra information will be used #1880 to emit a warning if an undefined environment or group is referenced.

How does it do it?

The PR does some renaming and then simply adds the new type and updates tests. The actual change to production code is pretty small.

Best reviewed commit by commit.

How is it tested?

Existing tests are updated to include the new data structure, which holds information about the names of all environments and environment groups.

How does it affect users?

No effect on users.

@arthurpitman arthurpitman added the run-e2e-test Manually trigger the E2E tests for reviewed PRs label May 15, 2025
Copy link

E2E Test Results

    3 files  ±0    263 suites  ±0   25m 55s ⏱️ + 4m 36s
2 180 tests ±0  2 178 ✅ +1  2 💤 ±0  0 ❌  - 1 
2 411 runs  ±0  2 409 ✅ +1  2 💤 ±0  0 ❌  - 1 

Results for commit f52f757. ± Comparison against base commit d7b2a5d.

errs = append(errs, manifestErrors...)
} else if len(environmentDefinitions) == 0 {
} else if len(environments.AllEnvironmentNames) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is the only behavior change, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this new data structure, I think this is the most robust way to test for this condition.

@arthurpitman arthurpitman force-pushed the feat/loaded-manifest-includes-all-environment-and-group-names branch from f52f757 to f802337 Compare May 20, 2025 10:32
…yName`

`Environments` is not a great name doesn't add value compared to `map[string]EnvironmentDefinition`, but allows us to define `(e EnvironmentDefinitionsByName) Names()`.

In most cases, this method also brings no value, as iterating over the map gives us the names anyway. But it simplifies some tests, as then no actual `EnvironmentDefinition` objects are required.

By renaming, we can reuse the name `Environments` in the next commit.
…ectedEnvironments`

This makes it clear what is contained here: the subset of environments from the manifest actually selected for use.
…the manifest

This type includes the selected `EnvironmentDefinitions` as well as the names of all environments and groups.
@arthurpitman arthurpitman force-pushed the feat/loaded-manifest-includes-all-environment-and-group-names branch from f802337 to 9d2ce35 Compare May 20, 2025 15:13
@arthurpitman arthurpitman merged commit 784755a into main May 21, 2025
10 checks passed
@arthurpitman arthurpitman deleted the feat/loaded-manifest-includes-all-environment-and-group-names branch May 21, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-e2e-test Manually trigger the E2E tests for reviewed PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants