From b6050964646227612e17378565f04fddaffa5229 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 14 Oct 2024 10:45:17 +0200 Subject: [PATCH 01/18] Adding hardware test --- azure-pipelines.yml | 60 +++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 70c5559..a53f760 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -48,20 +48,50 @@ variables: - name: nugetPackageName value: 'nanoFramework.Json' -steps: +parameters: +- name: appComponents + displayName: List of capabilities to run the tests on + type: object + default: + - XIAO_ESP32C3 + - ESP32_C3_REV3 -# step from template @ nf-tools repo -# all build, update and publish steps -- template: azure-pipelines-templates/class-lib-build.yml@templates - parameters: - sonarCloudProject: 'nanoframework_lib-nanoFramework.Json' - runUnitTests: true - unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' +stages: +- stage: Build + displayName: 'Build' + jobs: + - job: Build + displayName: 'Build job' + pool: + # default is the following VM Image + vmImage: 'windows-latest' + steps: -# step from template @ nf-tools repo -# report error -- template: azure-pipelines-templates/discord-webhook-task.yml@templates - parameters: - status: 'failure' - webhookUrl: '$(DiscordWebhook)' - message: '' + # step from template @ nf-tools repo + # all build, update and publish steps + - template: azure-pipelines-templates/class-lib-build.yml@templates + parameters: + sonarCloudProject: 'nanoframework_lib-nanoFramework.Json' + runUnitTests: true + unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' + + # step from template @ nf-tools repo + # report error + - template: azure-pipelines-templates/discord-webhook-task.yml@templates + parameters: + status: 'failure' + webhookUrl: '$(DiscordWebhook)' + message: '' + + - task: PublishPipelineArtifact@1 + displayName: Publish Pipeline Artifact copy + inputs: + path: '$(System.DefaultWorkingDirectory)' + artifactName: 'Artifacts' + +- ${{ each appComponents in parameters.appComponents }}: + - template: azure-pipelines-templates/device-test.yml + parameters: + appComponents: ${{ appComponents }} + unitTestRunsettings: + - 'nanoFramework.Json.Test\nano.runsettings,nanoFramework.Json.Test\bin\Debug\nanoFramework.System.Text.dll' \ No newline at end of file From 20ed2bcfac19820695680def89d159474d1cd613 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 14 Oct 2024 10:59:04 +0200 Subject: [PATCH 02/18] updating benchmark packages --- .../nanoFramework.Json.Benchmark.nfproj | 11 +++++++---- nanoFramework.Json.Benchmark/packages.config | 6 +++--- .../packages.lock.json | 18 +++++++++--------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj b/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj index 4143ba2..e0b9af1 100644 --- a/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj +++ b/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj @@ -44,12 +44,15 @@ ..\packages\nanoFramework.CoreLibrary.1.15.5\lib\mscorlib.dll - - ..\packages\nanoFramework.Benchmark.1.0.77\lib\nanoFramework.Benchmark.dll + + ..\packages\nanoFramework.Benchmark.1.0.78\lib\nanoFramework.Benchmark.dll ..\packages\nanoFramework.Logging.1.1.113\lib\nanoFramework.Logging.dll + + ..\packages\nanoFramework.Runtime.Native.1.7.1\lib\nanoFramework.Runtime.Native.dll + ..\packages\nanoFramework.Runtime.Native.1.6.12\lib\nanoFramework.Runtime.Native.dll @@ -59,8 +62,8 @@ ..\packages\nanoFramework.System.Text.1.2.54\lib\nanoFramework.System.Text.dll - - ..\packages\nanoFramework.System.Diagnostics.Stopwatch.1.2.628\lib\System.Diagnostics.Stopwatch.dll + + ..\packages\nanoFramework.System.Diagnostics.Stopwatch.1.2.660\lib\System.Diagnostics.Stopwatch.dll ..\packages\nanoFramework.System.IO.Streams.1.1.59\lib\System.IO.Streams.dll diff --git a/nanoFramework.Json.Benchmark/packages.config b/nanoFramework.Json.Benchmark/packages.config index eef696e..4509f8b 100644 --- a/nanoFramework.Json.Benchmark/packages.config +++ b/nanoFramework.Json.Benchmark/packages.config @@ -1,11 +1,11 @@  - + - + - + \ No newline at end of file diff --git a/nanoFramework.Json.Benchmark/packages.lock.json b/nanoFramework.Json.Benchmark/packages.lock.json index 05be08c..2bbdeff 100644 --- a/nanoFramework.Json.Benchmark/packages.lock.json +++ b/nanoFramework.Json.Benchmark/packages.lock.json @@ -4,9 +4,9 @@ ".NETnanoFramework,Version=v1.0": { "nanoFramework.Benchmark": { "type": "Direct", - "requested": "[1.0.77, 1.0.77]", - "resolved": "1.0.77", - "contentHash": "uqFQKU0RhuaxSb9ZoaoUkk4hjhTq4+RAXS3jJ/fkG0wGWEJ0m1RDFjKlyfvHJj2rx3/ydfxF18elDLwMMExJAQ==" + "requested": "[1.0.78, 1.0.78]", + "resolved": "1.0.78", + "contentHash": "73Hh26jDPow0A0RV+ViRPGXigLuKL4HvECkywj+naNRcSA2oK9qvvr8bDLeb5pkGoiJ+mZ/i2icZ05oty69BoA==" }, "nanoFramework.CoreLibrary": { "type": "Direct", @@ -22,9 +22,9 @@ }, "nanoFramework.Runtime.Native": { "type": "Direct", - "requested": "[1.6.12, 1.6.12]", - "resolved": "1.6.12", - "contentHash": "RlJ882CK7D2HkkGHDw1a2xgiEM+1+Nd6iTA+OmzF5QIxbv0SX9qBesueIWsc6RsiQGqBEeBXh4zZ2+TBGL62VQ==" + "requested": "[1.7.1, 1.7.1]", + "resolved": "1.7.1", + "contentHash": "RCiG3D+SxG4wVSBXuXP0y8EZWBd65bfJ9AJj0USNnfL65Aa+nUXmXa6QIxkeolSjDH4jLgKjlIuTXOA7t+AQGQ==" }, "nanoFramework.System.Collections": { "type": "Direct", @@ -34,9 +34,9 @@ }, "nanoFramework.System.Diagnostics.Stopwatch": { "type": "Direct", - "requested": "[1.2.628, 1.2.628]", - "resolved": "1.2.628", - "contentHash": "Vt2e7LoP0zVc5K7FurjM1a+kmI2r1JJOQ7H8/fRM6v3obGotDovnU8ntgzSDOGmYEIHhDC5FH89PVQRwFQ0edw==" + "requested": "[1.2.660, 1.2.660]", + "resolved": "1.2.660", + "contentHash": "ScGIMJcQ7E8+xhuR0Svt6+k2mjb7+WyDBXR8DmmRwSF0w1ugK6IPqlbxfvDzOklZtxqexdugp/mrC1sZ6UNRzA==" }, "nanoFramework.System.IO.Streams": { "type": "Direct", From 00f9e1d8716d1b250f3a554ef07d96675b74da1e Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 14 Oct 2024 11:41:26 +0200 Subject: [PATCH 03/18] adjusting to point on template --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a53f760..8dd7f24 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -90,7 +90,7 @@ stages: artifactName: 'Artifacts' - ${{ each appComponents in parameters.appComponents }}: - - template: azure-pipelines-templates/device-test.yml + - template: azure-pipelines-templates/device-test.yml@templates parameters: appComponents: ${{ appComponents }} unitTestRunsettings: From bd361a07aef6ed2d2823becdcab07b8c42a9ff05 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 14 Oct 2024 11:50:05 +0200 Subject: [PATCH 04/18] adjusting paths --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8dd7f24..9e96010 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -94,4 +94,4 @@ stages: parameters: appComponents: ${{ appComponents }} unitTestRunsettings: - - 'nanoFramework.Json.Test\nano.runsettings,nanoFramework.Json.Test\bin\Debug\nanoFramework.System.Text.dll' \ No newline at end of file + - 'nanoFramework.Json.Test/nano.runsettings,nanoFramework.Json.Test/bin/Release/nanoFramework.System.Text.dll' \ No newline at end of file From 5af0ba51ac0a2bfb32ad18a71df9325e694d0956 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 14 Oct 2024 12:00:02 +0200 Subject: [PATCH 05/18] adjusting test names --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9e96010..0e0a41b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -94,4 +94,4 @@ stages: parameters: appComponents: ${{ appComponents }} unitTestRunsettings: - - 'nanoFramework.Json.Test/nano.runsettings,nanoFramework.Json.Test/bin/Release/nanoFramework.System.Text.dll' \ No newline at end of file + - 'nanoFramework.Json.Test/nano.runsettings,nanoFramework.Json.Test/bin/Release/NFUnitTest.dll' \ No newline at end of file From a982d02d05718508ff9dd6b6511c5efd633ae213 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 14 Oct 2024 12:13:43 +0200 Subject: [PATCH 06/18] adjusting for Unix based file name --- .../nanoFramework.Json.Test.nfproj | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj b/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj index 2536484..df6f56a 100644 --- a/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj +++ b/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj @@ -32,33 +32,33 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - + + + + + + From b9ab8757193c4ecbd58309db388be2e3da094fe3 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 16 Oct 2024 05:37:45 +0200 Subject: [PATCH 07/18] asjusting for new adapter and path --- .../nanoFramework.Json.Test.nfproj | 54 +++++++++---------- nanoFramework.Json.Test/packages.config | 2 +- nanoFramework.Json.Test/packages.lock.json | 6 +-- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj b/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj index df6f56a..8558bd0 100644 --- a/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj +++ b/nanoFramework.Json.Test/nanoFramework.Json.Test.nfproj @@ -32,33 +32,33 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - + + + + + + @@ -76,11 +76,11 @@ ..\packages\nanoFramework.System.Text.1.2.54\lib\nanoFramework.System.Text.dll - - ..\packages\nanoFramework.TestFramework.2.1.112\lib\nanoFramework.TestFramework.dll + + ..\packages\nanoFramework.TestFramework.2.1.113\lib\nanoFramework.TestFramework.dll - - ..\packages\nanoFramework.TestFramework.2.1.112\lib\nanoFramework.UnitTestLauncher.exe + + ..\packages\nanoFramework.TestFramework.2.1.113\lib\nanoFramework.UnitTestLauncher.exe ..\packages\nanoFramework.System.IO.Streams.1.1.59\lib\System.IO.Streams.dll diff --git a/nanoFramework.Json.Test/packages.config b/nanoFramework.Json.Test/packages.config index f6143ca..ee44add 100644 --- a/nanoFramework.Json.Test/packages.config +++ b/nanoFramework.Json.Test/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/nanoFramework.Json.Test/packages.lock.json b/nanoFramework.Json.Test/packages.lock.json index a221280..8d2f527 100644 --- a/nanoFramework.Json.Test/packages.lock.json +++ b/nanoFramework.Json.Test/packages.lock.json @@ -28,9 +28,9 @@ }, "nanoFramework.TestFramework": { "type": "Direct", - "requested": "[2.1.112, 2.1.112]", - "resolved": "2.1.112", - "contentHash": "aiPyyGb7+yv96IQAxVGnXaQj8tTYf9Zj4zb6YM4kGJl+GptWlXqx8rS7lstWHYqM1UVyPEl1yT69uI6Go110qQ==" + "requested": "[2.1.113, 2.1.113]", + "resolved": "2.1.113", + "contentHash": "+aFNv9Kew1rxYL7boHO1WUdLRIFeqkUW23770dxQwynUquqob56nI1c5I4E4QAaCQg6TnZm+SLEIa2USHRuoRg==" } } } From 9041b382a7d3fc7c1eb40e95462587f67da25dd0 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 16 Oct 2024 14:53:13 +0200 Subject: [PATCH 08/18] adjusting runsettings --- nanoFramework.Json.Test/nano.runsettings | 1 + 1 file changed, 1 insertion(+) diff --git a/nanoFramework.Json.Test/nano.runsettings b/nanoFramework.Json.Test/nano.runsettings index e82b99e..7d1bdd0 100644 --- a/nanoFramework.Json.Test/nano.runsettings +++ b/nanoFramework.Json.Test/nano.runsettings @@ -11,5 +11,6 @@ None False + COM3 \ No newline at end of file From 7e7818db8770ae6d7bd80dd2fadb95c3d227b215 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Thu, 31 Oct 2024 13:09:58 +0100 Subject: [PATCH 09/18] adding boostrap --- azure-bootstrap.yml | 169 ++++++++++++++++++++++++++++++++++++++++++++ azure-pipelines.yml | 29 ++------ 2 files changed, 174 insertions(+), 24 deletions(-) create mode 100644 azure-bootstrap.yml diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml new file mode 100644 index 0000000..bf57e17 --- /dev/null +++ b/azure-bootstrap.yml @@ -0,0 +1,169 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +trigger: + branches: + include: + - main + - develop + - release-* + paths: + exclude: + - .github_changelog_generator + - .gitignore + - CHANGELOG.md + - CODE_OF_CONDUCT.md + - LICENSE.md + - README.md + - NuGet.Config + - assets/* + - config/* + - .github/* + +# PR always trigger build +pr: + autoCancel: true + +jobs: +- job: Trigger + displayName: Trigger Azure Dev Ops build and test pipeline + pool: + vmImage: 'ubuntu-latest' + + variables: + AZURE_DEVOPS_ORG: nanoFramework + AZURE_DEVOPS_PROJECT: nanoFramework.Json + AZURE_DEVOPS_PIPELINE_ID: 59 + AZURE_POOL_NAME: TestStream + + steps: + - script: | + # Validate required environment variables + for var in AZURE_DEVOPS_ORG AZURE_DEVOPS_PROJECT AZURE_DEVOPS_PIPELINE_ID AZURE_POOL_NAME; do + if [ -z "${!var}" ]; then + echo "Error: Required environment variable $var is not set" + exit 1 + fi + done + + # Define the Azure DevOps organization, project, and pipeline + organization="${AZURE_DEVOPS_ORG}" + project="${AZURE_DEVOPS_PROJECT}" + pipelineId="${AZURE_DEVOPS_PIPELINE_ID}" + poolName="${AZURE_POOL_NAME}" + branch="${BUILD_SOURCEBRANCH}" + + # Encode the PAT + patEncoded=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64) + + # Define the headers + headers=( + -H "Authorization: Basic $patEncoded" + -H "Content-Type: application/json" + ) + + # Get the pool ID + url="https://dev.azure.com/${organization}/_apis/distributedtask/pools?poolName=${poolName}&api-version=7.1" + AZP_POOL_AGENTS=$(curl -s "${headers[@]}" -X GET "$url") + poolId=$(echo "$AZP_POOL_AGENTS" | jq -r '.value[0].id') + + echo "Pool ID: $poolId" + + # Define the URL to get all agents in the pool + url="https://dev.azure.com/${organization}/_apis/distributedtask/pools/${poolId}/agents?includeCapabilities=true&api-version=7.1" + + response=$(curl -s -w "%{http_code}" "${headers[@]}" -X GET "$url") + http_code=${response: -3} + content=${response::-3} + + if [ $http_code -eq 200 ]; then + # Extract all userCapabilities names for online and enabled agents as a unique list + capabilityNames=$(echo "$content" | jq -r '[.value[] | select(.status == "online" and .enabled == true) | .userCapabilities | keys] | unique | flatten | join("\n- ")') + else + echo "Failed to retrieve agent capabilities. HTTP Status Code: $http_code" + echo "Response: \"$content\"" + exit 1 + fi + echo "Unique userCapabilities names: \"$capabilityNames\"" + + # Prepare the parameters + parametersJson=$(jq -n --arg appComponents "- $capabilityNames" '{templateParameters: {appComponents: $appComponents}}') + + echo "Parameters: \"$parametersJson\"" + echo "Branch for PR: \"$branch\"" + + # Define the request body + bodyJson=$(jq -n --argjson parameters "$parametersJson" --arg branch "$branch" '{ + resources: { + repositories: + { + self: { + refName: $branch + } + } + }, + templateParameters: $parameters.templateParameters + }') + + echo "Request body: \"$bodyJson\"" + + # Define the URL + url="https://dev.azure.com/${organization}/${project}/_apis/pipelines/${pipelineId}/runs?api-version=7.1" + + # Trigger the pipeline + response=$(curl -s -w "%{http_code}" "${headers[@]}" -X POST -d "$bodyJson" "$url") + http_code=${response: -3} + content=${response::-3} + + if [ $http_code -eq 200 ]; then + run_id=$(echo "$content" | jq -r '.id') + echo "Pipeline triggered successfully. Run ID: $run_id" + echo "##vso[task.setvariable variable=run_id]$run_id" + else + echo "Failed to trigger pipeline. HTTP Status Code: $http_code" + echo "Response: $content" + exit 1 + fi + displayName: 'Trigger Azure DevOps Pipeline' + env: + BUILD_SOURCEBRANCH: $(Build.SourceBranch) + AZURE_DEVOPS_PAT: $(AZURE_DEVOPS_PAT) + + - script: | + echo "Pipeline to monitor Run ID: $(run_id)" + # Define the URL to get the pipeline run status + url="https://dev.azure.com/${AZURE_DEVOPS_ORG}/${AZURE_DEVOPS_PROJECT}/_apis/pipelines/${AZURE_DEVOPS_PIPELINE_ID}/runs/$(run_id)?api-version=7.1" + + # Loop to monitor the pipeline run status + while true; do + response=$(curl -s -w "%{http_code}" -H "Authorization: Basic $(echo -n ":${AZURE_DEVOPS_PAT}" | base64)" -X GET "$url") + http_code=${response: -3} + content=${response::-3} + + if [ $http_code -eq 200 ]; then + state=$(echo "$content" | jq -r '.state') + result=$(echo "$content" | jq -r '.result') + + echo "Pipeline run state: $state" + + if [ "$state" == "completed" ]; then + echo "Pipeline run completed with result: $result" + if [ "$result" == "succeeded" ]; then + exit 0 + else + exit 1 + fi + fi + else + echo "Failed to get pipeline run status. HTTP Status Code: $http_code" + echo "Response: $content" + exit 1 + fi + + # Wait for a while before checking again + sleep 30 + done + displayName: 'Monitoring Azure DevOps pipeline' + env: + run_id: $(run_id) + AZURE_DEVOPS_PAT: $(AZURE_DEVOPS_PAT) \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0e0a41b..1500873 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,28 +1,10 @@ # Copyright (c) .NET Foundation and Contributors # See LICENSE file in the project root for full license information. -trigger: - branches: - include: - - main - - develop - - release-* - paths: - exclude: - - .github_changelog_generator - - .gitignore - - CHANGELOG.md - - CODE_OF_CONDUCT.md - - LICENSE.md - - README.md - - NuGet.Config - - assets/* - - config/* - - .github/* - -# PR always trigger build -pr: - autoCancel: true +# The Pipeline is going to be called by the GitHub action. +# Manual trigger is always possible. +trigger: none +pr: none # add nf-tools repo to resources (for Azure Pipelines templates) resources: @@ -53,8 +35,7 @@ parameters: displayName: List of capabilities to run the tests on type: object default: - - XIAO_ESP32C3 - - ESP32_C3_REV3 + - none stages: - stage: Build From 3342e62997be2adebcbcf6d0091d5ce6e6bef9ed Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 17 Dec 2024 14:37:36 +0100 Subject: [PATCH 10/18] simplifying bootstrap using the template --- azure-bootstrap.yml | 152 ++++---------------------------------------- 1 file changed, 14 insertions(+), 138 deletions(-) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index bf57e17..ba2e090 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -24,146 +24,22 @@ trigger: pr: autoCancel: true +# add nf-tools repo to resources (for Azure Pipelines templates) +resources: + repositories: + - repository: templates + type: github + name: nanoframework/nf-tools + endpoint: nanoframework + jobs: - job: Trigger displayName: Trigger Azure Dev Ops build and test pipeline pool: - vmImage: 'ubuntu-latest' - - variables: - AZURE_DEVOPS_ORG: nanoFramework - AZURE_DEVOPS_PROJECT: nanoFramework.Json - AZURE_DEVOPS_PIPELINE_ID: 59 - AZURE_POOL_NAME: TestStream - - steps: - - script: | - # Validate required environment variables - for var in AZURE_DEVOPS_ORG AZURE_DEVOPS_PROJECT AZURE_DEVOPS_PIPELINE_ID AZURE_POOL_NAME; do - if [ -z "${!var}" ]; then - echo "Error: Required environment variable $var is not set" - exit 1 - fi - done - - # Define the Azure DevOps organization, project, and pipeline - organization="${AZURE_DEVOPS_ORG}" - project="${AZURE_DEVOPS_PROJECT}" - pipelineId="${AZURE_DEVOPS_PIPELINE_ID}" - poolName="${AZURE_POOL_NAME}" - branch="${BUILD_SOURCEBRANCH}" - - # Encode the PAT - patEncoded=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64) - - # Define the headers - headers=( - -H "Authorization: Basic $patEncoded" - -H "Content-Type: application/json" - ) - - # Get the pool ID - url="https://dev.azure.com/${organization}/_apis/distributedtask/pools?poolName=${poolName}&api-version=7.1" - AZP_POOL_AGENTS=$(curl -s "${headers[@]}" -X GET "$url") - poolId=$(echo "$AZP_POOL_AGENTS" | jq -r '.value[0].id') - - echo "Pool ID: $poolId" - - # Define the URL to get all agents in the pool - url="https://dev.azure.com/${organization}/_apis/distributedtask/pools/${poolId}/agents?includeCapabilities=true&api-version=7.1" - - response=$(curl -s -w "%{http_code}" "${headers[@]}" -X GET "$url") - http_code=${response: -3} - content=${response::-3} - - if [ $http_code -eq 200 ]; then - # Extract all userCapabilities names for online and enabled agents as a unique list - capabilityNames=$(echo "$content" | jq -r '[.value[] | select(.status == "online" and .enabled == true) | .userCapabilities | keys] | unique | flatten | join("\n- ")') - else - echo "Failed to retrieve agent capabilities. HTTP Status Code: $http_code" - echo "Response: \"$content\"" - exit 1 - fi - echo "Unique userCapabilities names: \"$capabilityNames\"" - - # Prepare the parameters - parametersJson=$(jq -n --arg appComponents "- $capabilityNames" '{templateParameters: {appComponents: $appComponents}}') - - echo "Parameters: \"$parametersJson\"" - echo "Branch for PR: \"$branch\"" - - # Define the request body - bodyJson=$(jq -n --argjson parameters "$parametersJson" --arg branch "$branch" '{ - resources: { - repositories: - { - self: { - refName: $branch - } - } - }, - templateParameters: $parameters.templateParameters - }') - - echo "Request body: \"$bodyJson\"" - - # Define the URL - url="https://dev.azure.com/${organization}/${project}/_apis/pipelines/${pipelineId}/runs?api-version=7.1" - - # Trigger the pipeline - response=$(curl -s -w "%{http_code}" "${headers[@]}" -X POST -d "$bodyJson" "$url") - http_code=${response: -3} - content=${response::-3} - - if [ $http_code -eq 200 ]; then - run_id=$(echo "$content" | jq -r '.id') - echo "Pipeline triggered successfully. Run ID: $run_id" - echo "##vso[task.setvariable variable=run_id]$run_id" - else - echo "Failed to trigger pipeline. HTTP Status Code: $http_code" - echo "Response: $content" - exit 1 - fi - displayName: 'Trigger Azure DevOps Pipeline' - env: - BUILD_SOURCEBRANCH: $(Build.SourceBranch) - AZURE_DEVOPS_PAT: $(AZURE_DEVOPS_PAT) - - - script: | - echo "Pipeline to monitor Run ID: $(run_id)" - # Define the URL to get the pipeline run status - url="https://dev.azure.com/${AZURE_DEVOPS_ORG}/${AZURE_DEVOPS_PROJECT}/_apis/pipelines/${AZURE_DEVOPS_PIPELINE_ID}/runs/$(run_id)?api-version=7.1" - - # Loop to monitor the pipeline run status - while true; do - response=$(curl -s -w "%{http_code}" -H "Authorization: Basic $(echo -n ":${AZURE_DEVOPS_PAT}" | base64)" -X GET "$url") - http_code=${response: -3} - content=${response::-3} - - if [ $http_code -eq 200 ]; then - state=$(echo "$content" | jq -r '.state') - result=$(echo "$content" | jq -r '.result') - - echo "Pipeline run state: $state" - - if [ "$state" == "completed" ]; then - echo "Pipeline run completed with result: $result" - if [ "$result" == "succeeded" ]; then - exit 0 - else - exit 1 - fi - fi - else - echo "Failed to get pipeline run status. HTTP Status Code: $http_code" - echo "Response: $content" - exit 1 - fi + vmImage: 'ubuntu-latest' - # Wait for a while before checking again - sleep 30 - done - displayName: 'Monitoring Azure DevOps pipeline' - env: - run_id: $(run_id) - AZURE_DEVOPS_PAT: $(AZURE_DEVOPS_PAT) \ No newline at end of file + steps: + - template: bootstrap.yml + parameters: + AZURE_DEVOPS_PROJECT: nanoFramework.IoT.TestStream + AZURE_DEVOPS_PIPELINE_ID: 59 From 9236f0e2fd44f7a730b8be972c7d4c4f05a88b44 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 17 Dec 2024 14:43:17 +0100 Subject: [PATCH 11/18] fixing nit in templates --- azure-bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index ba2e090..f1d6739 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -39,7 +39,7 @@ jobs: vmImage: 'ubuntu-latest' steps: - - template: bootstrap.yml + - template: azure-pipelines-templates/bootstrap.yml@templates parameters: AZURE_DEVOPS_PROJECT: nanoFramework.IoT.TestStream AZURE_DEVOPS_PIPELINE_ID: 59 From bf05b05f1b53958ea1b3db300a93ef7803f4835e Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 17 Dec 2024 14:51:28 +0100 Subject: [PATCH 12/18] nit --- azure-bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index f1d6739..d5eb1e6 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -41,5 +41,5 @@ jobs: steps: - template: azure-pipelines-templates/bootstrap.yml@templates parameters: - AZURE_DEVOPS_PROJECT: nanoFramework.IoT.TestStream + AZURE_DEVOPS_PROJECT: nanoFramework.Json AZURE_DEVOPS_PIPELINE_ID: 59 From 6c5ce4e47115f9a6a53aba964c0fb5d513900dcc Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 17 Dec 2024 14:55:58 +0100 Subject: [PATCH 13/18] update nuget --- .../nanoFramework.Json.Benchmark.nfproj | 4 ++-- nanoFramework.Json.Benchmark/packages.config | 2 +- nanoFramework.Json.Benchmark/packages.lock.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj b/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj index a718c25..297a241 100644 --- a/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj +++ b/nanoFramework.Json.Benchmark/nanoFramework.Json.Benchmark.nfproj @@ -59,8 +59,8 @@ ..\packages\nanoFramework.System.Text.1.2.54\lib\nanoFramework.System.Text.dll - - ..\packages\nanoFramework.System.Diagnostics.Stopwatch.1.2.670\lib\System.Diagnostics.Stopwatch.dll + + ..\packages\nanoFramework.System.Diagnostics.Stopwatch.1.2.693\lib\System.Diagnostics.Stopwatch.dll ..\packages\nanoFramework.System.IO.Streams.1.1.59\lib\System.IO.Streams.dll diff --git a/nanoFramework.Json.Benchmark/packages.config b/nanoFramework.Json.Benchmark/packages.config index b0caed4..fc63c9c 100644 --- a/nanoFramework.Json.Benchmark/packages.config +++ b/nanoFramework.Json.Benchmark/packages.config @@ -5,7 +5,7 @@ - + \ No newline at end of file diff --git a/nanoFramework.Json.Benchmark/packages.lock.json b/nanoFramework.Json.Benchmark/packages.lock.json index d0c86b7..9567f47 100644 --- a/nanoFramework.Json.Benchmark/packages.lock.json +++ b/nanoFramework.Json.Benchmark/packages.lock.json @@ -34,9 +34,9 @@ }, "nanoFramework.System.Diagnostics.Stopwatch": { "type": "Direct", - "requested": "[1.2.670, 1.2.670]", - "resolved": "1.2.670", - "contentHash": "4ricLROKKGRjoePNDNYptJqaoFy9FfYpS3QQrDxdBx5PjmMd5BRN6WqZTmlj1xi0TgN2YGmbG76tA+PhYCPZ6g==" + "requested": "[1.2.693, 1.2.693]", + "resolved": "1.2.693", + "contentHash": "kQZz3IkEjNg5MokmA2Xy2ddZQ66QwWLUAi+kbCwzUmf8CrPfmbly88zZQsSv66Dr7Nipw9QLUhcLatrsNJg6XQ==" }, "nanoFramework.System.IO.Streams": { "type": "Direct", From 60c22e9ea33bcccb586c27097222aa4c426a6d63 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 17 Dec 2024 15:43:46 +0100 Subject: [PATCH 14/18] nit --- azure-bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index d5eb1e6..e04a485 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -39,7 +39,7 @@ jobs: vmImage: 'ubuntu-latest' steps: - - template: azure-pipelines-templates/bootstrap.yml@templates + - template: azure-pipelines-templates/device-bootstrap.yml@templates parameters: AZURE_DEVOPS_PROJECT: nanoFramework.Json AZURE_DEVOPS_PIPELINE_ID: 59 From 06a9889c6e17d71c2017796a13dc0d144d4ea288 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 18 Dec 2024 14:21:25 +0000 Subject: [PATCH 15/18] Minor changes in AZDO pipeline YAML --- azure-bootstrap.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index e04a485..98376d4 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -9,15 +9,12 @@ trigger: - release-* paths: exclude: - - .github_changelog_generator - .gitignore - CHANGELOG.md - - CODE_OF_CONDUCT.md - LICENSE.md - README.md - NuGet.Config - assets/* - - config/* - .github/* # PR always trigger build From a43ad17e5ed2b2f3f788fe7d477aeb42897a75d3 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 18 Dec 2024 14:38:42 +0000 Subject: [PATCH 16/18] Dummy change to trigger build --- azure-bootstrap.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index 98376d4..da57ab3 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -35,6 +35,7 @@ jobs: pool: vmImage: 'ubuntu-latest' + steps: - template: azure-pipelines-templates/device-bootstrap.yml@templates parameters: From 23e0e89dee7687d0a7940768350003250fe512dd Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 18 Dec 2024 15:25:41 +0000 Subject: [PATCH 17/18] Revert "Dummy change to trigger build" This reverts commit a43ad17e5ed2b2f3f788fe7d477aeb42897a75d3. --- azure-bootstrap.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index da57ab3..98376d4 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -35,7 +35,6 @@ jobs: pool: vmImage: 'ubuntu-latest' - steps: - template: azure-pipelines-templates/device-bootstrap.yml@templates parameters: From 1958f63cd6b88dafe655b57026a752cfa1bff81b Mon Sep 17 00:00:00 2001 From: josesimoes Date: Thu, 19 Dec 2024 12:18:54 +0000 Subject: [PATCH 18/18] Fix comment and layout --- azure-bootstrap.yml | 2 +- azure-pipelines.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-bootstrap.yml b/azure-bootstrap.yml index 98376d4..ea6fb49 100644 --- a/azure-bootstrap.yml +++ b/azure-bootstrap.yml @@ -33,7 +33,7 @@ jobs: - job: Trigger displayName: Trigger Azure Dev Ops build and test pipeline pool: - vmImage: 'ubuntu-latest' + vmImage: 'ubuntu-latest' steps: - template: azure-pipelines-templates/device-bootstrap.yml@templates diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1500873..a8396b4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,7 @@ # Copyright (c) .NET Foundation and Contributors # See LICENSE file in the project root for full license information. -# The Pipeline is going to be called by the GitHub action. +# The Pipeline is going to be triggered by a call to Azure DevOps REST API # Manual trigger is always possible. trigger: none pr: none @@ -75,4 +75,4 @@ stages: parameters: appComponents: ${{ appComponents }} unitTestRunsettings: - - 'nanoFramework.Json.Test/nano.runsettings,nanoFramework.Json.Test/bin/Release/NFUnitTest.dll' \ No newline at end of file + - 'nanoFramework.Json.Test/nano.runsettings,nanoFramework.Json.Test/bin/Release/NFUnitTest.dll'