Add full support for environment variable expansion in environment.kubernetes.flux_resource_path
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
Currently, the environment:kubernetes:flux_resource_path attribute has no variable expansion capabilities compared to environment:kubernetes:agent and environment:url. This inconsistency may lead to confusion for users and limit the flexibility of namespace configuration in GitLab CI/CD.
Intended users
GitLab users who use Kubernetes integrations in their CI/CD pipelines, especially those who need dynamic namespace configuration.
Further details
As noted in MR !178171 (closed), the environment:kubernetes:agent attribute offers full variable expansion similar to environment:url, while environment:kubernetes:flux_resource_path has no expansion capabilities.
Proposal
Update the environment:kubernetes:flux_resource_path attribute to support full variable expansion, consistent with environment:kubernetes:agent and environment:url. This would include support for:
- All variables defined for a job (project/group variables, variables from
.gitlab-ci.yml, variables from triggers, variables from pipeline schedules) -
CI_ENVIRONMENT_*variables - Persisted variables
What does success look like, and how can we measure that?
Success would be achieved when:
- The
environment:kubernetes:flux_resource_pathattribute supports the same level of variable expansion asenvironment:kubernetes:agentandenvironment:url. - Documentation is updated to reflect this change.
- Users can utilize a wider range of variables when defining Kubernetes namespaces in their CI/CD configurations.
Links / references
- Related MR: !178171 (closed)
- Current documentation: Where variables can be used
Implementation Guide
The Flux resource path is set in UpdateEnvironmentsService. #flux_resource_path can be renamed to #expanded_flux_resource_path, using the same expansion logic used in #expanded_environment_url and #expanded_cluster_agent_path (also in this class).