Skip to content

feat: add gitlab_agent_enabled_deploy variable to control whether GitLab Agent components are deployed #18

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

Merged
merged 2 commits into from
May 18, 2025

Conversation

filippolmt
Copy link
Member

@filippolmt filippolmt commented May 16, 2025

PR Type

Enhancement, Documentation


Description

  • Add gitlab_agent_enabled_deploy variable to control agent deployment

  • Update Helm release to be conditional on new variable

  • Document new variable in README and CHANGELOG

  • Bump default Helm chart version in documentation to 2.13.0


Changes walkthrough 📝

Relevant files
Enhancement
main.tf
Conditional deployment of Helm release based on new variable

main.tf

  • Make Helm release resource conditional on gitlab_agent_enabled_deploy
  • Only deploy agent components if variable is true
  • +1/-0     
    variables.tf
    Add variable to control agent deployment                                 

    variables.tf

  • Add gitlab_agent_enabled_deploy variable definition
  • Set default to true and provide description
  • +5/-0     
    Documentation
    README.md
    Document new deployment control variable and chart version

    README.md

  • Document new gitlab_agent_enabled_deploy variable in inputs table
  • Update default Helm chart version in documentation
  • +2/-1     
    CHANGELOG.md
    Add changelog for agent deployment control variable           

    CHANGELOG.md

    • Add changelog entry for new variable and feature
    +7/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @paolomainardi paolomainardi requested a review from Copilot May 16, 2025 13:48
    Copy link

    @Copilot Copilot AI left a comment

    Choose a reason for hiding this comment

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

    Pull Request Overview

    This PR adds a feature flag to control whether the GitLab Agent Helm release is deployed, updates the default Helm chart version, and records the change in the changelog.

    • Introduce gitlab_agent_enabled_deploy variable to toggle agent deployment
    • Use count on helm_release.this to conditionally create the Helm release
    • Bump default helm_chart_version to 2.13.0 and add a 0.10.0 changelog entry

    Reviewed Changes

    Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

    File Description
    variables.tf Add new gitlab_agent_enabled_deploy boolean variable
    main.tf Apply count to the Helm release resource based on the new flag
    README.md Document the new input and bump helm_chart_version default
    CHANGELOG.md Add release section for version 0.10.0
    Comments suppressed due to low confidence (4)

    variables.tf:6

    • [nitpick] The variable name ordering deviates from the existing pattern (e.g., gitlab_agent_deploy_enabled may read more naturally and sort alphabetically with other inputs).
    variable "gitlab_agent_enabled_deploy" {
    

    main.tf:132

    • Add or update tests (e.g., in a Terraform integration suite) to verify that when gitlab_agent_enabled_deploy is false, the Helm release resource is not created.
    count            = var.gitlab_agent_enabled_deploy ? 1 : 0
    

    README.md:60

    • Consider adding a short usage example showing how to set gitlab_agent_enabled_deploy = false and what resources are created or skipped as a result.
    | <a name="input_gitlab_agent_enabled_deploy"></a> [gitlab_agent_enabled_deploy](#input_gitlab_agent_enabled_deploy) | Whether to deploy the GitLab Agent components. If false, only creates the GitLab Agent token, Kubernetes namespace and secret without deploying the agent itself. | `bool` | `true` | no |
    

    README.md:71

    • Since the default Helm chart version was bumped from 2.11.0 to 2.13.0, add upgrade notes or call out potential breaking changes for users updating the module.
    | <a name="input_helm_chart_version"></a> [helm_chart_version](#input_helm_chart_version) | The version of the gitlab-agent Helm chart. You can see the available versions at https://gitlab.com/gitlab-org/charts/gitlab-agent/-/tags, or using the command `helm search repo gitlab/gitlab-agent -l` after adding the Gitlab Helm repository. | `string` | `"2.13.0"` | no |
    

    @paolomainardi
    Copy link
    Member

    /describe

    @paolomainardi
    Copy link
    Member

    /review

    @sparkfabrik-ai-bot
    Copy link

    PR Description updated to latest commit (281688b)

    @sparkfabrik-ai-bot
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Conditional Resource Deployment

    The use of the count meta-argument on the helm_release.this resource to conditionally deploy the GitLab Agent components based on the gitlab_agent_enabled_deploy variable should be validated to ensure it does not introduce unintended side effects, such as orphaned resources or state drift when toggling the variable.

    count            = var.gitlab_agent_enabled_deploy ? 1 : 0
    Variable Documentation and Defaults

    The new gitlab_agent_enabled_deploy variable is introduced with a default of true. Reviewers should ensure that this default and its documentation are consistent with the intended module behavior and that disabling deployment does not break other module outputs or dependencies.

    variable "gitlab_agent_enabled_deploy" {
      description = "Whether to deploy the GitLab Agent components. If false, only creates the GitLab Agent token, Kubernetes namespace and secret without deploying the agent itself."
      type        = bool
      default     = true
    }

    @filippolmt
    Copy link
    Member Author

    /improve

    @sparkfabrik-ai-bot
    Copy link

    sparkfabrik-ai-bot bot commented May 16, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Copy link
    Member

    @andypanix andypanix left a comment

    Choose a reason for hiding this comment

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

    LGTM

    @filippolmt filippolmt merged commit dab0c64 into main May 18, 2025
    1 check passed
    @filippolmt filippolmt deleted the feature/add-gitlab-agent-enabled-deploy-flag branch May 18, 2025 14:47
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants