Read azure devops assets from tarball

This commit is contained in:
Ethan Dennis
2022-09-14 11:27:10 -07:00
parent 424bada4f3
commit b1f13f800b
14 changed files with 34 additions and 1970 deletions
Binary file not shown.
-56
View File
@@ -1,56 +0,0 @@
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
@@ -1,15 +0,0 @@
using System;
namespace Attendees
{
public class Attendee
{
public bool AddAttendee(string added)
{
if (added == "exists")
return true;
return false;
}
}
}
@@ -1,7 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
@@ -1,18 +0,0 @@
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");
}
}
}
@@ -1,26 +0,0 @@
<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>
File diff suppressed because it is too large Load Diff
@@ -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": "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"
}
},
"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": "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"
}
},
"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"
}
@@ -1,10 +0,0 @@
# pipelines folder
This folder contains Azure DevOps pipelines that gets migrated to the Azure DevOps instance.
### 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
## classic folder
The classic folder contains classic style Azure DevOps pipelines that are pure JSON files.
## yml folder
The yml folder contains yml Azure DevOps pipelines.
@@ -1,26 +0,0 @@
variables:
- name: BuildParameters.RESTOREBUILDPROJECTS
value: "**/*.csproj"
- name: BUILDCONFIGURATION
value: Release
name: "custom-transformer-example"
jobs:
- job: Job_1
displayName: Agent job 1
pool: "mechamachine"
steps:
- checkout: self
- task: NodeTool@0
displayName: Use Node 10.16.3
inputs:
versionSpec: 10.16.3
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: "$(BuildParameters.RESTOREBUILDPROJECTS)"
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: "$(BuildParameters.RESTOREBUILDPROJECTS)"
arguments: "--configuration $(BUILDCONFIGURATION)"
@@ -1,19 +0,0 @@
# Bootcap Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: windows-latest
steps:
- script: echo Hello, I am pipeline 1!
displayName: 'Run a one-line script'
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
@@ -1,18 +0,0 @@
# Bootcap Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool: mechamachine
steps:
- script: echo Hello, I am pipeline 2!
displayName: "Run a one-line script"
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: "Run a multi-line script"
+34 -27
View File
@@ -1,15 +1,16 @@
#!/usr/bin/env ruby
require "date"
require "json"
require "net/http"
require "open3"
require "optparse"
require "pathname"
require "date"
require "tmpdir"
options = {
code_assets_dir: "code",
pipeline_assets_dir: "pipelines",
assets_file: "azure_devops.tgz",
root_dir: File.join(ENV["CODESPACE_VSCODE_FOLDER"], "azure_devops/bootstrap"),
forecast_source_file: File.join(".", "azure_devops/bootstrap/jobs.json")
forecast_source_file: "jobs.json"
}
OptionParser.new do |opt|
@@ -72,38 +73,42 @@ def create_repository(options)
repository = options[:project]
access_token = options[:access_token]
root_dir = options[:root_dir]
directories = [options[:code_assets_dir], options[:pipeline_assets_dir]]
assets_file = options[:assets_file]
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 = {
Dir.mktmpdir do |tmp_dir|
puts "Extracting assets..."
_, _, st = Open3.capture3("tar", "-xzf", File.join(root_dir, assets_file), "-C", tmp_dir)
abort unless st.exitstatus == 0
uri = URI("https://dev.azure.com/#{organization}/#{project}/_apis/git/repositories/#{repository}/pushes?api-version=7.1-preview.2")
puts "Creating repository #{repository}..."
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"
}
changes: Dir[File.join(tmp_dir, "**/*")].reject {|f| File.directory?(f) }.map do |entry|
{
changeType: "add",
item: {
path: File.join("/", Pathname.new(entry).relative_path_from(tmp_dir).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")
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
end
@@ -172,13 +177,15 @@ end
def update_forecast_source_file(options)
puts "Updating forecast data"
jobs_data = File.read(options[:forecast_source_file])
root_dir = options[:root_dir]
jobs_data_file = options[:forecast_source_file]
jobs_data = File.read(File.join(root_dir, jobs_data_file))
today = Date.today.strftime("%Y-%m-%d")
jobs_data.gsub!(/20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]/, today)
File.write(options[:forecast_source_file], jobs_data)
end
create_project(options)
# create_project(options)
repository = create_repository(options)
create_yaml_pipelines(options, repository)
create_classic_pipelines(options, repository)