Jenkins : Azure Dev Spaces Plugin

Azure Dev Spaces Plugin helps to manage dev spaces in Azure Dev Spaces.

How to Install

You can install/update this plugin in Jenkins update center (Manage Jenkins -> Manage Plugins, search Azure Dev Spaces Plugin).

You can also manually install the plugin if you want to try the latest feature before it's officially released.
To manually install the plugin:

  1. Clone the repo and build:

    mvn package
  2. Open your Jenkins dashboard, go to Manage Jenkins -> Manage Plugins.
  3. Go to Advanced tab, under Upload Plugin section, click Choose File.
  4. Select `azure-dev-spaces.hpi` in `target` folder of your repo, click Upload.
  5. Restart your Jenkins instance after install is completed.

Prerequisites

To use this plugin to manage dev spaces, first you need to have an Azure Service Principal in your Jenkins instance.

  1. Create an Azure Service Principal through Azure CLI or Azure Portal.
  2. Open Jenkins dashboard, go to Credentials, add a new Microsoft Azure Service Principal with the credential information you just created.

Create a dev space

Freestyle job

  1. Choose to add a `Build` action 'Create dev spaces'.
  2. Select your Azure credential in Azure credential section.
  3. Select the resource group and Azure kubernetes service in your subscription.
  4. Set value for your parent dev space name and dev space name.
  5. In the "Kubeconfig" dropdown, select the kubeconfig stored in Jenkins. You can click the "Add" button on the right to add new kubeconfig (Kind: Kubernetes configuration (kubeconfig)). You can enter the kubeconfig content directly in it.

Pipeline

Pipeline step command is like below, follow freestyle job to fill variables.

devSpacesCreate aksName: '', azureCredentialsId: '', resourceGroupName: '', sharedSpaceName: '', spaceName: ''

Clean up a dev space

Freestyle job

  1. Choose to add a `Post-build Actions` action 'Cleanup dev spaces'.
  2. Select your Azure credential in Azure credential section.
  3. Select the resource group and Azure kubernetes service in your subscription.
  4. Set value for dev space name needed to be cleaned up.
  5. In the "Kubeconfig" dropdown, select the kubeconfig stored in Jenkins. You can click the "Add" button on the right to add new kubeconfig (Kind: Kubernetes configuration (kubeconfig)). You can enter the kubeconfig content directly in it.
  6. Save the project and build it.

Pipeline

Pipeline step command is like below, follow freestyle job to fill variables.

devSpacesCleanup aksName: '', azureCredentialsId: '', devSpaceName: '', resourceGroupName: ''