Skip to content

Demo repo for testing DevOps Learn modules with Codespaces and self-hosted agents

License

Notifications You must be signed in to change notification settings

steved0x/pipelines-codespaces-tailspin

 
 

Repository files navigation

Demo: Complete an Azure Pipelines Learn interactive module with GitHub Codespaces

This is a demo repository for testing Azure DevOps-focused Learn interactive modules with GitHub Codespaces.

You can use this repo to:

Prerequisites

  • A GitHub account
  • An Azure DevOps organization

Fork the sample code

For the following repository:

https://github.com/juliakm/pipelines-codespaces-tailspin.git

Create an Azure DevOps personal access token (PAT)

You'll need to create a new PAT to use with your self-hosted agent.

  1. Go to https://dev.azure.com/{yourorganization}.

  2. Create a new PAT with the scope Agent Pools (Read & manage) and Deployment Groups (Read & manage).

  3. Copy the PAT token value and store it in a secure space. You'll use the PAT token as a GitHub secret value.

Create GitHub Secrets

You'll create GitHub secrets to run with your Azure DevOps self-hosted agent.

  1. In your GitHub repository, select Settings > Secrets and variables > Codespaces.

    Screenshot of Codespaces secret

  2. Create three new Codespaces secrets.

    Name Value
    ADO_ORG Name of the Azure DevOps organization (Example: fabrikam)
    ADO_PAT Personal Access Token value
    ADO_POOL_NAME Name of agent pool (Example: codespaces-agent-pool)

Build your Codespace

  1. In your forked GitHub repository, select Code.

  2. Select the Codespaces tab.

  3. Press ... to create a new Codespace with options.

    Create new Codespace with options.

  4. Select the AzurePipelines Codespace option at .devcontainer/ADOagent/devcontainer.json and Create codespace. Leave the other default options.

    Select Azure DevOps Codespace option.

  5. Wait for your Codespace to build. When the build completes, you'll be redirected to an online version of Visual Studio Code.

Complete Learn module

  1. Go to Create a build pipeline with Azure Pipelines and start the module.

  2. When see references to the hosted Ubuntu agent, replace the code snippet with a reference to your self-hosted agent.

    Remove this section of the YAML pipeline.

    pool:
      vmImage: 'ubuntu-22.04'

    Add this section of the YAML pipeline.

        pool:
          name: 'codespaces-agent-pool'

Notes

When working on the module, you can test out your code in the browser with GitHub Codespaces port forwarding.

About

Demo repo for testing DevOps Learn modules with Codespaces and self-hosted agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 28.6%
  • HTML 28.2%
  • Shell 27.0%
  • SCSS 6.4%
  • CSS 5.3%
  • Dockerfile 2.4%
  • JavaScript 2.1%