Merge pull request #32 from valet-customers/restructure-azdo-bootstrap
Restructure the setup of Azure DevOps labs
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"name": "Codespace to bootstrap valet in a Codespace",
|
||||
//Use base codespace image then pull Valet on postCreateCommand,
|
||||
"name": "Codespace to perform Valet Labs",
|
||||
"image": "mcr.microsoft.com/vscode/devcontainers/universal:linux",
|
||||
"remoteUser": "codespace",
|
||||
"overrideCommand": false,
|
||||
@@ -15,8 +14,7 @@
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-azuretools.vscode-docker",
|
||||
"ms-azuretools.vscode-docker"
|
||||
],
|
||||
"onCreateCommand": 'echo "export GITHUB_ACCESS_TOKEN=$VALET_GHCR_PASSWORD" >> ~/.bashrc',
|
||||
"postCreateCommand": "sudo bash .devcontainer/setupcodespace.sh ${VALET_GHCR_PASSWORD} ${AZURE_DEVOPS_PROJECT} ${AZURE_DEVOPS_ORGANIZATION} ${AZURE_DEVOPS_ACCESS_TOKEN} ${GITHUB_USER} 'https://github.com/' && gh extension install github/gh-valet || echo 'Could not auto-build. Skipping.' "
|
||||
"postCreateCommand": "gh extension install github/gh-valet || echo 'Could not auto-build. Skipping.' "
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "Starting setupcodespace.sh"
|
||||
|
||||
azdoProject="AZURE_DEVOPS_PROJECT="
|
||||
azdoOrg="AZURE_DEVOPS_ORGANIZATION="
|
||||
azdoInstance="AZURE_DEVOPS_INSTANCE_URL="
|
||||
ghAccess="GITHUB_ACCESS_TOKEN="
|
||||
azdoAccess="AZURE_DEVOPS_ACCESS_TOKEN="
|
||||
ghInstanceUrl="GITHUB_INSTANCE_URL="
|
||||
|
||||
if [ -z "$1" -o -z "$5" ]
|
||||
then
|
||||
echo "Error: Docker Pull Valet not executing because GITHUB_USER and/or VALET_PASSWORD not set"
|
||||
else
|
||||
docker login ghcr.io/valet-customers --username $5 --password $1
|
||||
docker pull ghcr.io/valet-customers/valet-cli:latest
|
||||
echo "Success: Docker Pull Valet completed"
|
||||
fi
|
||||
|
||||
value=`cat valet/.env.local.template`
|
||||
echo "$value" > valet/.env.local
|
||||
|
||||
if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$6" ]
|
||||
then
|
||||
echo "Error: Set envars not set, valid values not passed in. You will have to manually use the valet/.env.local folder"
|
||||
fi
|
||||
|
||||
echo "Finished setupcodespace.sh"
|
||||
@@ -1,35 +0,0 @@
|
||||
# This is a workflow to set up an Azure DevOps instance seeded with pipelines
|
||||
# You need to Add a secret for an Azure DevOps PAT called AZDOPAT
|
||||
|
||||
name: Valet Bootstrap for Azure DevOps
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
AzDoOrgName:
|
||||
description: 'Azure DevOps organization name'
|
||||
required: true
|
||||
type: string
|
||||
AzDoUserName:
|
||||
description: 'Azure DevOps user name'
|
||||
required: true
|
||||
type: string
|
||||
AzDoProjectName:
|
||||
description: 'Azure DevOps project name'
|
||||
default: 'ValetBootstrap'
|
||||
type: string
|
||||
jobs:
|
||||
bootstrap:
|
||||
name: Bootstrap
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
- name: Run powershell file to bootstrap Azure DevOps
|
||||
env:
|
||||
AZDOPATTOUSE: ${{ secrets.AZURE_DEVOPS_ACCESS_TOKEN }}
|
||||
ROOTFOLDER: ${{ github.workspace }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
./azure_devops/bootstrap/azDevOps.ps1 -project ${{ github.event.inputs.AzDoProjectName }} -userName ${{ github.event.inputs.AzDoUserName }} -repoName ${{ github.event.inputs.AzDoProjectName }} -orgToUse ${{ github.event.inputs.AzDoOrgName }} -rootFolder $env:ROOTFOLDER -daPassword $env:AZDOPATTOUSE
|
||||
@@ -1,235 +0,0 @@
|
||||
param (
|
||||
$project = "ValetBootstrap",
|
||||
$repoName = "ValetBootstrap",
|
||||
$codeFolder= "code,azure_devops/pipelines",
|
||||
$rootFolder= ".",
|
||||
$pipelinesRoot="azure_devops/pipelines",
|
||||
[String]$orgToUse = "..",
|
||||
[String]$userName=$(Throw "Azure DevOps Username required."),
|
||||
[String]$daPassword=$(Throw "Password required.")
|
||||
)
|
||||
|
||||
Write-Host "Start Valet Bootstrap"
|
||||
Write-Host "Azure DevOps Organization to use $orgToUse"
|
||||
Write-Host "Azure DevOps Project to use $project"
|
||||
Write-Host "Repo Name $repoName"
|
||||
Write-Host "Code Folders: $codeFolder"
|
||||
Write-Host "Root Folders: $rootFolder"
|
||||
Write-Host "Pipelines Folders: $pipelinesRoot"
|
||||
Write-Host "Azure DevOps username to authenticate with $userName"
|
||||
Write-Host "Azure DevOps PAT to authenticate with $daPassword"
|
||||
|
||||
function Get-BasicAuthCreds {
|
||||
param([string]$Username,[String]$Password)
|
||||
$AuthString = "{0}:{1}" -f $Username,$Password
|
||||
$AuthBytes = [System.Text.Encoding]::Ascii.GetBytes($AuthString)
|
||||
return [Convert]::ToBase64String($AuthBytes)
|
||||
}
|
||||
|
||||
#Get the creds to use in all GitHub API calls.
|
||||
$BasicCreds = Get-BasicAuthCreds -Username "$userName" -Password $daPassword
|
||||
|
||||
##########################################################################
|
||||
#CREATE THE AZURE DEVOPS PROJECT
|
||||
$createtUrlToUse = [string]::Format("https://dev.azure.com/{0}/_apis/projects?api-version=6.0", $orgToUse)
|
||||
|
||||
$projectToCreate = @{
|
||||
"name"= "$project"
|
||||
"description"= "Project to be used for Valet Demos"
|
||||
"capabilities"= @{
|
||||
"versioncontrol"= @{
|
||||
"sourceControlType"= "Git"
|
||||
}
|
||||
"processTemplate"= @{
|
||||
"templateTypeId"= "6b724908-ef14-45cf-84f8-768b5384da45"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
$projectResponse = Invoke-RestMethod -Method 'Post' -Uri $createtUrlToUse -Headers @{"Authorization"="Basic $BasicCreds"} -Body ($projectToCreate|ConvertTo-Json) -ContentType "application/json"
|
||||
$projectResponse | ConvertTo-Json
|
||||
|
||||
Start-Sleep -s 5
|
||||
Write-Host "Yes! Project $project was created!"
|
||||
|
||||
} Catch {
|
||||
Write-Host " "
|
||||
Write-Host "##########################################################################"
|
||||
Write-Host "ERROR during project creation: $project"
|
||||
Write-Host "The API call was: $createtUrlToUse"
|
||||
Write-Host " "
|
||||
|
||||
if($_.ErrorDetails.Message) {
|
||||
Write-Host "See error message below:"
|
||||
Write-Host $_.ErrorDetails.Message
|
||||
} else {
|
||||
Write-Host $_
|
||||
Write-Host "It is likely that the AZURE_DEVOPS_ACCESS_TOKEN is not set correctly in the worflow OR does not have sufficent permissions"
|
||||
}
|
||||
Write-Host " "
|
||||
Write-Host "##########################################################################"
|
||||
throw "Exiting. The Project $project was NOT created in Azure DevOps"
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# IMPORT THE REPO
|
||||
Set-Location $rootFolder
|
||||
|
||||
[array]$folderArray = $codeFolder.Split(",")
|
||||
|
||||
$addTextFile = @{
|
||||
"refUpdates"= @(
|
||||
@{
|
||||
"name"= "refs/heads/main"
|
||||
"oldObjectId"= "0000000000000000000000000000000000000000"
|
||||
}
|
||||
)
|
||||
"commits"= @(
|
||||
@{
|
||||
"comment"= "Initial commit."
|
||||
"changes"= @(
|
||||
foreach ($folder in $folderArray)
|
||||
{
|
||||
$codeRootFolder = Join-Path -Path $rootFolder -ChildPath $folder
|
||||
Write-Host "codeRootFolder: $codeRootFolder"
|
||||
|
||||
$itemPath = $folder.Substring($folder.lastIndexOf('/') + 1)
|
||||
Write-Host "itemPath: $itemPath"
|
||||
|
||||
$codeFiles = (Get-ChildItem "$codeRootFolder" -Recurse -Attributes !Directory)
|
||||
foreach ($codeFile in $codeFiles ) {
|
||||
$daFullName = $codeFile.FullName
|
||||
$codeBody = (Get-Content "$daFullName" -Raw)
|
||||
#Write-Host "codeBody: $codeBody"
|
||||
#Write-Host "folder: $folder"
|
||||
$relath = $daFullName | Resolve-Path -Relative
|
||||
#Write-Host "relath: $relath"
|
||||
$replaceSlash = $folder.Replace("/", "\")
|
||||
$repoPath = $relath.Substring($relath.lastIndexOf($replaceSlash) + $replaceSlash.Length)
|
||||
$wholeRepoPath = Join-Path -Path $itemPath -ChildPath $repoPath
|
||||
$wholeRepoPath = $wholeRepoPath.Replace("\", "/")
|
||||
#Write-Host "wholeRepoPath: $wholeRepoPath"
|
||||
#Write-Host "repoPath: $repoPath"
|
||||
@{
|
||||
"changeType"= "add"
|
||||
"item"= @{
|
||||
"path"= "/$wholeRepoPath"
|
||||
}
|
||||
"newContent"= @{
|
||||
"content"= "$codeBody"
|
||||
"contentType"= "rawtext"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
try{
|
||||
$repoUrlToUse = [string]::Format("https://dev.azure.com/{0}/{2}/_apis/git/repositories/{1}/pushes?api-version=7.1-preview.2", $orgToUse, $repoName, $project)
|
||||
$pushResponse = Invoke-RestMethod -Method 'Post' -Uri $repoUrlToUse -Headers @{"Authorization"="Basic $BasicCreds"} -Body ($addTextFile|ConvertTo-Json -Depth 5) -ContentType "application/json"
|
||||
$repoIds = $pushResponse.repository.id
|
||||
Write-Host "Yes! Repo Was was created! The repoId is $repoIds"
|
||||
} Catch {
|
||||
Write-Host " "
|
||||
Write-Host "##########################################################################"
|
||||
Write-Host "ERROR during Repo creation:"
|
||||
Write-Host "The API call was: $repoUrlToUse"
|
||||
Write-Host " "
|
||||
|
||||
if($_.ErrorDetails.Message) {
|
||||
Write-Host "See error message below:"
|
||||
Write-Host $_.ErrorDetails.Message
|
||||
} else {
|
||||
Write-Host $_
|
||||
}
|
||||
Write-Host " "
|
||||
Write-Host "##########################################################################"
|
||||
throw "Exiting. The Repo was NOT created. It is likely the Project was created in Azure DevOps."
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
# Create YML Pipelines
|
||||
$plUrlToUse = [string]::Format("https://dev.azure.com/{0}/{1}/_apis/pipelines?api-version=6.0-preview.1", $orgToUse, "$project")
|
||||
|
||||
$files = Get-ChildItem ".\$pipelinesRoot\yml\"
|
||||
foreach ($f in $files)
|
||||
{
|
||||
$nameOfPl = $f.BaseName
|
||||
$fileName = $f.Name
|
||||
Write-Host "basename: $nameOfPl filename: $fileName"
|
||||
|
||||
$pipelineCreateBody = @{
|
||||
"folder"= "pipelines"
|
||||
"name"= "$nameOfPl"
|
||||
"configuration"= @{
|
||||
"type"= "yaml"
|
||||
"path"= "/pipelines/yml/$fileName"
|
||||
"repository"= @{
|
||||
"id"= "$repoIds"
|
||||
"name"= "$repoName"
|
||||
"type"= "azureReposGit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
$repoResponse = Invoke-RestMethod -Method 'Post' -Uri $plUrlToUse -Headers @{"Authorization"="Basic $BasicCreds"} -Body ($pipelineCreateBody|ConvertTo-Json) -ContentType "application/json"
|
||||
} Catch {
|
||||
Write-Host " "
|
||||
Write-Host "##########################################################################"
|
||||
Write-Host "ERROR during Pipeline creation:"
|
||||
Write-Host "The API call was: $plUrlToUse"
|
||||
Write-Host " "
|
||||
|
||||
if($_.ErrorDetails.Message) {
|
||||
Write-Host "See error message below:"
|
||||
Write-Host $_.ErrorDetails.Message
|
||||
} else {
|
||||
Write-Host $_
|
||||
}
|
||||
Write-Host " "
|
||||
Write-Host "The Pipeline $nameOfPl was NOT created."
|
||||
Write-Host "##########################################################################"
|
||||
}
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
#CREATE CLASSIC PIPELINEs
|
||||
|
||||
$classicUrlToUse = [string]::Format("https://dev.azure.com/{0}/{1}/_apis/build/definitions?api-version=7.1-preview.7", $orgToUse, "$project")
|
||||
|
||||
$files = Get-ChildItem ".\$pipelinesRoot\classic\"
|
||||
foreach ($f in $files)
|
||||
{
|
||||
$nameOfPl = $f.BaseName
|
||||
$fileName = $f.Name
|
||||
Write-Host "basename: $nameOfPl filename: $fileName"
|
||||
|
||||
$pclassicreateBody = (Get-Content ./$pipelinesRoot/classic/$fileName).Replace("REPOTOREPLACE", "$repoName")
|
||||
|
||||
try{
|
||||
Invoke-RestMethod -Method 'Post' -Uri $classicUrlToUse -Headers @{"Authorization"="Basic $BasicCreds"} -Body ($pclassicreateBody) -ContentType "application/json"
|
||||
} Catch {
|
||||
Write-Host " "
|
||||
Write-Host "##########################################################################"
|
||||
Write-Host "ERROR during Pipeline creation:"
|
||||
Write-Host "The API call was: $classicUrlToUse"
|
||||
Write-Host " "
|
||||
|
||||
if($_.ErrorDetails.Message) {
|
||||
Write-Host "See error message below:"
|
||||
Write-Host $_.ErrorDetails.Message
|
||||
} else {
|
||||
Write-Host $_
|
||||
}
|
||||
Write-Host " "
|
||||
Write-Host "The Pipeline $nameOfPl was NOT created."
|
||||
Write-Host "##########################################################################"
|
||||
}
|
||||
}
|
||||
Write-Host "End Valet Bootstrap"
|
||||
@@ -1,56 +1,56 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B26D43AA-4A35-4035-9E99-48EF9A3E64DD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Attendee", "src\Attendee\Attendee.csproj", "{2804EC63-670C-4970-85E4-2A63C9327FF8}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{348A52EC-7046-4D1A-88DB-55B025C2BB68}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AttendeeTest", "test\AttendeeTest\AttendeeTest.csproj", "{DED76823-F195-46D4-8509-5692E3431D53}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8} = {B26D43AA-4A35-4035-9E99-48EF9A3E64DD}
|
||||
{DED76823-F195-46D4-8509-5692E3431D53} = {348A52EC-7046-4D1A-88DB-55B025C2BB68}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B26D43AA-4A35-4035-9E99-48EF9A3E64DD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Attendee", "src\Attendee\Attendee.csproj", "{2804EC63-670C-4970-85E4-2A63C9327FF8}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{348A52EC-7046-4D1A-88DB-55B025C2BB68}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AttendeeTest", "test\AttendeeTest\AttendeeTest.csproj", "{DED76823-F195-46D4-8509-5692E3431D53}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DED76823-F195-46D4-8509-5692E3431D53}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{2804EC63-670C-4970-85E4-2A63C9327FF8} = {B26D43AA-4A35-4035-9E99-48EF9A3E64DD}
|
||||
{DED76823-F195-46D4-8509-5692E3431D53} = {348A52EC-7046-4D1A-88DB-55B025C2BB68}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+15
-15
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Attendees
|
||||
{
|
||||
public class Attendee
|
||||
{
|
||||
public bool AddAttendee(string added)
|
||||
{
|
||||
if (added == "exists")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace Attendees
|
||||
{
|
||||
public class Attendee
|
||||
{
|
||||
public bool AddAttendee(string added)
|
||||
{
|
||||
if (added == "exists")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
+18
-18
@@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Extensions;
|
||||
using Attendees;
|
||||
|
||||
namespace AttendeeTest
|
||||
{
|
||||
public class AttendeeTest
|
||||
{
|
||||
[Fact]
|
||||
public void AttendeeExistsReturnTrue()
|
||||
{
|
||||
Attendee attendee = new Attendee();
|
||||
bool doesExist = attendee.AddAttendee("doesnotexist");
|
||||
Assert.False(doesExist, "The attendee does not exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Extensions;
|
||||
using Attendees;
|
||||
|
||||
namespace AttendeeTest
|
||||
{
|
||||
public class AttendeeTest
|
||||
{
|
||||
[Fact]
|
||||
public void AttendeeExistsReturnTrue()
|
||||
{
|
||||
Attendee attendee = new Attendee();
|
||||
bool doesExist = attendee.AddAttendee("doesnotexist");
|
||||
Assert.False(doesExist, "The attendee does not exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-26
@@ -1,26 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="3.0.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Attendee\Attendee.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="3.0.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Attendee\Attendee.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,243 @@
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"enabled": true,
|
||||
"definition": {
|
||||
"id": "5d58cc01-7c75-450c-be18-a388ddb129ec"
|
||||
},
|
||||
"inputs": {
|
||||
"branchFilters": "[\"+refs/heads/*\"]",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"definition": {
|
||||
"id": "a9db38f9-9fdc-478c-b0f9-464221e58316"
|
||||
},
|
||||
"inputs": {
|
||||
"workItemType": "Task",
|
||||
"assignToRequestor": "true",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"BuildConfiguration": {
|
||||
"value": "release",
|
||||
"allowOverride": true
|
||||
},
|
||||
"BuildPlatform": {
|
||||
"value": "any cpu",
|
||||
"allowOverride": true
|
||||
},
|
||||
"system.debug": {
|
||||
"value": "false",
|
||||
"allowOverride": true
|
||||
}
|
||||
},
|
||||
"properties": {},
|
||||
"tags": [],
|
||||
"_links": [],
|
||||
"buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)",
|
||||
"jobAuthorizationScope": 1,
|
||||
"jobTimeoutInMinutes": 60,
|
||||
"jobCancelTimeoutInMinutes": 5,
|
||||
"process": {
|
||||
"phases": [
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "Use NuGet 4.4.1",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "2c65196a-54fd-4a02-9be8-d9d1837b7c5d",
|
||||
"versionSpec": "0.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"versionSpec": "4.4.1",
|
||||
"checkLatest": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "NuGet restore",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "333b11bd-d341-40d9-afcf-b32d5ce6f23b",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"command": "restore",
|
||||
"solution": "$(Parameters.solution)",
|
||||
"selectOrConfig": "select",
|
||||
"feedRestore": "",
|
||||
"includeNuGetOrg": "true",
|
||||
"nugetConfigPath": "",
|
||||
"externalEndpoints": "",
|
||||
"noCache": "false",
|
||||
"disableParallelProcessing": "false",
|
||||
"packagesDirectory": "",
|
||||
"verbosityRestore": "Detailed",
|
||||
"searchPatternPush": "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg",
|
||||
"nuGetFeedType": "internal",
|
||||
"feedPublish": "",
|
||||
"publishPackageMetadata": "true",
|
||||
"allowPackageConflicts": "false",
|
||||
"externalEndpoint": "",
|
||||
"verbosityPush": "Detailed",
|
||||
"searchPatternPack": "**/*.csproj",
|
||||
"configurationToPack": "$(BuildConfiguration)",
|
||||
"outputDir": "$(Build.ArtifactStagingDirectory)",
|
||||
"versioningScheme": "off",
|
||||
"includeReferencedProjects": "false",
|
||||
"versionEnvVar": "",
|
||||
"requestedMajorVersion": "1",
|
||||
"requestedMinorVersion": "0",
|
||||
"requestedPatchVersion": "0",
|
||||
"packTimezone": "utc",
|
||||
"includeSymbols": "false",
|
||||
"toolPackage": "false",
|
||||
"buildProperties": "",
|
||||
"basePath": "",
|
||||
"verbosityPack": "Detailed",
|
||||
"arguments": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "PowerShell Script",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"targetType": "inline",
|
||||
"filePath": "",
|
||||
"arguments": "",
|
||||
"script": "# Write your PowerShell commands here.\n\nWrite-Host \"Hello World\"\n",
|
||||
"errorActionPreference": "stop",
|
||||
"warningPreference": "default",
|
||||
"informationPreference": "default",
|
||||
"verbosePreference": "default",
|
||||
"debugPreference": "default",
|
||||
"failOnStderr": "false",
|
||||
"showWarnings": "false",
|
||||
"ignoreLASTEXITCODE": "false",
|
||||
"pwsh": "false",
|
||||
"workingDirectory": "",
|
||||
"runScriptInSeparateScope": "false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "Agent job 1",
|
||||
"refName": "Job_1",
|
||||
"condition": "succeeded()",
|
||||
"target": {
|
||||
"executionOptions": {
|
||||
"type": 0
|
||||
},
|
||||
"allowScriptsAuthAccessOption": false,
|
||||
"type": 1
|
||||
},
|
||||
"jobAuthorizationScope": 1
|
||||
}
|
||||
],
|
||||
"target": {
|
||||
"agentSpecification": {
|
||||
"identifier": "windows-latest"
|
||||
}
|
||||
},
|
||||
"type": 1
|
||||
},
|
||||
"repository": {
|
||||
"properties": {
|
||||
"cleanOptions": "0",
|
||||
"labelSources": "0",
|
||||
"labelSourcesFormat": "$(build.buildNumber)",
|
||||
"reportBuildStatus": "true",
|
||||
"gitLfsSupport": "false",
|
||||
"skipSyncSource": "false",
|
||||
"checkoutNestedSubmodules": "false",
|
||||
"fetchDepth": "0"
|
||||
},
|
||||
"id": "",
|
||||
"type": "TfsGit",
|
||||
"name": "REPOTOREPLACE",
|
||||
"url": "",
|
||||
"defaultBranch": "refs/heads/main",
|
||||
"clean": "false",
|
||||
"checkoutSubmodules": false
|
||||
},
|
||||
"processParameters": {
|
||||
"inputs": [
|
||||
{
|
||||
"aliases": [],
|
||||
"options": {},
|
||||
"properties": {},
|
||||
"name": "solution",
|
||||
"label": "Solution",
|
||||
"defaultValue": "**\\*.sln",
|
||||
"required": true,
|
||||
"type": "filePath",
|
||||
"helpMarkDown": "The path to the Visual Studio solution file or NuGet packages.config. Wildcards can be used. For example, `**\\\\*.sln` for all sln files in all sub folders."
|
||||
}
|
||||
]
|
||||
},
|
||||
"quality": 1,
|
||||
"authoredBy": {
|
||||
"displayName": "David Kalmin",
|
||||
"url": "https://spsprodcus5.vssps.visualstudio.com/A8ceff4ff-6429-4de3-9c39-fd7f0b1fb05a/_apis/Identities/a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"_links": {
|
||||
"avatar": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
}
|
||||
},
|
||||
"id": "a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"uniqueName": "[email protected]",
|
||||
"imageUrl": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0",
|
||||
"descriptor": "aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
},
|
||||
"drafts": [],
|
||||
"queue": {
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126"
|
||||
}
|
||||
},
|
||||
"name": "Azure Pipelines",
|
||||
"url": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126",
|
||||
"pool": {
|
||||
"name": "Azure Pipelines",
|
||||
"isHosted": true
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"name": "valet-classic-test-import1",
|
||||
"uri": "vstfs:///Build/Definition/10",
|
||||
"path": "\\",
|
||||
"type": 2,
|
||||
"queueStatus": 0,
|
||||
"revision": 1,
|
||||
"createdDate": "2022-02-17T19:05:52.500Z"
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"enabled": true,
|
||||
"definition": {
|
||||
"id": "5d58cc01-7c75-450c-be18-a388ddb129ec"
|
||||
},
|
||||
"inputs": {
|
||||
"branchFilters": "[\"+refs/heads/*\"]",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"definition": {
|
||||
"id": "a9db38f9-9fdc-478c-b0f9-464221e58316"
|
||||
},
|
||||
"inputs": {
|
||||
"workItemType": "Task",
|
||||
"assignToRequestor": "true",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"BuildConfiguration": {
|
||||
"value": "release",
|
||||
"allowOverride": true
|
||||
},
|
||||
"BuildPlatform": {
|
||||
"value": "any cpu",
|
||||
"allowOverride": true
|
||||
},
|
||||
"system.debug": {
|
||||
"value": "false",
|
||||
"allowOverride": true
|
||||
}
|
||||
},
|
||||
"properties": {},
|
||||
"tags": [],
|
||||
"_links": [],
|
||||
"buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)",
|
||||
"jobAuthorizationScope": 1,
|
||||
"jobTimeoutInMinutes": 60,
|
||||
"jobCancelTimeoutInMinutes": 5,
|
||||
"process": {
|
||||
"phases": [
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "Use NuGet 4.4.1",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "2c65196a-54fd-4a02-9be8-d9d1837b7c5d",
|
||||
"versionSpec": "0.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"versionSpec": "4.4.1",
|
||||
"checkLatest": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "NuGet restore",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "333b11bd-d341-40d9-afcf-b32d5ce6f23b",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"command": "restore",
|
||||
"solution": "$(Parameters.solution)",
|
||||
"selectOrConfig": "select",
|
||||
"feedRestore": "",
|
||||
"includeNuGetOrg": "true",
|
||||
"nugetConfigPath": "",
|
||||
"externalEndpoints": "",
|
||||
"noCache": "false",
|
||||
"disableParallelProcessing": "false",
|
||||
"packagesDirectory": "",
|
||||
"verbosityRestore": "Detailed",
|
||||
"searchPatternPush": "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg",
|
||||
"nuGetFeedType": "internal",
|
||||
"feedPublish": "",
|
||||
"publishPackageMetadata": "true",
|
||||
"allowPackageConflicts": "false",
|
||||
"externalEndpoint": "",
|
||||
"verbosityPush": "Detailed",
|
||||
"searchPatternPack": "**/*.csproj",
|
||||
"configurationToPack": "$(BuildConfiguration)",
|
||||
"outputDir": "$(Build.ArtifactStagingDirectory)",
|
||||
"versioningScheme": "off",
|
||||
"includeReferencedProjects": "false",
|
||||
"versionEnvVar": "",
|
||||
"requestedMajorVersion": "1",
|
||||
"requestedMinorVersion": "0",
|
||||
"requestedPatchVersion": "0",
|
||||
"packTimezone": "utc",
|
||||
"includeSymbols": "false",
|
||||
"toolPackage": "false",
|
||||
"buildProperties": "",
|
||||
"basePath": "",
|
||||
"verbosityPack": "Detailed",
|
||||
"arguments": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "PowerShell Script",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"targetType": "inline",
|
||||
"filePath": "",
|
||||
"arguments": "",
|
||||
"script": "# Write your PowerShell commands here.\n\nWrite-Host \"Hello World\"\n",
|
||||
"errorActionPreference": "stop",
|
||||
"warningPreference": "default",
|
||||
"informationPreference": "default",
|
||||
"verbosePreference": "default",
|
||||
"debugPreference": "default",
|
||||
"failOnStderr": "false",
|
||||
"showWarnings": "false",
|
||||
"ignoreLASTEXITCODE": "false",
|
||||
"pwsh": "false",
|
||||
"workingDirectory": "",
|
||||
"runScriptInSeparateScope": "false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "Agent job 1",
|
||||
"refName": "Job_1",
|
||||
"condition": "succeeded()",
|
||||
"target": {
|
||||
"executionOptions": {
|
||||
"type": 0
|
||||
},
|
||||
"allowScriptsAuthAccessOption": false,
|
||||
"type": 1
|
||||
},
|
||||
"jobAuthorizationScope": 1
|
||||
}
|
||||
],
|
||||
"target": {
|
||||
"agentSpecification": {
|
||||
"identifier": "windows-latest"
|
||||
}
|
||||
},
|
||||
"type": 1
|
||||
},
|
||||
"repository": {
|
||||
"properties": {
|
||||
"cleanOptions": "0",
|
||||
"labelSources": "0",
|
||||
"labelSourcesFormat": "$(build.buildNumber)",
|
||||
"reportBuildStatus": "true",
|
||||
"gitLfsSupport": "false",
|
||||
"skipSyncSource": "false",
|
||||
"checkoutNestedSubmodules": "false",
|
||||
"fetchDepth": "0"
|
||||
},
|
||||
"id": "",
|
||||
"type": "TfsGit",
|
||||
"name": "REPOTOREPLACE",
|
||||
"url": "",
|
||||
"defaultBranch": "refs/heads/main",
|
||||
"clean": "false",
|
||||
"checkoutSubmodules": false
|
||||
},
|
||||
"processParameters": {
|
||||
"inputs": [
|
||||
{
|
||||
"aliases": [],
|
||||
"options": {},
|
||||
"properties": {},
|
||||
"name": "solution",
|
||||
"label": "Solution",
|
||||
"defaultValue": "**\\*.sln",
|
||||
"required": true,
|
||||
"type": "filePath",
|
||||
"helpMarkDown": "The path to the Visual Studio solution file or NuGet packages.config. Wildcards can be used. For example, `**\\\\*.sln` for all sln files in all sub folders."
|
||||
}
|
||||
]
|
||||
},
|
||||
"quality": 1,
|
||||
"authoredBy": {
|
||||
"displayName": "David Kalmin",
|
||||
"url": "https://spsprodcus5.vssps.visualstudio.com/A8ceff4ff-6429-4de3-9c39-fd7f0b1fb05a/_apis/Identities/a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"_links": {
|
||||
"avatar": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
}
|
||||
},
|
||||
"id": "a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"uniqueName": "[email protected]",
|
||||
"imageUrl": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0",
|
||||
"descriptor": "aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
},
|
||||
"drafts": [],
|
||||
"queue": {
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126"
|
||||
}
|
||||
},
|
||||
"name": "Azure Pipelines",
|
||||
"url": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126",
|
||||
"pool": {
|
||||
"name": "Azure Pipelines",
|
||||
"isHosted": true
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"name": "valet-classic-test-import2",
|
||||
"uri": "vstfs:///Build/Definition/10",
|
||||
"path": "\\",
|
||||
"type": 2,
|
||||
"queueStatus": 0,
|
||||
"revision": 1,
|
||||
"createdDate": "2022-02-17T19:05:52.500Z"
|
||||
}
|
||||
Executable
+177
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/env ruby
|
||||
require "json"
|
||||
require "net/http"
|
||||
require "optparse"
|
||||
require "pathname"
|
||||
|
||||
options = {
|
||||
code_assets_dir: "code",
|
||||
pipeline_assets_dir: "pipelines",
|
||||
root_dir: File.join(ENV["CODESPACE_VSCODE_FOLDER"], "azure_devops/bootstrap")
|
||||
}
|
||||
|
||||
OptionParser.new do |opt|
|
||||
opt.on('--organization ORGANIZATION') { |o| options[:organization] = o }
|
||||
opt.on('--project PROJECT') { |o| options[:project] = o }
|
||||
opt.on('--access-token ACCESS_TOKEN') { |o| options[:access_token] = o }
|
||||
end.parse!
|
||||
|
||||
[:organization, :project, :access_token].each do |key|
|
||||
raise OptionParser::MissingArgument, key if options[key].nil?
|
||||
end
|
||||
|
||||
def post_request(uri, body, access_token)
|
||||
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
||||
request = Net::HTTP::Post.new(uri)
|
||||
request.basic_auth "", access_token
|
||||
request.body = body.to_json
|
||||
request.content_type = 'application/json'
|
||||
|
||||
response = http.request request
|
||||
|
||||
yield(response) if block_given?
|
||||
|
||||
sleep(5)
|
||||
|
||||
JSON.parse(response.body)
|
||||
end
|
||||
end
|
||||
|
||||
def create_project(options)
|
||||
organization = options[:organization]
|
||||
project = options[:project]
|
||||
access_token = options[:access_token]
|
||||
|
||||
puts "Creating project #{project} in organization #{organization}..."
|
||||
uri = URI("https://dev.azure.com/#{organization}/_apis/projects?api-version=6.0")
|
||||
|
||||
project_to_create = {
|
||||
name: project,
|
||||
description: "Project to be used for Valet Labs",
|
||||
capabilities: {
|
||||
versioncontrol: {
|
||||
sourceControlType: "Git"
|
||||
},
|
||||
processTemplate: {
|
||||
templateTypeId: "6b724908-ef14-45cf-84f8-768b5384da45"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post_request(uri, project_to_create, access_token) do |response|
|
||||
raise "Error creating project (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
end
|
||||
|
||||
def create_repository(options)
|
||||
organization = options[:organization]
|
||||
project = options[:project]
|
||||
# use the default repository created when the project is created
|
||||
repository = options[:project]
|
||||
access_token = options[:access_token]
|
||||
root_dir = options[:root_dir]
|
||||
directories = [options[:code_assets_dir], options[:pipeline_assets_dir]]
|
||||
|
||||
puts "Creating repository #{repository}..."
|
||||
uri = URI("https://dev.azure.com/#{organization}/#{project}/_apis/git/repositories/#{repository}/pushes?api-version=7.1-preview.2")
|
||||
|
||||
root = Pathname.new(root_dir)
|
||||
repository_to_create = {
|
||||
refUpdates: [{
|
||||
name: "refs/heads/main",
|
||||
oldObjectId: "0000000000000000000000000000000000000000"
|
||||
}],
|
||||
commits: [{
|
||||
comment: "Initial commit.",
|
||||
changes: directories.map do |directory|
|
||||
Dir[File.join(root_dir, directory, "**/*")].reject {|f| File.directory?(f) }.map do |entry|
|
||||
{
|
||||
changeType: "add",
|
||||
item: {
|
||||
path: File.join("/", Pathname.new(entry).relative_path_from(root).to_s)
|
||||
},
|
||||
newContent: {
|
||||
content: File.read(entry),
|
||||
contentType: "rawText"
|
||||
}
|
||||
}
|
||||
end
|
||||
end.flatten
|
||||
}]
|
||||
}
|
||||
|
||||
post_request(uri, repository_to_create, access_token) do |response|
|
||||
raise "Error creating repository (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
end
|
||||
|
||||
def create_yaml_pipelines(options, repository)
|
||||
organization = options[:organization]
|
||||
project = options[:project]
|
||||
repository_name = repository.dig("repository", "name")
|
||||
repository_id = repository.dig("repository", "id")
|
||||
access_token = options[:access_token]
|
||||
root_dir = options[:root_dir]
|
||||
pipeline_assets_dir = options[:pipeline_assets_dir]
|
||||
|
||||
puts "Creating yaml pipelines..."
|
||||
|
||||
uri = URI("https://dev.azure.com/#{organization}/#{project}/_apis/pipelines?api-version=6.0-preview.1")
|
||||
root = Pathname.new(root_dir)
|
||||
Dir[File.join(root_dir, pipeline_assets_dir, "yml", "*")].each do |entry|
|
||||
puts "Creating pipeline #{entry}..."
|
||||
|
||||
pipeline_to_create = {
|
||||
folder: "pipelines",
|
||||
name: File.basename(entry, ".yml"),
|
||||
configuration: {
|
||||
type: "yaml",
|
||||
path: File.join("/", Pathname.new(entry).relative_path_from(root).to_s),
|
||||
repository: {
|
||||
id: repository_id,
|
||||
name: repository_name,
|
||||
type: "azureReposGit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post_request(uri, pipeline_to_create, access_token) do |response|
|
||||
raise "Error creating pipeline (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create_classic_pipelines(options, repository)
|
||||
organization = options[:organization]
|
||||
project = options[:project]
|
||||
repository_name = repository.dig("repository", "name")
|
||||
repository_id = repository.dig("repository", "id")
|
||||
access_token = options[:access_token]
|
||||
root_dir = options[:root_dir]
|
||||
pipeline_assets_dir = options[:pipeline_assets_dir]
|
||||
|
||||
puts "Creating classic pipelines..."
|
||||
|
||||
uri = URI("https://dev.azure.com/#{organization}/#{project}/_apis/build/definitions?api-version=7.1-preview.7")
|
||||
root = Pathname.new(root_dir)
|
||||
Dir[File.join(root_dir, pipeline_assets_dir, "classic", "*")].each do |entry|
|
||||
puts "Creating pipeline #{entry}..."
|
||||
|
||||
pipeline_to_create = JSON.parse(File.read(entry))
|
||||
|
||||
pipeline_to_create["repository"]["name"] = repository_name
|
||||
pipeline_to_create["repository"]["id"] = repository_id
|
||||
|
||||
post_request(uri, pipeline_to_create, access_token) do |response|
|
||||
raise "Error creating pipeline (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
create_project(options)
|
||||
repository = create_repository(options)
|
||||
create_yaml_pipelines(options, repository)
|
||||
create_classic_pipelines(options, repository)
|
||||
|
||||
puts "Success!"
|
||||
@@ -1,243 +0,0 @@
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"enabled": true,
|
||||
"definition": {
|
||||
"id": "5d58cc01-7c75-450c-be18-a388ddb129ec"
|
||||
},
|
||||
"inputs": {
|
||||
"branchFilters": "[\"+refs/heads/*\"]",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"definition": {
|
||||
"id": "a9db38f9-9fdc-478c-b0f9-464221e58316"
|
||||
},
|
||||
"inputs": {
|
||||
"workItemType": "Task",
|
||||
"assignToRequestor": "true",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"BuildConfiguration": {
|
||||
"value": "release",
|
||||
"allowOverride": true
|
||||
},
|
||||
"BuildPlatform": {
|
||||
"value": "any cpu",
|
||||
"allowOverride": true
|
||||
},
|
||||
"system.debug": {
|
||||
"value": "false",
|
||||
"allowOverride": true
|
||||
}
|
||||
},
|
||||
"properties": {},
|
||||
"tags": [],
|
||||
"_links": [],
|
||||
"buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)",
|
||||
"jobAuthorizationScope": 1,
|
||||
"jobTimeoutInMinutes": 60,
|
||||
"jobCancelTimeoutInMinutes": 5,
|
||||
"process": {
|
||||
"phases": [
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "Use NuGet 4.4.1",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "2c65196a-54fd-4a02-9be8-d9d1837b7c5d",
|
||||
"versionSpec": "0.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"versionSpec": "4.4.1",
|
||||
"checkLatest": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "NuGet restore",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "333b11bd-d341-40d9-afcf-b32d5ce6f23b",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"command": "restore",
|
||||
"solution": "$(Parameters.solution)",
|
||||
"selectOrConfig": "select",
|
||||
"feedRestore": "",
|
||||
"includeNuGetOrg": "true",
|
||||
"nugetConfigPath": "",
|
||||
"externalEndpoints": "",
|
||||
"noCache": "false",
|
||||
"disableParallelProcessing": "false",
|
||||
"packagesDirectory": "",
|
||||
"verbosityRestore": "Detailed",
|
||||
"searchPatternPush": "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg",
|
||||
"nuGetFeedType": "internal",
|
||||
"feedPublish": "",
|
||||
"publishPackageMetadata": "true",
|
||||
"allowPackageConflicts": "false",
|
||||
"externalEndpoint": "",
|
||||
"verbosityPush": "Detailed",
|
||||
"searchPatternPack": "**/*.csproj",
|
||||
"configurationToPack": "$(BuildConfiguration)",
|
||||
"outputDir": "$(Build.ArtifactStagingDirectory)",
|
||||
"versioningScheme": "off",
|
||||
"includeReferencedProjects": "false",
|
||||
"versionEnvVar": "",
|
||||
"requestedMajorVersion": "1",
|
||||
"requestedMinorVersion": "0",
|
||||
"requestedPatchVersion": "0",
|
||||
"packTimezone": "utc",
|
||||
"includeSymbols": "false",
|
||||
"toolPackage": "false",
|
||||
"buildProperties": "",
|
||||
"basePath": "",
|
||||
"verbosityPack": "Detailed",
|
||||
"arguments": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "PowerShell Script",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"targetType": "inline",
|
||||
"filePath": "",
|
||||
"arguments": "",
|
||||
"script": "# Write your PowerShell commands here.\n\nWrite-Host \"Hello World\"\n",
|
||||
"errorActionPreference": "stop",
|
||||
"warningPreference": "default",
|
||||
"informationPreference": "default",
|
||||
"verbosePreference": "default",
|
||||
"debugPreference": "default",
|
||||
"failOnStderr": "false",
|
||||
"showWarnings": "false",
|
||||
"ignoreLASTEXITCODE": "false",
|
||||
"pwsh": "false",
|
||||
"workingDirectory": "",
|
||||
"runScriptInSeparateScope": "false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "Agent job 1",
|
||||
"refName": "Job_1",
|
||||
"condition": "succeeded()",
|
||||
"target": {
|
||||
"executionOptions": {
|
||||
"type": 0
|
||||
},
|
||||
"allowScriptsAuthAccessOption": false,
|
||||
"type": 1
|
||||
},
|
||||
"jobAuthorizationScope": 1
|
||||
}
|
||||
],
|
||||
"target": {
|
||||
"agentSpecification": {
|
||||
"identifier": "windows-latest"
|
||||
}
|
||||
},
|
||||
"type": 1
|
||||
},
|
||||
"repository": {
|
||||
"properties": {
|
||||
"cleanOptions": "0",
|
||||
"labelSources": "0",
|
||||
"labelSourcesFormat": "$(build.buildNumber)",
|
||||
"reportBuildStatus": "true",
|
||||
"gitLfsSupport": "false",
|
||||
"skipSyncSource": "false",
|
||||
"checkoutNestedSubmodules": "false",
|
||||
"fetchDepth": "0"
|
||||
},
|
||||
"id": "",
|
||||
"type": "TfsGit",
|
||||
"name": "REPOTOREPLACE",
|
||||
"url": "",
|
||||
"defaultBranch": "refs/heads/main",
|
||||
"clean": "false",
|
||||
"checkoutSubmodules": false
|
||||
},
|
||||
"processParameters": {
|
||||
"inputs": [
|
||||
{
|
||||
"aliases": [],
|
||||
"options": {},
|
||||
"properties": {},
|
||||
"name": "solution",
|
||||
"label": "Solution",
|
||||
"defaultValue": "**\\*.sln",
|
||||
"required": true,
|
||||
"type": "filePath",
|
||||
"helpMarkDown": "The path to the Visual Studio solution file or NuGet packages.config. Wildcards can be used. For example, `**\\\\*.sln` for all sln files in all sub folders."
|
||||
}
|
||||
]
|
||||
},
|
||||
"quality": 1,
|
||||
"authoredBy": {
|
||||
"displayName": "David Kalmin",
|
||||
"url": "https://spsprodcus5.vssps.visualstudio.com/A8ceff4ff-6429-4de3-9c39-fd7f0b1fb05a/_apis/Identities/a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"_links": {
|
||||
"avatar": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
}
|
||||
},
|
||||
"id": "a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"uniqueName": "[email protected]",
|
||||
"imageUrl": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0",
|
||||
"descriptor": "aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
},
|
||||
"drafts": [],
|
||||
"queue": {
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126"
|
||||
}
|
||||
},
|
||||
"name": "Azure Pipelines",
|
||||
"url": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126",
|
||||
"pool": {
|
||||
"name": "Azure Pipelines",
|
||||
"isHosted": true
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"name": "valet-classic-test-import1",
|
||||
"uri": "vstfs:///Build/Definition/10",
|
||||
"path": "\\",
|
||||
"type": 2,
|
||||
"queueStatus": 0,
|
||||
"revision": 1,
|
||||
"createdDate": "2022-02-17T19:05:52.500Z",
|
||||
}
|
||||
@@ -1,243 +0,0 @@
|
||||
{
|
||||
"options": [
|
||||
{
|
||||
"enabled": true,
|
||||
"definition": {
|
||||
"id": "5d58cc01-7c75-450c-be18-a388ddb129ec"
|
||||
},
|
||||
"inputs": {
|
||||
"branchFilters": "[\"+refs/heads/*\"]",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"definition": {
|
||||
"id": "a9db38f9-9fdc-478c-b0f9-464221e58316"
|
||||
},
|
||||
"inputs": {
|
||||
"workItemType": "Task",
|
||||
"assignToRequestor": "true",
|
||||
"additionalFields": "{}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"BuildConfiguration": {
|
||||
"value": "release",
|
||||
"allowOverride": true
|
||||
},
|
||||
"BuildPlatform": {
|
||||
"value": "any cpu",
|
||||
"allowOverride": true
|
||||
},
|
||||
"system.debug": {
|
||||
"value": "false",
|
||||
"allowOverride": true
|
||||
}
|
||||
},
|
||||
"properties": {},
|
||||
"tags": [],
|
||||
"_links": [],
|
||||
"buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)",
|
||||
"jobAuthorizationScope": 1,
|
||||
"jobTimeoutInMinutes": 60,
|
||||
"jobCancelTimeoutInMinutes": 5,
|
||||
"process": {
|
||||
"phases": [
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "Use NuGet 4.4.1",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "2c65196a-54fd-4a02-9be8-d9d1837b7c5d",
|
||||
"versionSpec": "0.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"versionSpec": "4.4.1",
|
||||
"checkLatest": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "NuGet restore",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "333b11bd-d341-40d9-afcf-b32d5ce6f23b",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"command": "restore",
|
||||
"solution": "$(Parameters.solution)",
|
||||
"selectOrConfig": "select",
|
||||
"feedRestore": "",
|
||||
"includeNuGetOrg": "true",
|
||||
"nugetConfigPath": "",
|
||||
"externalEndpoints": "",
|
||||
"noCache": "false",
|
||||
"disableParallelProcessing": "false",
|
||||
"packagesDirectory": "",
|
||||
"verbosityRestore": "Detailed",
|
||||
"searchPatternPush": "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg",
|
||||
"nuGetFeedType": "internal",
|
||||
"feedPublish": "",
|
||||
"publishPackageMetadata": "true",
|
||||
"allowPackageConflicts": "false",
|
||||
"externalEndpoint": "",
|
||||
"verbosityPush": "Detailed",
|
||||
"searchPatternPack": "**/*.csproj",
|
||||
"configurationToPack": "$(BuildConfiguration)",
|
||||
"outputDir": "$(Build.ArtifactStagingDirectory)",
|
||||
"versioningScheme": "off",
|
||||
"includeReferencedProjects": "false",
|
||||
"versionEnvVar": "",
|
||||
"requestedMajorVersion": "1",
|
||||
"requestedMinorVersion": "0",
|
||||
"requestedPatchVersion": "0",
|
||||
"packTimezone": "utc",
|
||||
"includeSymbols": "false",
|
||||
"toolPackage": "false",
|
||||
"buildProperties": "",
|
||||
"basePath": "",
|
||||
"verbosityPack": "Detailed",
|
||||
"arguments": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"environment": {},
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "PowerShell Script",
|
||||
"timeoutInMinutes": 0,
|
||||
"retryCountOnTaskFailure": 0,
|
||||
"condition": "succeeded()",
|
||||
"task": {
|
||||
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"targetType": "inline",
|
||||
"filePath": "",
|
||||
"arguments": "",
|
||||
"script": "# Write your PowerShell commands here.\n\nWrite-Host \"Hello World\"\n",
|
||||
"errorActionPreference": "stop",
|
||||
"warningPreference": "default",
|
||||
"informationPreference": "default",
|
||||
"verbosePreference": "default",
|
||||
"debugPreference": "default",
|
||||
"failOnStderr": "false",
|
||||
"showWarnings": "false",
|
||||
"ignoreLASTEXITCODE": "false",
|
||||
"pwsh": "false",
|
||||
"workingDirectory": "",
|
||||
"runScriptInSeparateScope": "false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "Agent job 1",
|
||||
"refName": "Job_1",
|
||||
"condition": "succeeded()",
|
||||
"target": {
|
||||
"executionOptions": {
|
||||
"type": 0
|
||||
},
|
||||
"allowScriptsAuthAccessOption": false,
|
||||
"type": 1
|
||||
},
|
||||
"jobAuthorizationScope": 1
|
||||
}
|
||||
],
|
||||
"target": {
|
||||
"agentSpecification": {
|
||||
"identifier": "windows-latest"
|
||||
}
|
||||
},
|
||||
"type": 1
|
||||
},
|
||||
"repository": {
|
||||
"properties": {
|
||||
"cleanOptions": "0",
|
||||
"labelSources": "0",
|
||||
"labelSourcesFormat": "$(build.buildNumber)",
|
||||
"reportBuildStatus": "true",
|
||||
"gitLfsSupport": "false",
|
||||
"skipSyncSource": "false",
|
||||
"checkoutNestedSubmodules": "false",
|
||||
"fetchDepth": "0"
|
||||
},
|
||||
"id": "",
|
||||
"type": "TfsGit",
|
||||
"name": "REPOTOREPLACE",
|
||||
"url": "",
|
||||
"defaultBranch": "refs/heads/main",
|
||||
"clean": "false",
|
||||
"checkoutSubmodules": false
|
||||
},
|
||||
"processParameters": {
|
||||
"inputs": [
|
||||
{
|
||||
"aliases": [],
|
||||
"options": {},
|
||||
"properties": {},
|
||||
"name": "solution",
|
||||
"label": "Solution",
|
||||
"defaultValue": "**\\*.sln",
|
||||
"required": true,
|
||||
"type": "filePath",
|
||||
"helpMarkDown": "The path to the Visual Studio solution file or NuGet packages.config. Wildcards can be used. For example, `**\\\\*.sln` for all sln files in all sub folders."
|
||||
}
|
||||
]
|
||||
},
|
||||
"quality": 1,
|
||||
"authoredBy": {
|
||||
"displayName": "David Kalmin",
|
||||
"url": "https://spsprodcus5.vssps.visualstudio.com/A8ceff4ff-6429-4de3-9c39-fd7f0b1fb05a/_apis/Identities/a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"_links": {
|
||||
"avatar": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
}
|
||||
},
|
||||
"id": "a886d3a4-5700-6920-a3e4-6dadf46e7614",
|
||||
"uniqueName": "[email protected]",
|
||||
"imageUrl": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0",
|
||||
"descriptor": "aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0"
|
||||
},
|
||||
"drafts": [],
|
||||
"queue": {
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126"
|
||||
}
|
||||
},
|
||||
"name": "Azure Pipelines",
|
||||
"url": "https://dev.azure.com/microsoft-bootcamp/_apis/build/Queues/126",
|
||||
"pool": {
|
||||
"name": "Azure Pipelines",
|
||||
"isHosted": true
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"name": "valet-classic-test-import2",
|
||||
"uri": "vstfs:///Build/Definition/10",
|
||||
"path": "\\",
|
||||
"type": 2,
|
||||
"queueStatus": 0,
|
||||
"revision": 1,
|
||||
"createdDate": "2022-02-17T19:05:52.500Z",
|
||||
}
|
||||
+56
-109
@@ -3,118 +3,63 @@
|
||||
This lab bootstraps a Valet environment using GitHub Codespaces and enables you to create an Azure DevOps project against which to run the Valet CI/CD migration tool.
|
||||
|
||||
- [Use this Repo as a template](#repo-template)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Codespace secrets](#codespace-secrets)
|
||||
- [Action secrets](#action-secrets)
|
||||
- [Azure DevOps project creation](#azure-devops-project-creation)
|
||||
- [Use Valet with a codespace](#use-valet-with-a-codespace)
|
||||
- [Bootstrap an Azure DevOps organization](#bootstrap-your-azure-devops-organization)
|
||||
- [Labs for Azure DevOps](#labs-for-azure-devops)
|
||||
|
||||
## Repo template
|
||||
|
||||
1. Verify you are in your own Repository created from the landing page [Valet Labs](https://github.com/valet-customers/labs).
|
||||
|
||||
## Prerequisites
|
||||
1. Azure DevOps organization. Please identify or create an Azure DevOps organization to use: [Click to create an Azure DevOps Org](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?toc=%2Fazure%2Fdevops%2Fget-started%2Ftoc.json&bc=%2Fazure%2Fdevops%2Fget-started%2Fbreadcrumb%2Ftoc.json&view=azure-devops)
|
||||
- Note and store the Azure DevOp sorganization name for later.
|
||||
- Note and store the user name you use for your Azure DevOps Organization. It will be an email address.
|
||||
2. Azure DevOps Project. The default project name for this lab is `ValetBootstrap` There is an Action workflow that will create and populate the Azure DevOps project. No need to create it yourself. Note: The project has to be unique in the Azure DevOps organization. If you already have a project name `ValetBootstrap` please pick a different unique project name.
|
||||
- Note and store the Azure DevOps project name for later.
|
||||
3. Create an Azure DevOps personal access token with the following scopes:
|
||||
- To do so, navigate to Sign in to your organization `https://dev.azure.com/{yourorganization}`.
|
||||
- Click your `Account management` icon
|
||||
- Click `user settings`
|
||||
- Click `Personal access tokens`.
|
||||
- Select `+ New Token`
|
||||
- Name your token, select the organization where you want to use the token, and then set your token to automatically expire after a set number of days.
|
||||
- Select the following scopes (Click `Show more scopes` if you don't see all of the below):
|
||||
- Agents Pool: `Read`
|
||||
- Build: `Read & Execute`
|
||||
- Code: `Read & Write`
|
||||
- Project and Team: `Read, Write, & Manage`
|
||||
- Release: `Read`
|
||||
- Service Connections: `Read`
|
||||
- Task Groups: `Read`
|
||||
- Variable Groups: `Read`
|
||||
- Click `Create`
|
||||
- Copy the PAT somewhere safe and temporary.
|
||||
4. Create a GitHub personal access token.
|
||||
- To do so, navigate to your GitHub `Settings` - click your profile photo and then click `Settings`.
|
||||
- Go to `Developer Settings`
|
||||
- Go to `Personal Access Tokens` -> `Legacy tokens (if present)`
|
||||
- Click `Generate new token` -> `Legacy tokens (if present)`. If required, provide your password.
|
||||
- Select at least these scopes: `read packages` and `workflow`. Optionally, provide a text in the **Note** field and change the expiration.
|
||||
- Click `Generate token`
|
||||
- Copy the PAT somewhere safe and temporary.
|
||||
|
||||
## Codespace secrets
|
||||
Please add the following Codespace secrets.
|
||||
|
||||
- `VALET_GHCR_PASSWORD`: Add `VALET_GHCR_PASSWORD` as the `Name` and the GitHub personal access token created above as the value.
|
||||
- `AZURE_DEVOPS_ACCESS_TOKEN`: Add `AZURE_DEVOPS_ACCESS_TOKEN` as the `Name` and the Azure DevOps personal access token created above as the value.
|
||||
- `AZURE_DEVOPS_ORGANIZATION`: Add `AZURE_DEVOPS_ORGANIZATION` as the `Name` and the Azure DevOps organization noted above as the value.
|
||||
- `AZURE_DEVOPS_PROJECT`: Add `AZURE_DEVOPS_PROJECT` as the `Name` and the Azure DevOps project noted above as the value.
|
||||
|
||||
Steps to create the Codespace secrets. Complete for secret noted above:
|
||||
|
||||
- Navigate to the `Settings` tab in this repo
|
||||
- Find `Secrets` and click the down arrow
|
||||
- Click `Codespaces`
|
||||
- Click `New Repository Secret` to create a new secret
|
||||
- Name the secret as noted above
|
||||
- Paste in the value noted above
|
||||
- Click `Add Secret`
|
||||
|
||||
## Action secrets
|
||||
Please add the following Action secrets.
|
||||
|
||||
- `AZURE_DEVOPS_ACCESS_TOKEN`: Add `AZURE_DEVOPS_ACCESS_TOKEN` as the `Name` and the Azure DevOps personal access token created above as the value.
|
||||
|
||||
Steps to create the Actions secret. Complete for secret noted above:
|
||||
|
||||
- Navigate to the `Settings` tab in this repo
|
||||
- Find `Secrets` and click the down arrow
|
||||
- Click `Actions`
|
||||
- Click `New Repository Secret` to create a new secret
|
||||
- Name the secret as noted above
|
||||
- Paste in the value noted above
|
||||
- Click `Add Secret`
|
||||
|
||||
## Azure DevOps project creation
|
||||
|
||||
Run the Actions workflow:
|
||||
- CLick the `Actions` tab
|
||||
- Select the `Valet Bootstrap for Azure DevOps` action
|
||||
- Click `Run Workflow`
|
||||
- Input the Azure DevOps Organization name identified above
|
||||
- Input the Azure DevOps user name of the user that created the Azure DevOps PAT above. This will be an email address
|
||||
- Accept the default Azure DevOps project name or change it to one of your preference
|
||||
- NOTE: The default project name is `ValetBootstrap`. This must be unique in your Azure DevOps Organization. If not, please choose a unique name.
|
||||
- Click `Run Workflow`
|
||||
- Verify the workflow completed successfully. If the workflow did not run successfully you will see a detailed error message.
|
||||
|
||||
### Example ###
|
||||

|
||||
|
||||
|
||||
## Use Valet with a codespace
|
||||
|
||||
1. Start the codespace
|
||||
- Click the `Code` with button down arrow above repository on the repository's landing page.
|
||||
- Click the `Codespaces` tab
|
||||
- Click `Create codespaces on main` to create the codespace. If you are in another branch then the `main` branch, the codespace will button will have the current branch specified.
|
||||
- Wait a couple minutes, then verify that the codespace starts up. Once it is fully booted up, the termininal should be present.
|
||||
2. Verify Valet CLI is installed and working. More information on the [GitHub Valet CLI extension](https://github.com/github/gh-valet)
|
||||
- Verify Valet CLI is installed and working
|
||||
- Run `gh valet version` in the Visual Studio Code terminal and verify the output looks like the below image. Note the valet version will be different than below as the latest version gets pulled down.
|
||||
- If `gh valet version` did not produce a similar image with a version please follow these instructions [Troubleshoot GH Valet extension](#troubleshoot-gh-valet-extension)
|
||||
- Start using Valet by following along with the [Labs for Azure DevOps](#labs-for-azure-devops)
|
||||
|
||||
### Example ###
|
||||

|
||||
|
||||
- Click the `Code` with button down arrow above repository on the repository's landing page.
|
||||
- Click the `Codespaces` tab
|
||||
- Click `Create codespaces on main` to create the codespace. If you are in another branch then the `main` branch, the codespace will button will have the current branch specified.
|
||||
- Wait a couple minutes, then verify that the codespace starts up. Once it is fully booted up, the terminal should be present.
|
||||
|
||||
2. Verify the [extension](https://github.com/github/gh-valet) to the official GitHub CLI for Valet is installed and working.
|
||||
|
||||
- Run `gh valet version` in the Visual Studio Code terminal and verify the output looks like the below image. Note the valet version will be different than below as the latest version gets pulled down.
|
||||
- If `gh valet version` did not produce a similar image with a version please follow these instructions [Troubleshoot GH Valet extension](#troubleshoot-gh-valet-extension)
|
||||
|
||||
-----
|
||||
|
||||
## Bootstrap your Azure DevOps organization
|
||||
|
||||
1. Create an Azure DevOps personal access token with the following scopes:
|
||||
|
||||
- To do so, navigate to your organization `https://dev.azure.com/{organization}`.
|
||||
- Click `User settings` in the top right corner of the screen.
|
||||
- Click `Personal access tokens`.
|
||||
- Select `+ New Token`
|
||||
- Name your token, select the organization where you want to use the token, and then set your token to automatically expire after a set number of days.
|
||||
- Select the following scopes (Click `Show more scopes` if you don't see all of the below):
|
||||
- Agents Pool: `Read`
|
||||
- Build: `Read & Execute`
|
||||
- Code: `Read & Write`
|
||||
- Project and Team: `Read, Write, & Manage`
|
||||
- Release: `Read`
|
||||
- Service Connections: `Read`
|
||||
- Task Groups: `Read`
|
||||
- Variable Groups: `Read`
|
||||
- Click `Create`
|
||||
- Copy the PAT somewhere safe and temporary.
|
||||
|
||||
2. Run the Azure DevOps setup script. This script will create an Azure DevOps project and ensure it is ready to be used in the following labs. This script should only need to be run once.
|
||||
|
||||
- Navigate to the terminal within your Codespace.
|
||||
- Run `./azure_devops/bootstrap/setup --organization :organization --project :project --access-token :access-token` while replacing these values:
|
||||
- `:organization`: the name of your existing Azure DevOps organization
|
||||
- `:project`: the name of the project to be created in your Azure DevOps organization
|
||||
- `:access_token`: the PAT created in step 1 above
|
||||
- Once this script completes, you will see a new project in your Azure DevOps organization that is populated with some pipelines.
|
||||
|
||||
## Labs for Azure DevOps
|
||||
Perform the following labs to test-drive Valet
|
||||
|
||||
Perform the following labs to learn how to migrate Azure DevOps pipelines to GitHub Actions using Valet:
|
||||
|
||||
- [Audit Azure DevOps pipelines using the Valet audit command](valet-audit-lab.md)
|
||||
- [Dry run the migration of an Azure DevOps pipeline to GitHub Actions](valet-dry-run-lab.md)
|
||||
- [Migrate an Azure DevOps pipeline to GitHub Actions](valet-migrate-lab.md)
|
||||
@@ -122,12 +67,14 @@ Perform the following labs to test-drive Valet
|
||||
- [Forecast: Valet forecast lab](valet-forecast-lab.md)
|
||||
|
||||
## Troubleshoot GH Valet extension
|
||||
Manually Install the GitHub CLI Valet extension. More information on the [GitHub Valet CLI extension](https://github.com/github/gh-valet)
|
||||
- Verify you are in the Visual Studio Code terminal
|
||||
- Run this command to install the GitHub Valet extension
|
||||
- `gh extension install github/gh-valet`
|
||||
- Verify the result of the install is: `✓ Installed extension github/gh-valet`
|
||||
- If you get a similiar error to the following, click the link to authorize the token
|
||||
|
||||
Manually installing the [extension](https://github.com/github/gh-valet) to the official GitHub CLI for Valet:
|
||||
|
||||
- Verify you are in the Visual Studio Code terminal
|
||||
- Run this command to install the GitHub Valet extension
|
||||
- `gh extension install github/gh-valet`
|
||||
- Verify the result of the install is: `✓ Installed extension github/gh-valet`
|
||||
- If you get a similar error to the following, click the link to authorize the token
|
||||

|
||||
- Restart Codespace after clicking the link
|
||||
- Verify Valet CLI is installed and working
|
||||
- Restart Codespace after clicking the link
|
||||
- Verify the Valet CLI is installed and working by running the `gh valet version` command
|
||||
|
||||
@@ -15,9 +15,9 @@ In this lab, you will create a custom plugin that transforms some of the existin
|
||||
4. Complete the [Valet migrate lab](valet-migrate-lab.md).
|
||||
|
||||
## Identify the Azure DevOps pipeline ID to use
|
||||
You will need the `valet-mapper-example` Azure DevOps pipeline ID to perform the migration
|
||||
You will need the `valet-custom-transformer-example` Azure DevOps pipeline ID to perform the migration
|
||||
1. Go to the `valet/ValetBootstrap/pipelines` folder
|
||||
2. Open the `valet/ValetBootstrap/pipelines/valet-mapper-example.config.json` file
|
||||
2. Open the `valet/ValetBootstrap/pipelines/valet-custom-transformer-example.config.json` file
|
||||
3. Look for the `web - href` link
|
||||
4. At the end of the link is the pipeline ID. Copy or note the ID.
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# code folder
|
||||
This folder contains a dotnet core application used for building puproses with the CI/CD selected.
|
||||
|
||||
### Note any file added to this folder or sub folders will get migrated to the Azure DevOps instance when the GitHub Action runs to create and bootstrap the Azure DevOps project
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
GITHUB_ACCESS_TOKEN=
|
||||
GITHUB_INSTANCE_URL=
|
||||
|
||||
AZURE_DEVOPS_PROJECT=
|
||||
AZURE_DEVOPS_ORGANIZATION=
|
||||
AZURE_DEVOPS_INSTANCE_URL=
|
||||
AZURE_DEVOPS_ACCESS_TOKEN=
|
||||
Reference in New Issue
Block a user