This is a demo repository for testing Azure DevOps-focused Learn interactive modules with GitHub Codespaces.
You can use this repo to:
- Create a self-hosted Linux Azure DevOps agent that runs in a codespaces
- Build a Codespaces development environment where you can run the interactive module, Create a build pipeline with Azure Pipelines
- A GitHub account
- An Azure DevOps organization
For the following repository:
https://github.com/juliakm/pipelines-codespaces-tailspin.git
You'll need to create a new PAT to use with your self-hosted agent.
-
Go to
https://dev.azure.com/{yourorganization}
. -
Create a new PAT with the scope Agent Pools (Read & manage) and Deployment Groups (Read & manage).
-
Copy the PAT token value and store it in a secure space. You'll use the PAT token as a GitHub secret value.
You'll create GitHub secrets to run with your Azure DevOps self-hosted agent.
-
In your GitHub repository, select Settings > Secrets and variables > Codespaces.
-
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
)
-
In your forked GitHub repository, select Code.
-
Select the Codespaces tab.
-
Press ... to create a new Codespace with options.
-
Select the
AzurePipelines
Codespace option at.devcontainer/ADOagent/devcontainer.json
and Create codespace. Leave the other default options. -
Wait for your Codespace to build. When the build completes, you'll be redirected to an online version of Visual Studio Code.
-
Go to Create a build pipeline with Azure Pipelines and start the module.
-
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'
When working on the module, you can test out your code in the browser with GitHub Codespaces port forwarding.