Skip to content

Commit

Permalink
Merge branch 'Azure:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
vandriot authored Jul 3, 2024
2 parents 8f9ea9d + a2c2951 commit 80c29fe
Show file tree
Hide file tree
Showing 78 changed files with 6,130 additions and 2,709 deletions.
39 changes: 23 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
{
"name": "API Ops",
"image": "mcr.microsoft.com/devcontainers/dotnet:0-7.0",
"name": "C# (.NET)",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {}
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "8.0",
"additionalVersions": "9.0",
"workloads": "aspire"
},
"ghcr.io/devcontainers/features/azure-cli:1": {
"version": "latest",
"installBicep": true
},
"ghcr.io/devcontainers/features/powershell:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/git:1": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// "portsAttributes": {
// "5001": {
// "protocol": "https"
// }
// }

"postCreateCommand": "dotnet restore /workspaces/apiops/tools/code/code.sln",

"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csharp"
"ms-azuretools.vscode-bicep",
"ms-azure-devops.azure-pipelines",
"ms-dotnettools.csdevkit",
"github.copilot",
"github.copilot-chat",
"timonwong.shellcheck"
]
}
}
}
}
9 changes: 9 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Install Aspire
sudo /usr/share/dotnet/dotnet workload update --from-rollback-file "./.devcontainer/rollback.txt"
sudo /usr/share/dotnet/dotnet workload install aspire --from-rollback-file "./.devcontainer/rollback.txt"

# Install PowerShell modules
pwsh -Command "Install-Module -Name Az -Force
Install-Module -Name Microsoft.Graph -Force"
92 changes: 49 additions & 43 deletions .github/workflows/create_github_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,29 @@ jobs:
$VerbosePreference = "Continue"
$InformationPreference = "Continue"
Write-Information "Generating extractor..."
$sourcePath = Join-Path "${{ github.workspace }}" "tools" "code" "extractor" "extractor.csproj"
$outputFolderPath = "${{ runner.temp }}"
Write-Information "Creating output directory..."
$outputFolderPath = Join-Path "${{ runner.temp }}" "extractor-output"
New-Item -Path "$outputFolderPath" -ItemType "Directory"
Write-Information "Publishing application..."
$sourcePath = Join-Path "${{ github.workspace }}" "tools" "code" "extractor" "extractor.csproj"
& dotnet publish "$sourcePath" --self-contained --runtime "${{ matrix.dotnet-runtime }}" -p:PublishSingleFile=true --output "$outputFolderPath"
if ($LASTEXITCODE -ne 0) { throw "Generating extractor failed."}
$exeFileExt = "${{ matrix.dotnet-runtime }}".Contains("win") ? ".exe" : ""
$exeFolderPath = Join-Path "$outputFolderPath" "extractor$exeFileExt"
$exeFileNameFinal = "${{ format('extractor.{0}', matrix.dotnet-runtime) }}$exeFileExt"
Rename-Item -Path "$exeFolderPath" -NewName $exeFileNameFinal
echo "EXTRACTOR_FILENAME=$exeFileNameFinal" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Information "Zipping application..."
$sourceFolderPath = Join-Path "$outputFolderPath" "*"
$destinationFilePath = Join-Path "$outputFolderPath" "extractor-${{ matrix.dotnet-runtime }}.zip"
Compress-Archive -Path $sourceFolderPath -DestinationPath $destinationFilePath -CompressionLevel Optimal
"ZIP_FILE_PATH=$destinationFilePath" | Out-File -FilePath $env:GITHUB_ENV -Append
Write-Information "Execution complete."
shell: pwsh
env:
EXTRACTOR_FILENAME:

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ${{ format('{0}/{1}', runner.temp, env.EXTRACTOR_FILENAME) }}
name: extractor-${{ matrix.dotnet-runtime }}
path: ${{ env.ZIP_FILE_PATH }}

generate_publisher_artifacts:
name: Generate publisher artifacts
Expand All @@ -78,28 +79,29 @@ jobs:
$VerbosePreference = "Continue"
$InformationPreference = "Continue"
Write-Information "Generating publisher..."
$sourcePath = Join-Path "${{ github.workspace }}" "tools" "code" "publisher" "publisher.csproj"
$outputFolderPath = "${{ runner.temp }}"
Write-Information "Creating output directory..."
$outputFolderPath = Join-Path "${{ runner.temp }}" "publisher-output"
New-Item -Path "$outputFolderPath" -ItemType "Directory"
Write-Information "Publishing application..."
$sourcePath = Join-Path "${{ github.workspace }}" "tools" "code" "publisher" "publisher.csproj"
& dotnet publish "$sourcePath" --self-contained --runtime "${{ matrix.dotnet-runtime }}" -p:PublishSingleFile=true --output "$outputFolderPath"
if ($LASTEXITCODE -ne 0) { throw "Generating publisher failed."}
$exeFileExt = "${{ matrix.dotnet-runtime }}".Contains("win") ? ".exe" : ""
$exeFolderPath = Join-Path "$outputFolderPath" "publisher$exeFileExt"
$exeFileNameFinal = "${{ format('publisher.{0}', matrix.dotnet-runtime) }}$exeFileExt"
Rename-Item -Path "$exeFolderPath" -NewName $exeFileNameFinal
echo "PUBLISHER_FILENAME=$exeFileNameFinal" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Information "Zipping application..."
$sourceFolderPath = Join-Path "$outputFolderPath" "*"
$destinationFilePath = Join-Path "$outputFolderPath" "publisher-${{ matrix.dotnet-runtime }}.zip"
Compress-Archive -Path $sourceFolderPath -DestinationPath $destinationFilePath -CompressionLevel Optimal
"ZIP_FILE_PATH=$destinationFilePath" | Out-File -FilePath $env:GITHUB_ENV -Append
Write-Information "Execution complete."
shell: pwsh
env:
PUBLISHER_FILENAME:

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ${{ format('{0}/{1}', runner.temp, env.PUBLISHER_FILENAME) }}
name: publisher-${{ matrix.dotnet-runtime }}
path: ${{ env.ZIP_FILE_PATH }}

generate_github_pipeline_artifacts:
name: Generate GitHub artifacts
Expand Down Expand Up @@ -153,8 +155,9 @@ jobs:
shell: pwsh

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: github
path: ${{ runner.temp }}/Github.zip

generate_ado_pipeline_artifacts:
Expand Down Expand Up @@ -209,8 +212,9 @@ jobs:
shell: pwsh

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ado
path: ${{ runner.temp }}/Azure_DevOps.zip

generate_release:
Expand All @@ -227,27 +231,29 @@ jobs:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: |
${{github.workspace}}/artifact/extractor.win-x64.exe
${{github.workspace}}/artifact/extractor.linux-x64
${{github.workspace}}/artifact/extractor.linux-arm64
${{github.workspace}}/artifact/extractor.linux-musl-x64
${{github.workspace}}/artifact/extractor.linux-musl-arm64
${{github.workspace}}/artifact/extractor.osx-arm64
${{github.workspace}}/artifact/extractor.osx-x64
${{github.workspace}}/artifact/publisher.win-x64.exe
${{github.workspace}}/artifact/publisher.linux-x64
${{github.workspace}}/artifact/publisher.linux-arm64
${{github.workspace}}/artifact/publisher.linux-musl-x64
${{github.workspace}}/artifact/publisher.linux-musl-arm64
${{github.workspace}}/artifact/publisher.osx-arm64
${{github.workspace}}/artifact/publisher.osx-x64
${{github.workspace}}/artifact/Github.zip
${{github.workspace}}/artifact/Azure_DevOps.zip
${{github.workspace}}/extractor-linux-arm64/extractor-linux-arm64.zip
${{github.workspace}}/extractor-linux-musl-arm64/extractor-linux-musl-arm64.zip
${{github.workspace}}/extractor-linux-musl-x64/extractor-linux-musl-x64.zip
${{github.workspace}}/extractor-linux-x64/extractor-linux-x64.zip
${{github.workspace}}/extractor-osx-arm64/extractor-osx-arm64.zip
${{github.workspace}}/extractor-osx-x64/extractor-osx-x64.zip
${{github.workspace}}/extractor.osx-x64/extractor.osx-x64.zip
${{github.workspace}}/extractor-win-x64/extractor-win-x64.zip
${{github.workspace}}/publisher-linux-arm64/publisher-linux-arm64.zip
${{github.workspace}}/publisher-linux-musl-arm64/publisher-linux-musl-arm64.zip
${{github.workspace}}/publisher-linux-musl-x64/publisher-linux-musl-x64.zip
${{github.workspace}}/publisher-linux-x64/publisher-linux-x64.zip
${{github.workspace}}/publisher-osx-arm64/publisher-osx-arm64.zip
${{github.workspace}}/publisher-osx-x64/publisher-osx-x64.zip
${{github.workspace}}/publisher.osx-x64/publisher.osx-x64.zip
${{github.workspace}}/publisher-win-x64/publisher-win-x64.zip
${{github.workspace}}/github/Github.zip
${{github.workspace}}/ado/Azure_DevOps.zip
name: APIOps Toolkit for Azure APIM ${{ github.event.inputs.Release_Version }}
tag_name: ${{ github.event.inputs.Release_Version }}
generate_release_notes: true
10 changes: 6 additions & 4 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,17 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
mini_portile2 (2.8.5)
mini_portile2 (2.8.6)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.17.0)
multipart-post (2.1.1)
nokogiri (1.16.2)
nokogiri (1.16.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
octokit (4.21.0)
faraday (>= 0.9)
Expand All @@ -246,7 +246,8 @@ GEM
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rexml (3.2.8)
strscan (>= 3.0.9)
rouge (3.26.0)
ruby-enum (0.9.0)
i18n
Expand All @@ -263,6 +264,7 @@ GEM
faraday (> 0.8, < 2.0)
simpleidn (0.2.1)
unf (~> 0.1.4)
strscan (3.1.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
Expand Down
36 changes: 21 additions & 15 deletions tools/azdo_pipelines/run-extractor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,33 +91,39 @@ stages:
$VerbosePreference = "Continue"
$InformationPreference = "Continue"
Write-Information "Downloading extractor..."
$extractorFileName = "extractor.linux-x64"
$extractorFinalFileName = "extractor"
Write-Information "Setting name variables..."
$releaseFileName = "extractor-linux-x64.zip"
$executableFileName = "extractor"
if ("$(Agent.OS)" -like "*win*") {
$extractorFileName = "extractor.win-x64.exe"
$extractorFinalFileName = "extractor.exe"
$releaseFileName = "extractor-win-x64.zip"
$executableFileName = "extractor.exe"
}
elseif ("$(Agent.OS)" -like "*mac*" -and "$(Agent.OSArchitecture)" -like "*arm*") {
$extractorFileName = "extractor.osx-arm64"
$releaseFileName = "extractor-osx-arm64.zip"
}
elseif ("$(Agent.OS)" -like "*mac*" -and "$(Agent.OSArchitecture)" -like "*x86_64*") {
$extractorFileName = "extractor.osx-x64"
$releaseFileName = "extractor-osx-x64.zip"
}
$uri = "https://github.com/Azure/apiops/releases/download/$(apiops_release_version)/$extractorFileName"
$destinationFilePath = Join-Path "$(Agent.TempDirectory)" $extractorFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
Write-Information "Downloading release..."
$uri = "https://github.com/Azure/apiops/releases/download/$(apiops_release_version)/$releaseFileName"
$downloadFilePath = Join-Path "$(Agent.TempDirectory)" $releaseFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$downloadFilePath"
Write-Information "Extracting release..."
$executableFolderPath = Join-Path "$(Agent.TempDirectory)" "extractor"
Expand-Archive -Path "$downloadFilePath" -DestinationPath "$executableFolderPath"
$executableFilePath = Join-Path "$executableFolderPath" $executableFileName
Write-Information "Setting file permissions..."
if ("$(Agent.OS)" -like "*linux*")
{
Write-Information "Setting file permissions..."
& chmod +x "$destinationFilePath"
& chmod +x "$executableFilePath"
if ($LASTEXITCODE -ne 0) { throw "Setting file permissions failed."}
}
Write-Host "##vso[task.setvariable variable=EXTRACTOR_FILE_PATH]$destinationFilePath"
Write-Host "##vso[task.setvariable variable=EXTRACTOR_FILE_PATH]$executableFilePath"
Write-Information "Execution complete."
failOnStderr: true
pwsh: true
Expand Down
35 changes: 21 additions & 14 deletions tools/azdo_pipelines/run-publisher-with-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,32 +87,39 @@ steps:
$VerbosePreference = "Continue"
$InformationPreference = "Continue"
Write-Information "Downloading publisher..."
$publisherFileName = "publisher.linux-x64"
$publisherFinalFileName = "publisher"
Write-Information "Setting name variables..."
$releaseFileName = "publisher-linux-x64.zip"
$executableFileName = "publisher"
if ("$(Agent.OS)" -like "*win*") {
$publisherFileName = "publisher.win-x64.exe"
$publisherFinalFileName = "publisher.exe"
$releaseFileName = "publisher-win-x64.zip"
$executableFileName = "publisher.exe"
}
elseif ("$(Agent.OS)" -like "*mac*" -and "$(Agent.OSArchitecture)" -like "*arm*") {
$publisherFileName = "publisher.osx-arm64"
$releaseFileName = "publisher-osx-arm64.zip"
}
elseif ("$(Agent.OS)" -like "*mac*" -and "$(Agent.OSArchitecture)" -like "*x86_64*") {
$publisherFileName = "publisher.osx-x64"
$releaseFileName = "publisher-osx-x64.zip"
}
$uri = "https://github.com/Azure/apiops/releases/download/$(apiops_release_version)/$publisherFileName"
$destinationFilePath = Join-Path "$(Agent.TempDirectory)" $publisherFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
Write-Information "Downloading release..."
$uri = "https://github.com/Azure/apiops/releases/download/$(apiops_release_version)/$releaseFileName"
$downloadFilePath = Join-Path "$(Agent.TempDirectory)" $releaseFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$downloadFilePath"
Write-Information "Extracting release..."
$executableFolderPath = Join-Path "$(Agent.TempDirectory)" "publisher"
Expand-Archive -Path "$downloadFilePath" -DestinationPath "$executableFolderPath"
$executableFilePath = Join-Path "$executableFolderPath" $executableFileName
Write-Information "Setting file permissions..."
if ("$(Agent.OS)" -like "*linux*")
{
Write-Information "Setting file permissions..."
& chmod +x "$destinationFilePath"
& chmod +x "$executableFilePath"
if ($LASTEXITCODE -ne 0) { throw "Setting file permissions failed."}
}
Write-Host "##vso[task.setvariable variable=PUBLISHER_FILE_PATH]$destinationFilePath"
Write-Host "##vso[task.setvariable variable=PUBLISHER_FILE_PATH]$executableFilePath"
Write-Information "Execution complete."
failOnStderr: true
pwsh: true
Expand Down
15 changes: 15 additions & 0 deletions tools/code/aspire/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Aspire.Hosting;
using Projects;

internal static class Program
{
private static void Main(string[] args)
{
var builder = DistributedApplication.CreateBuilder(args);

builder.AddProject<integration_tests>("integration-tests");
//.WithEnvironment("CSCHECK_SEED", "0000KOIPe036");

builder.Build().Run();
}
}
Loading

0 comments on commit 80c29fe

Please sign in to comment.