Skip to content

Add support for assigning an agent to an environment via CI

Tiger Watson requested to merge 467912-add-cluster-agent-ci-keyword into master

What does this MR do and why?

Add support for assigning an agent to an environment via CI

Introduces a new CI keyword, environment.kubernetes.agent to associate the environment with the specified agent, which in turn enables the dashboard for Kubernetes for the environment.

Changelog: added

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Create a new project, and register an agent with the following configuration (note that the agent must be able to connect to your GDK, otherwise KAS won't send the configuration through and the authorisations won't be persisted):
     user_access:
       access_as:
         agent: {}
       projects:
         - id: path/to/your/project
  2. Add the following .gitlab-ci.yml, and run a pipeline (remember to substitute the project path and agent name):
    stages:
      - deploy
    
    deploy:
      stage: deploy
      environment:
        name: env-$CI_COMMIT_SHORT_SHA
        kubernetes:
          agent: <path/to/your/project/:<your-agent-name>
      script:
        - echo 'deploy'
  3. Go to Operate -> Environments and click on the environment that was just created
  4. Click 'Edit environment', and verify that the agent you created above is listed under 'GitLab agent'

Related to #467912 (closed)

Edited by Tiger Watson

Merge request reports

Loading