Skip to content

Conversation

@jackhodgkiss
Copy link
Collaborator

@jackhodgkiss jackhodgkiss commented Sep 28, 2023

This PR sees the introduction for multiple environment support when generating workflows. This will enable the workflows to operate from a single kayobe-config and serve multiple environments/clouds.

The current suppport for multiple environments is strictly kayobe based whereby the environments are defined within etc/kayobe/environments.

All workflows support multiple environments. Generic workflows and Tempest will allow for the user to select the environment as input. Building the kayobe image and config diff however will utilise matrix to operate within all environments simulatenously.

For multiple environments to work in deployments where GitHub Environments are not available all variable/secrets will be accessed via the environment prefix for example PRODUCTION_KAYOBE_VAULT_PASSWORD all variables must have an environment specific key even if the values are the same between environments.

Tempest has also been updated to drop the need for kayobe bootstrap which was done to provide the workflow with a copy of public_openrc.sh. With removal of this step all deployments must ensure they are TEMPEST_OPENRC secret present within the repository.

Finally, the workflow to test the role has been updated to include support for both single and multiple environment configs. Test Github Role contains two artifacts one for each type of config.

WARNING: this also carries a change to remove the bootstrap prior to
tempest running. This has been done to reduce the time taken to start
and finish a tempest run. This will require a copy of `public_openrc.sh`
to GitHub secrets.
Role was failing if the user had not expanded `github_runs_on` to
contain multiple entries in list. This is because the default value was
a string which cannot be concatenated with a list.

Fix: set `github_runs_on` to a list by default.
@jackhodgkiss jackhodgkiss marked this pull request as ready for review September 28, 2023 12:29
@jackhodgkiss jackhodgkiss requested a review from a team as a code owner September 28, 2023 12:29
The variable in `github_default_kayobe_arguments` served no purpose as users most likely want to provide their own environment name.
The `setup-buildx` step within the workflow has been known to cause
issue when pushing images to Pulp registry < `3.32.0`.

There was a concern surrounding the lack of buildx step potentially
leading to a situation where the kayobe-config remains inside the image.
However, this does not appear to be the case.
Identified in `ansible-core < 2.15` nested vars will not be evaluated
within templates that are loaded via `extends` or `includes`. The
solution involves using `lookup('template', ...)` to ensure support
dating back to `2.12`. Unfortunately `lookup` does not have access to
the macro defined in `workflows.yml` nor does it inherit the
`block_*_string` and `variable_*_string` from the
`ansible.builtin.template` module as defined within `tasks/main.yml`.
Also `lookup` does not support setting `block_*_string``

NOTE: this is not ideal due to the duplication and the changing of
block/variable markers. Whilst low priority should be improved/replaced
in the future.
Co-authored-by: Mark Goddard <mark@stackhpc.com>
@jackhodgkiss jackhodgkiss merged commit d444661 into main Oct 25, 2023
@jackhodgkiss jackhodgkiss deleted the github-multiple-environment-support branch October 25, 2023 12:09
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.

3 participants