From c2be99307672eccf37fad72f572e052963a6cc04 Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Tue, 23 Aug 2022 09:15:23 -0700 Subject: [PATCH 1/7] Move azdo assets into bootstrap directory --- .../bootstrap/code}/Bootcamp.sln | 112 +++++++++--------- .../bootstrap/code}/src/Attendee/Attendee.cs | 30 ++--- .../code}/src/Attendee/Attendee.csproj | 14 +-- .../code}/test/AttendeeTest/AttendeeExists.cs | 36 +++--- .../test/AttendeeTest/AttendeeTest.csproj | 52 ++++---- .../pipelines/classic/valet-classic1.json | 0 .../pipelines/classic/valet-classic2.json | 0 .../{ => bootstrap}/pipelines/readme.md | 0 .../pipelines/yml/valet-mapper-example.yml | 0 .../pipelines/yml/valet-pipeline1.yml | 0 .../pipelines/yml/valet-pipeline2.yml | 0 code/readme.md | 5 - valet/.env.local.template | 7 -- 13 files changed, 122 insertions(+), 134 deletions(-) rename {code => azure_devops/bootstrap/code}/Bootcamp.sln (98%) rename {code => azure_devops/bootstrap/code}/src/Attendee/Attendee.cs (94%) rename {code => azure_devops/bootstrap/code}/src/Attendee/Attendee.csproj (94%) rename {code => azure_devops/bootstrap/code}/test/AttendeeTest/AttendeeExists.cs (95%) rename {code => azure_devops/bootstrap/code}/test/AttendeeTest/AttendeeTest.csproj (97%) rename azure_devops/{ => bootstrap}/pipelines/classic/valet-classic1.json (100%) rename azure_devops/{ => bootstrap}/pipelines/classic/valet-classic2.json (100%) rename azure_devops/{ => bootstrap}/pipelines/readme.md (100%) rename azure_devops/{ => bootstrap}/pipelines/yml/valet-mapper-example.yml (100%) rename azure_devops/{ => bootstrap}/pipelines/yml/valet-pipeline1.yml (100%) rename azure_devops/{ => bootstrap}/pipelines/yml/valet-pipeline2.yml (100%) delete mode 100644 code/readme.md delete mode 100644 valet/.env.local.template diff --git a/code/Bootcamp.sln b/azure_devops/bootstrap/code/Bootcamp.sln similarity index 98% rename from code/Bootcamp.sln rename to azure_devops/bootstrap/code/Bootcamp.sln index 099b74f..005c7db 100644 --- a/code/Bootcamp.sln +++ b/azure_devops/bootstrap/code/Bootcamp.sln @@ -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 diff --git a/code/src/Attendee/Attendee.cs b/azure_devops/bootstrap/code/src/Attendee/Attendee.cs similarity index 94% rename from code/src/Attendee/Attendee.cs rename to azure_devops/bootstrap/code/src/Attendee/Attendee.cs index 37e4c52..5fd4008 100644 --- a/code/src/Attendee/Attendee.cs +++ b/azure_devops/bootstrap/code/src/Attendee/Attendee.cs @@ -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; + } + } +} diff --git a/code/src/Attendee/Attendee.csproj b/azure_devops/bootstrap/code/src/Attendee/Attendee.csproj similarity index 94% rename from code/src/Attendee/Attendee.csproj rename to azure_devops/bootstrap/code/src/Attendee/Attendee.csproj index 563e6f9..f208d30 100644 --- a/code/src/Attendee/Attendee.csproj +++ b/azure_devops/bootstrap/code/src/Attendee/Attendee.csproj @@ -1,7 +1,7 @@ - - - - net5.0 - - - + + + + net5.0 + + + diff --git a/code/test/AttendeeTest/AttendeeExists.cs b/azure_devops/bootstrap/code/test/AttendeeTest/AttendeeExists.cs similarity index 95% rename from code/test/AttendeeTest/AttendeeExists.cs rename to azure_devops/bootstrap/code/test/AttendeeTest/AttendeeExists.cs index 70e3b6d..12134ca 100644 --- a/code/test/AttendeeTest/AttendeeExists.cs +++ b/azure_devops/bootstrap/code/test/AttendeeTest/AttendeeExists.cs @@ -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"); + } + } +} diff --git a/code/test/AttendeeTest/AttendeeTest.csproj b/azure_devops/bootstrap/code/test/AttendeeTest/AttendeeTest.csproj similarity index 97% rename from code/test/AttendeeTest/AttendeeTest.csproj rename to azure_devops/bootstrap/code/test/AttendeeTest/AttendeeTest.csproj index 8b41439..8f533dd 100644 --- a/code/test/AttendeeTest/AttendeeTest.csproj +++ b/azure_devops/bootstrap/code/test/AttendeeTest/AttendeeTest.csproj @@ -1,26 +1,26 @@ - - - - net5.0 - - false - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - + + + + net5.0 + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/azure_devops/pipelines/classic/valet-classic1.json b/azure_devops/bootstrap/pipelines/classic/valet-classic1.json similarity index 100% rename from azure_devops/pipelines/classic/valet-classic1.json rename to azure_devops/bootstrap/pipelines/classic/valet-classic1.json diff --git a/azure_devops/pipelines/classic/valet-classic2.json b/azure_devops/bootstrap/pipelines/classic/valet-classic2.json similarity index 100% rename from azure_devops/pipelines/classic/valet-classic2.json rename to azure_devops/bootstrap/pipelines/classic/valet-classic2.json diff --git a/azure_devops/pipelines/readme.md b/azure_devops/bootstrap/pipelines/readme.md similarity index 100% rename from azure_devops/pipelines/readme.md rename to azure_devops/bootstrap/pipelines/readme.md diff --git a/azure_devops/pipelines/yml/valet-mapper-example.yml b/azure_devops/bootstrap/pipelines/yml/valet-mapper-example.yml similarity index 100% rename from azure_devops/pipelines/yml/valet-mapper-example.yml rename to azure_devops/bootstrap/pipelines/yml/valet-mapper-example.yml diff --git a/azure_devops/pipelines/yml/valet-pipeline1.yml b/azure_devops/bootstrap/pipelines/yml/valet-pipeline1.yml similarity index 100% rename from azure_devops/pipelines/yml/valet-pipeline1.yml rename to azure_devops/bootstrap/pipelines/yml/valet-pipeline1.yml diff --git a/azure_devops/pipelines/yml/valet-pipeline2.yml b/azure_devops/bootstrap/pipelines/yml/valet-pipeline2.yml similarity index 100% rename from azure_devops/pipelines/yml/valet-pipeline2.yml rename to azure_devops/bootstrap/pipelines/yml/valet-pipeline2.yml diff --git a/code/readme.md b/code/readme.md deleted file mode 100644 index d58f7e7..0000000 --- a/code/readme.md +++ /dev/null @@ -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 - diff --git a/valet/.env.local.template b/valet/.env.local.template deleted file mode 100644 index ce4ca6f..0000000 --- a/valet/.env.local.template +++ /dev/null @@ -1,7 +0,0 @@ -GITHUB_ACCESS_TOKEN= -GITHUB_INSTANCE_URL= - -AZURE_DEVOPS_PROJECT= -AZURE_DEVOPS_ORGANIZATION= -AZURE_DEVOPS_INSTANCE_URL= -AZURE_DEVOPS_ACCESS_TOKEN= From 0b691536d496d88277c660846e23c8cbec354155 Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Tue, 23 Aug 2022 15:03:43 -0700 Subject: [PATCH 2/7] Add setup script to seed azdo project --- .../pipelines/classic/valet-classic1.json | 452 +++++++++--------- .../pipelines/classic/valet-classic2.json | 452 +++++++++--------- ...l => valet-custom-transformer-example.yml} | 0 azure_devops/bootstrap/setup | 178 +++++++ azure_devops/valet-migrate-custom-lab.md | 4 +- 5 files changed, 632 insertions(+), 454 deletions(-) rename azure_devops/bootstrap/pipelines/yml/{valet-mapper-example.yml => valet-custom-transformer-example.yml} (100%) create mode 100755 azure_devops/bootstrap/setup diff --git a/azure_devops/bootstrap/pipelines/classic/valet-classic1.json b/azure_devops/bootstrap/pipelines/classic/valet-classic1.json index 1ade862..43052b4 100644 --- a/azure_devops/bootstrap/pipelines/classic/valet-classic1.json +++ b/azure_devops/bootstrap/pipelines/classic/valet-classic1.json @@ -1,243 +1,243 @@ { - "options": [ - { + "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, - "definition": { - "id": "5d58cc01-7c75-450c-be18-a388ddb129ec" + "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": { - "branchFilters": "[\"+refs/heads/*\"]", - "additionalFields": "{}" + "versionSpec": "4.4.1", + "checkLatest": "false" } - }, - { - "enabled": false, - "definition": { - "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + { + "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": { - "workItemType": "Task", - "assignToRequestor": "true", - "additionalFields": "{}" + "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": "" } - } - ], - "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 + }, + { + "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": { - "agentSpecification": { - "identifier": "windows-latest" - } + "executionOptions": { + "type": 0 + }, + "allowScriptsAuthAccessOption": false, + "type": 1 }, - "type": 1 + "jobAuthorizationScope": 1 + } + ], + "target": { + "agentSpecification": { + "identifier": "windows-latest" + } }, - "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 + "type": 1 + }, + "repository": { + "properties": { + "cleanOptions": "0", + "labelSources": "0", + "labelSourcesFormat": "$(build.buildNumber)", + "reportBuildStatus": "true", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "checkoutNestedSubmodules": "false", + "fetchDepth": "0" }, - "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." - } - ] + "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" + } }, - "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": "davidkalmin@microsoft.com", - "imageUrl": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0", - "descriptor": "aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0" + "id": "a886d3a4-5700-6920-a3e4-6dadf46e7614", + "uniqueName": "davidkalmin@microsoft.com", + "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" + } }, - "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", + "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" } diff --git a/azure_devops/bootstrap/pipelines/classic/valet-classic2.json b/azure_devops/bootstrap/pipelines/classic/valet-classic2.json index fa966c1..b368aa1 100644 --- a/azure_devops/bootstrap/pipelines/classic/valet-classic2.json +++ b/azure_devops/bootstrap/pipelines/classic/valet-classic2.json @@ -1,243 +1,243 @@ { - "options": [ - { + "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, - "definition": { - "id": "5d58cc01-7c75-450c-be18-a388ddb129ec" + "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": { - "branchFilters": "[\"+refs/heads/*\"]", - "additionalFields": "{}" + "versionSpec": "4.4.1", + "checkLatest": "false" } - }, - { - "enabled": false, - "definition": { - "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" + }, + { + "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": { - "workItemType": "Task", - "assignToRequestor": "true", - "additionalFields": "{}" + "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": "" } - } - ], - "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 + }, + { + "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": { - "agentSpecification": { - "identifier": "windows-latest" - } + "executionOptions": { + "type": 0 + }, + "allowScriptsAuthAccessOption": false, + "type": 1 }, - "type": 1 + "jobAuthorizationScope": 1 + } + ], + "target": { + "agentSpecification": { + "identifier": "windows-latest" + } }, - "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 + "type": 1 + }, + "repository": { + "properties": { + "cleanOptions": "0", + "labelSources": "0", + "labelSourcesFormat": "$(build.buildNumber)", + "reportBuildStatus": "true", + "gitLfsSupport": "false", + "skipSyncSource": "false", + "checkoutNestedSubmodules": "false", + "fetchDepth": "0" }, - "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." - } - ] + "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" + } }, - "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": "davidkalmin@microsoft.com", - "imageUrl": "https://dev.azure.com/microsoft-bootcamp/_apis/GraphProfile/MemberAvatars/aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0", - "descriptor": "aad.YTg4NmQzYTQtNTcwMC03OTIwLWEzZTQtNmRhZGY0NmU3NjE0" + "id": "a886d3a4-5700-6920-a3e4-6dadf46e7614", + "uniqueName": "davidkalmin@microsoft.com", + "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" + } }, - "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", + "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" } diff --git a/azure_devops/bootstrap/pipelines/yml/valet-mapper-example.yml b/azure_devops/bootstrap/pipelines/yml/valet-custom-transformer-example.yml similarity index 100% rename from azure_devops/bootstrap/pipelines/yml/valet-mapper-example.yml rename to azure_devops/bootstrap/pipelines/yml/valet-custom-transformer-example.yml diff --git a/azure_devops/bootstrap/setup b/azure_devops/bootstrap/setup new file mode 100755 index 0000000..e225a95 --- /dev/null +++ b/azure_devops/bootstrap/setup @@ -0,0 +1,178 @@ +#!/usr/bin/env ruby +require "json" +require "net/http" +require "optparse" +require "pathname" +require "pry" + +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!" \ No newline at end of file diff --git a/azure_devops/valet-migrate-custom-lab.md b/azure_devops/valet-migrate-custom-lab.md index eb7ca67..ffe7725 100644 --- a/azure_devops/valet-migrate-custom-lab.md +++ b/azure_devops/valet-migrate-custom-lab.md @@ -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. From 3e863042a12bd4c9358cb0b70b89ffd1a369280a Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Tue, 23 Aug 2022 15:22:48 -0700 Subject: [PATCH 3/7] Update azure devops setup instructions --- .devcontainer/devcontainer.json | 8 +- .devcontainer/setupcodespace.sh | 28 ---- .github/workflows/valetbsazdo.yml | 35 ----- azure_devops/bootstrap/azDevOps.ps1 | 235 ---------------------------- azure_devops/readme.md | 158 +++++++------------ azure_devops/valet-configure-lab.md | 0 6 files changed, 57 insertions(+), 407 deletions(-) delete mode 100644 .devcontainer/setupcodespace.sh delete mode 100644 .github/workflows/valetbsazdo.yml delete mode 100644 azure_devops/bootstrap/azDevOps.ps1 create mode 100644 azure_devops/valet-configure-lab.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8c3f8c2..c0cd1c0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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.' " } diff --git a/.devcontainer/setupcodespace.sh b/.devcontainer/setupcodespace.sh deleted file mode 100644 index c98469a..0000000 --- a/.devcontainer/setupcodespace.sh +++ /dev/null @@ -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" diff --git a/.github/workflows/valetbsazdo.yml b/.github/workflows/valetbsazdo.yml deleted file mode 100644 index bdcda6f..0000000 --- a/.github/workflows/valetbsazdo.yml +++ /dev/null @@ -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 diff --git a/azure_devops/bootstrap/azDevOps.ps1 b/azure_devops/bootstrap/azDevOps.ps1 deleted file mode 100644 index 8e36704..0000000 --- a/azure_devops/bootstrap/azDevOps.ps1 +++ /dev/null @@ -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" diff --git a/azure_devops/readme.md b/azure_devops/readme.md index ba0c2e5..3c75df0 100644 --- a/azure_devops/readme.md +++ b/azure_devops/readme.md @@ -14,107 +14,55 @@ This lab bootstraps a Valet environment using GitHub Codespaces and enables you 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 ### -![runaction](https://user-images.githubusercontent.com/26442605/167679930-9bdf6f4f-2e94-4145-aed3-8ee3e8e91d90.png) - - ## 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 ### -![gh-valet-version](https://user-images.githubusercontent.com/26442605/170106559-e69e669f-a1f6-4c2c-8998-3f089b899704.png) + +- 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 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 environment + +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 `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 +70,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 similiar error to the following, click the link to authorize the token ![linktolcickauth](https://user-images.githubusercontent.com/26442605/169588015-9414404f-82b6-4d0f-89d4-5f0e6941b029.png) - - 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 diff --git a/azure_devops/valet-configure-lab.md b/azure_devops/valet-configure-lab.md new file mode 100644 index 0000000..e69de29 From f863afe6d9076cbc6269b314335d955aebb03076 Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Wed, 24 Aug 2022 14:49:48 -0700 Subject: [PATCH 4/7] Update azure_devops/bootstrap/setup Co-authored-by: Luke Engle <99493186+luke-engle@users.noreply.github.com> --- azure_devops/bootstrap/setup | 1 - 1 file changed, 1 deletion(-) diff --git a/azure_devops/bootstrap/setup b/azure_devops/bootstrap/setup index e225a95..e7e0533 100755 --- a/azure_devops/bootstrap/setup +++ b/azure_devops/bootstrap/setup @@ -3,7 +3,6 @@ require "json" require "net/http" require "optparse" require "pathname" -require "pry" options = { code_assets_dir: "code", From 8dcde1f13c3a8d833b0c8cf0dcb155095f21d678 Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Wed, 24 Aug 2022 14:50:15 -0700 Subject: [PATCH 5/7] Update azure_devops/readme.md Co-authored-by: Luke Engle <99493186+luke-engle@users.noreply.github.com> --- azure_devops/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/azure_devops/readme.md b/azure_devops/readme.md index 3c75df0..9b64c8f 100644 --- a/azure_devops/readme.md +++ b/azure_devops/readme.md @@ -35,6 +35,7 @@ This lab bootstraps a Valet environment using GitHub Codespaces and enables you 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. From 8111e4b22380e42c49582bc250da8fe0663a4e05 Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Wed, 24 Aug 2022 14:53:28 -0700 Subject: [PATCH 6/7] Update links in readme --- azure_devops/readme.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/azure_devops/readme.md b/azure_devops/readme.md index 9b64c8f..db0a822 100644 --- a/azure_devops/readme.md +++ b/azure_devops/readme.md @@ -3,11 +3,7 @@ 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 @@ -30,7 +26,7 @@ This lab bootstraps a Valet environment using GitHub Codespaces and enables you ----- -## Bootstrap your Azure DevOps environment +## Bootstrap your Azure DevOps organization 1. Create an Azure DevOps personal access token with the following scopes: From 3a61e7530dd8217ec368dba8e4076f36269f1796 Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Thu, 25 Aug 2022 08:34:40 -0700 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Begona Guereca --- azure_devops/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure_devops/readme.md b/azure_devops/readme.md index db0a822..3c9505e 100644 --- a/azure_devops/readme.md +++ b/azure_devops/readme.md @@ -17,7 +17,7 @@ This lab bootstraps a Valet environment using GitHub Codespaces and enables you - 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. +- 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. @@ -74,7 +74,7 @@ Manually installing the [extension](https://github.com/github/gh-valet) to the o - 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 +- If you get a similar error to the following, click the link to authorize the token ![linktolcickauth](https://user-images.githubusercontent.com/26442605/169588015-9414404f-82b6-4d0f-89d4-5f0e6941b029.png) - Restart Codespace after clicking the link - Verify the Valet CLI is installed and working by running the `gh valet version` command