Skip to content

Commit

Permalink
Merge pull request #576 from Azure/v6.0
Browse files Browse the repository at this point in the history
V6.0
  • Loading branch information
waelkdouh authored Jul 3, 2024
2 parents 66cd392 + 0e10dad commit bb043be
Show file tree
Hide file tree
Showing 76 changed files with 6,070 additions and 2,702 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
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();
}
}
31 changes: 31 additions & 0 deletions tools/code/aspire/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17016;http://localhost:15029",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21043",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22139",
"ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15029",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19296",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20230",
"ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true"
}
}
}
}
8 changes: 8 additions & 0 deletions tools/code/aspire/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
19 changes: 19 additions & 0 deletions tools/code/aspire/aspire.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>6ce9dc18-ea0d-4d82-8f1a-e63877f35b88</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\integration.tests\integration.tests.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit bb043be

Please sign in to comment.