From 571903c517b270da3ff180f3a92fc88689ce7402 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Thu, 20 Mar 2025 19:23:05 +0300 Subject: [PATCH 01/37] Test deploy --- .azure-pipelines/ci-build.yml | 229 +++++++++++++++++----------------- 1 file changed, 115 insertions(+), 114 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index c916a3bc6..68f5220c4 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,6 +7,7 @@ trigger: include: - main - support/v1 + - task/move-to-deploy-stage tags: include: - 'v*' @@ -22,7 +23,7 @@ variables: ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' REGISTRY: 'msgraphprodregistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/main' + PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' resources: repositories: @@ -318,119 +319,119 @@ extends: assets: '$(Pipeline.Workspace)\**\*.exe' addChangeLog: false - - stage: Build_and_deploy_docker_images - displayName: 'Build and deploy docker images' - condition: or(eq(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], variables['PREVIEW_BRANCH'])) - dependsOn: build - pool: - name: Azure-Pipelines-1ESPT-ExDShared - image: ubuntu-latest - os: linux - jobs: - - job: buildAndPush - steps: - - task: AzureCLI@2 - displayName: 'Login to Azure Container Registry' - inputs: - azureSubscription: 'ACR Images Push Service Connection' - scriptType: bash - scriptLocation: inlineScript - inlineScript: | - az acr login --name msgraphprodregistry - - - powershell: | - $content = [XML](Get-Content ./Directory.Build.props) - Write-Host "XML loaded, finding version..." - - # Handle PropertyGroup as either a single element or array - $version = $null - if ($content.Project.PropertyGroup -is [array]) { - Write-Host "PropertyGroup is an array, checking each entry..." - foreach ($pg in $content.Project.PropertyGroup) { - if ($pg.Version) { - $version = $pg.Version.ToString().Trim() - Write-Host "Found version in PropertyGroup array: $version" - break + - deployment: deploy_docker_image + displayName: 'Build and deploy docker images' + condition: or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], variables['PREVIEW_BRANCH'])) + dependsOn: build + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: ubuntu-latest + os: linux + jobs: + - job: buildAndPush + steps: + - task: AzureCLI@2 + displayName: 'Login to Azure Container Registry' + inputs: + azureSubscription: 'ACR Push Test' + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + az acr login --name msgraphpperegistry + + - powershell: | + $content = [XML](Get-Content ./Directory.Build.props) + Write-Host "XML loaded, finding version..." + + # Handle PropertyGroup as either a single element or array + $version = $null + if ($content.Project.PropertyGroup -is [array]) { + Write-Host "PropertyGroup is an array, checking each entry..." + foreach ($pg in $content.Project.PropertyGroup) { + if ($pg.Version) { + $version = $pg.Version.ToString().Trim() + Write-Host "Found version in PropertyGroup array: $version" + break + } + } + } else { + # Single PropertyGroup + $version = $content.Project.PropertyGroup.Version + if ($version) { + $version = $version.ToString().Trim() + Write-Host "Found version in PropertyGroup: $version" } } - } else { - # Single PropertyGroup - $version = $content.Project.PropertyGroup.Version - if ($version) { - $version = $version.ToString().Trim() - Write-Host "Found version in PropertyGroup: $version" + + if (-not $version) { + Write-Host "##vso[task.logissue type=error]Version not found in Directory.Build.props" + exit 1 } - } - - if (-not $version) { - Write-Host "##vso[task.logissue type=error]Version not found in Directory.Build.props" - exit 1 - } - - Write-Host "Version found: $version" - Write-Host "##vso[task.setvariable variable=version;isoutput=true]$version" - Write-Host "##vso[task.setvariable variable=VERSION]$version" - displayName: 'Get version from csproj' - name: getversion - - - bash: | - # Debug output to verify version variable - echo "Version from previous step: $VERSION" - displayName: 'Verify version variable' - - - bash: | - echo "Build Number: $(Build.BuildNumber)" - # Extract the last 3 characters for the run number - runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$') - echo "Extracted Run Number: $runnumber" - - # If extraction fails, set a default - if [ -z "$runnumber" ]; then - echo "Extraction failed, using default value" - runnumber=$(date +"%S%N" | cut -c1-3) - echo "Generated fallback run number: $runnumber" - fi - - # Set the variable for later steps - echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber" - echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" - displayName: 'Get truncated run number' - name: getrunnumber - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - date=$(date +'%Y%m%d') - echo "Date value: $date" - echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date" - echo "##vso[task.setvariable variable=BUILDDATE]$date" - displayName: 'Get current date' - name: setdate - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - echo "Building Docker image..." - echo "Using build date: ${BUILDDATE}" - # Using quotes around tags to prevent flag interpretation - docker build \ - -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ - -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Build.SourcesDirectory)" - - echo "Pushing Docker image with nightly tag..." - docker push "$(REGISTRY)/$(IMAGE_NAME):nightly" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" - displayName: 'Build and Push Nightly Image' - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - echo "Building Docker image for release..." - docker build \ - -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ - -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Build.SourcesDirectory)" - - echo "Pushing Docker image with latest and version tags..." - docker push "$(REGISTRY)/$(IMAGE_NAME):latest" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" - displayName: 'Build and Push Release Image' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file + + Write-Host "Version found: $version" + Write-Host "##vso[task.setvariable variable=version;isoutput=true]$version" + Write-Host "##vso[task.setvariable variable=VERSION]$version" + displayName: 'Get version from csproj' + name: getversion + + - bash: | + # Debug output to verify version variable + echo "Version from previous step: $VERSION" + displayName: 'Verify version variable' + + - bash: | + echo "Build Number: $(Build.BuildNumber)" + # Extract the last 3 characters for the run number + runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$') + echo "Extracted Run Number: $runnumber" + + # If extraction fails, set a default + if [ -z "$runnumber" ]; then + echo "Extraction failed, using default value" + runnumber=$(date +"%S%N" | cut -c1-3) + echo "Generated fallback run number: $runnumber" + fi + + # Set the variable for later steps + echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber" + echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" + displayName: 'Get truncated run number' + name: getrunnumber + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - bash: | + date=$(date +'%Y%m%d') + echo "Date value: $date" + echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date" + echo "##vso[task.setvariable variable=BUILDDATE]$date" + displayName: 'Get current date' + name: setdate + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - bash: | + echo "Building Docker image..." + echo "Using build date: ${BUILDDATE}" + # Using quotes around tags to prevent flag interpretation + docker build \ + -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ + -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ + "$(Build.SourcesDirectory)" + + echo "Pushing Docker image with nightly tag..." + docker push "$(REGISTRY)/$(IMAGE_NAME):nightly" + docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" + displayName: 'Build and Push Nightly Image' + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - bash: | + echo "Building Docker image for release..." + docker build \ + -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ + -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ + "$(Build.SourcesDirectory)" + + echo "Pushing Docker image with latest and version tags..." + docker push "$(REGISTRY)/$(IMAGE_NAME):latest" + docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" + displayName: 'Build and Push Release Image' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From 4349872acf095e10ac161b7f78d4d87a80fef748 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Thu, 20 Mar 2025 19:30:55 +0300 Subject: [PATCH 02/37] Fix yaml --- .azure-pipelines/ci-build.yml | 218 +++++++++++++++++----------------- 1 file changed, 108 insertions(+), 110 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 68f5220c4..12fa0edbf 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -320,118 +320,116 @@ extends: addChangeLog: false - deployment: deploy_docker_image - displayName: 'Build and deploy docker images' - condition: or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], variables['PREVIEW_BRANCH'])) - dependsOn: build - pool: - name: Azure-Pipelines-1ESPT-ExDShared - image: ubuntu-latest - os: linux - jobs: - - job: buildAndPush - steps: - - task: AzureCLI@2 - displayName: 'Login to Azure Container Registry' - inputs: - azureSubscription: 'ACR Push Test' - scriptType: bash - scriptLocation: inlineScript - inlineScript: | - az acr login --name msgraphpperegistry + strategy: + runOnce: + deploy: + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: ubuntu-latest + os: linux + steps: + - task: AzureCLI@2 + displayName: 'Login to Azure Container Registry' + inputs: + azureSubscription: 'ACR Push Test' + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + az acr login --name msgraphpperegistry - - powershell: | - $content = [XML](Get-Content ./Directory.Build.props) - Write-Host "XML loaded, finding version..." - - # Handle PropertyGroup as either a single element or array - $version = $null - if ($content.Project.PropertyGroup -is [array]) { - Write-Host "PropertyGroup is an array, checking each entry..." - foreach ($pg in $content.Project.PropertyGroup) { - if ($pg.Version) { - $version = $pg.Version.ToString().Trim() - Write-Host "Found version in PropertyGroup array: $version" - break + - powershell: | + $content = [XML](Get-Content ./Directory.Build.props) + Write-Host "XML loaded, finding version..." + + # Handle PropertyGroup as either a single element or array + $version = $null + if ($content.Project.PropertyGroup -is [array]) { + Write-Host "PropertyGroup is an array, checking each entry..." + foreach ($pg in $content.Project.PropertyGroup) { + if ($pg.Version) { + $version = $pg.Version.ToString().Trim() + Write-Host "Found version in PropertyGroup array: $version" + break + } + } + } else { + # Single PropertyGroup + $version = $content.Project.PropertyGroup.Version + if ($version) { + $version = $version.ToString().Trim() + Write-Host "Found version in PropertyGroup: $version" } } - } else { - # Single PropertyGroup - $version = $content.Project.PropertyGroup.Version - if ($version) { - $version = $version.ToString().Trim() - Write-Host "Found version in PropertyGroup: $version" + + if (-not $version) { + Write-Host "##vso[task.logissue type=error]Version not found in Directory.Build.props" + exit 1 } - } - - if (-not $version) { - Write-Host "##vso[task.logissue type=error]Version not found in Directory.Build.props" - exit 1 - } - - Write-Host "Version found: $version" - Write-Host "##vso[task.setvariable variable=version;isoutput=true]$version" - Write-Host "##vso[task.setvariable variable=VERSION]$version" - displayName: 'Get version from csproj' - name: getversion - - - bash: | - # Debug output to verify version variable - echo "Version from previous step: $VERSION" - displayName: 'Verify version variable' - - - bash: | - echo "Build Number: $(Build.BuildNumber)" - # Extract the last 3 characters for the run number - runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$') - echo "Extracted Run Number: $runnumber" - - # If extraction fails, set a default - if [ -z "$runnumber" ]; then - echo "Extraction failed, using default value" - runnumber=$(date +"%S%N" | cut -c1-3) - echo "Generated fallback run number: $runnumber" - fi - - # Set the variable for later steps - echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber" - echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" - displayName: 'Get truncated run number' - name: getrunnumber - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - date=$(date +'%Y%m%d') - echo "Date value: $date" - echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date" - echo "##vso[task.setvariable variable=BUILDDATE]$date" - displayName: 'Get current date' - name: setdate - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - echo "Building Docker image..." - echo "Using build date: ${BUILDDATE}" - # Using quotes around tags to prevent flag interpretation - docker build \ - -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ - -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Build.SourcesDirectory)" - - echo "Pushing Docker image with nightly tag..." - docker push "$(REGISTRY)/$(IMAGE_NAME):nightly" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" - displayName: 'Build and Push Nightly Image' - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - echo "Building Docker image for release..." - docker build \ - -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ - -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Build.SourcesDirectory)" + + Write-Host "Version found: $version" + Write-Host "##vso[task.setvariable variable=version;isoutput=true]$version" + Write-Host "##vso[task.setvariable variable=VERSION]$version" + displayName: 'Get version from csproj' + name: getversion + + - bash: | + # Debug output to verify version variable + echo "Version from previous step: $VERSION" + displayName: 'Verify version variable' + + - bash: | + echo "Build Number: $(Build.BuildNumber)" + # Extract the last 3 characters for the run number + runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$') + echo "Extracted Run Number: $runnumber" + + # If extraction fails, set a default + if [ -z "$runnumber" ]; then + echo "Extraction failed, using default value" + runnumber=$(date +"%S%N" | cut -c1-3) + echo "Generated fallback run number: $runnumber" + fi + + # Set the variable for later steps + echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber" + echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" + displayName: 'Get truncated run number' + name: getrunnumber + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - echo "Pushing Docker image with latest and version tags..." - docker push "$(REGISTRY)/$(IMAGE_NAME):latest" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" - displayName: 'Build and Push Release Image' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file + - bash: | + date=$(date +'%Y%m%d') + echo "Date value: $date" + echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date" + echo "##vso[task.setvariable variable=BUILDDATE]$date" + displayName: 'Get current date' + name: setdate + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - bash: | + echo "Building Docker image..." + echo "Using build date: ${BUILDDATE}" + # Using quotes around tags to prevent flag interpretation + docker build \ + -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ + -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ + "$(Build.SourcesDirectory)" + + echo "Pushing Docker image with nightly tag..." + docker push "$(REGISTRY)/$(IMAGE_NAME):nightly" + docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" + displayName: 'Build and Push Nightly Image' + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - bash: | + echo "Building Docker image for release..." + docker build \ + -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ + -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ + "$(Build.SourcesDirectory)" + + echo "Pushing Docker image with latest and version tags..." + docker push "$(REGISTRY)/$(IMAGE_NAME):latest" + docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" + displayName: 'Build and Push Release Image' + condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From de6bb9128da9c4c69cbe2f9a3fd649c5ad030e55 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Thu, 20 Mar 2025 20:10:10 +0300 Subject: [PATCH 03/37] Add environment --- .azure-pipelines/ci-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 12fa0edbf..51266c192 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -320,6 +320,7 @@ extends: addChangeLog: false - deployment: deploy_docker_image + environment: kiota-github-releases strategy: runOnce: deploy: From 8ecec248117b8ae29353a9d679ce8fce5b374a5c Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Thu, 20 Mar 2025 22:14:36 +0300 Subject: [PATCH 04/37] Update trigger condition --- .azure-pipelines/ci-build.yml | 224 +++++++++++++++++----------------- 1 file changed, 112 insertions(+), 112 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 51266c192..661cb54be 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -201,123 +201,123 @@ extends: content: '*.nupkg' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + condition: and(or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), not(contains(variables['Build.SourceBranch'], '-preview'))) dependsOn: build jobs: - - deployment: deploy_hidi - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_hidi + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_lib - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - powershell: | - $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - foreach($fileName in $fileNames) { - if(Test-Path $fileName) { - rm $fileName -Verbose - } - } - displayName: remove other nupkgs to avoid duplication - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_lib + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - powershell: | + # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + # foreach($fileName in $fileNames) { + # if(Test-Path $fileName) { + # rm $fileName -Verbose + # } + # } + # displayName: remove other nupkgs to avoid duplication + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_yaml_reader - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: deploy_lib - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_yaml_reader + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: deploy_lib + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: create_github_release - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: kiota-github-releases - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - #Set Variable $artifactName and $artifactVersion - Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - echo "$artifactVersion" - displayName: 'Fetch Artifact Name' - - task: GitHubRelease@1 - displayName: 'GitHub release (edit)' - condition: succeededOrFailed() - inputs: - gitHubConnection: 'Github-MaggieKimani1' - action: edit - tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)' - releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.exe' - addChangeLog: false + # - deployment: create_github_release + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: kiota-github-releases + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - pwsh: | + # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + # #Set Variable $artifactName and $artifactVersion + # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + # echo "$artifactVersion" + # displayName: 'Fetch Artifact Name' + # - task: GitHubRelease@1 + # displayName: 'GitHub release (edit)' + # condition: succeededOrFailed() + # inputs: + # gitHubConnection: 'Github-MaggieKimani1' + # action: edit + # tagSource: userSpecifiedTag + # tag: 'v$(artifactVersion)' + # releaseNotesSource: inline + # assets: '$(Pipeline.Workspace)\**\*.exe' + # addChangeLog: false - deployment: deploy_docker_image environment: kiota-github-releases From ccfb2d837741dac3b6d0ce0e696363f962b006ce Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Thu, 20 Mar 2025 22:44:05 +0300 Subject: [PATCH 05/37] Checkout repo first --- .azure-pipelines/ci-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 661cb54be..2a244f8e8 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -329,6 +329,8 @@ extends: image: ubuntu-latest os: linux steps: + - checkout: self + - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: From 3dc212666bbb563bc7c76f62ac3dfb09ab410975 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Thu, 20 Mar 2025 23:09:08 +0300 Subject: [PATCH 06/37] Add platform --- .azure-pipelines/ci-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 2a244f8e8..5d7fee4d1 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -330,7 +330,7 @@ extends: os: linux steps: - checkout: self - + - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: @@ -414,6 +414,7 @@ extends: echo "Using build date: ${BUILDDATE}" # Using quotes around tags to prevent flag interpretation docker build \ + --platform linux/amd64 \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" From 496087ebed19d3d06a1ae82c5e212d1790446f9c Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Thu, 20 Mar 2025 23:39:45 +0300 Subject: [PATCH 07/37] Use buildx --- .azure-pipelines/ci-build.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 5d7fee4d1..a89f88806 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -379,6 +379,18 @@ extends: # Debug output to verify version variable echo "Version from previous step: $VERSION" displayName: 'Verify version variable' + + - script: | + docker run --privileged --rm tonistiigi/binfmt --install all + displayName: "Enable multi-platform builds" + + - script: | + docker buildx create --use --name mybuilder + displayName: "Set up Docker BuildX" + + - script: | + docker buildx inspect --bootstrap + displayName: "Ensure BuildX is working" - bash: | echo "Build Number: $(Build.BuildNumber)" @@ -413,27 +425,24 @@ extends: echo "Building Docker image..." echo "Using build date: ${BUILDDATE}" # Using quotes around tags to prevent flag interpretation - docker build \ - --platform linux/amd64 \ + docker buildx build \ + --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --push \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" - - echo "Pushing Docker image with nightly tag..." - docker push "$(REGISTRY)/$(IMAGE_NAME):nightly" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" + displayName: 'Build and Push Nightly Image' condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - bash: | echo "Building Docker image for release..." - docker build \ + docker buildx build \ + --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --push \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" - - echo "Pushing Docker image with latest and version tags..." - docker push "$(REGISTRY)/$(IMAGE_NAME):latest" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" + displayName: 'Build and Push Release Image' condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From 9463d4864d37a55786b7605185158a680b5cc427 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Fri, 21 Mar 2025 08:45:17 +0300 Subject: [PATCH 08/37] Fix platforms --- .azure-pipelines/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index a89f88806..abbe508f7 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -426,7 +426,7 @@ extends: echo "Using build date: ${BUILDDATE}" # Using quotes around tags to prevent flag interpretation docker buildx build \ - --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --platform linux/arm64/v8,linux/arm/v7 \ --push \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ @@ -438,7 +438,7 @@ extends: - bash: | echo "Building Docker image for release..." docker buildx build \ - --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --platform linux/arm64/v8,linux/arm/v7 \ --push \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ From 645a96ea21be3f567ceff07b677dfeeb2cda071b Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Fri, 21 Mar 2025 09:09:13 +0300 Subject: [PATCH 09/37] Fix platform --- .azure-pipelines/ci-build.yml | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index abbe508f7..e181afcbb 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -379,18 +379,6 @@ extends: # Debug output to verify version variable echo "Version from previous step: $VERSION" displayName: 'Verify version variable' - - - script: | - docker run --privileged --rm tonistiigi/binfmt --install all - displayName: "Enable multi-platform builds" - - - script: | - docker buildx create --use --name mybuilder - displayName: "Set up Docker BuildX" - - - script: | - docker buildx inspect --bootstrap - displayName: "Ensure BuildX is working" - bash: | echo "Build Number: $(Build.BuildNumber)" @@ -425,24 +413,28 @@ extends: echo "Building Docker image..." echo "Using build date: ${BUILDDATE}" # Using quotes around tags to prevent flag interpretation - docker buildx build \ - --platform linux/arm64/v8,linux/arm/v7 \ - --push \ + docker build \ + --platform linux/arm64/v8 \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" - + + echo "Pushing Docker image with nightly tag..." + docker push "$(REGISTRY)/$(IMAGE_NAME):nightly" + docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" displayName: 'Build and Push Nightly Image' condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - bash: | echo "Building Docker image for release..." - docker buildx build \ - --platform linux/arm64/v8,linux/arm/v7 \ - --push \ + docker build \ + --platform linux/arm64/v8 \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" - + + echo "Pushing Docker image with latest and version tags..." + docker push "$(REGISTRY)/$(IMAGE_NAME):latest" + docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" displayName: 'Build and Push Release Image' condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From 84b0543cf27794f1018ad4c52d48b55113f5ba70 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Fri, 21 Mar 2025 11:08:14 +0300 Subject: [PATCH 10/37] Test with removed privilege --- .azure-pipelines/ci-build.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index e181afcbb..29a4a71c3 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -409,11 +409,23 @@ extends: name: setdate condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + - script: | + docker run --rm tonistiigi/binfmt --install all + displayName: "Enable multi-platform builds" + + - script: | + docker buildx create --use --name mybuilder + displayName: "Set up Docker BuildX" + + - script: | + docker buildx inspect --bootstrap + displayName: "Ensure BuildX is working" + - bash: | echo "Building Docker image..." echo "Using build date: ${BUILDDATE}" # Using quotes around tags to prevent flag interpretation - docker build \ + docker buildx \ --platform linux/arm64/v8 \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ @@ -427,7 +439,7 @@ extends: - bash: | echo "Building Docker image for release..." - docker build \ + docker buildx \ --platform linux/arm64/v8 \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ From cbabba5a0fffee5670d67980ea4a42420a1dc4ec Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 25 Mar 2025 08:43:14 +0300 Subject: [PATCH 11/37] Remove global definition for environment --- .azure-pipelines/ci-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 29a4a71c3..b8408b5cc 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -34,16 +34,16 @@ resources: extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: - pool: - name: Azure-Pipelines-1ESPT-ExDShared - image: windows-2022 - os: windows customBuildTags: - ES365AIMigrationTooling stages: - stage: build jobs: - job: build + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: windows-2022 + os: windows templateContext: outputs: - output: pipelineArtifact From 313ba89113c9c4b82d0aeabfa40a83539a53a158 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 25 Mar 2025 08:51:28 +0300 Subject: [PATCH 12/37] Restore privileged mode --- .azure-pipelines/ci-build.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index b8408b5cc..559c4d9c8 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -34,16 +34,16 @@ resources: extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: windows-2022 + os: windows customBuildTags: - ES365AIMigrationTooling stages: - stage: build jobs: - job: build - pool: - name: Azure-Pipelines-1ESPT-ExDShared - image: windows-2022 - os: windows templateContext: outputs: - output: pipelineArtifact @@ -325,9 +325,7 @@ extends: runOnce: deploy: pool: - name: Azure-Pipelines-1ESPT-ExDShared - image: ubuntu-latest - os: linux + vmImage: 'ubuntu-latest' steps: - checkout: self @@ -410,7 +408,7 @@ extends: condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - script: | - docker run --rm tonistiigi/binfmt --install all + docker run --privileged --rm tonistiigi/binfmt --install all displayName: "Enable multi-platform builds" - script: | From 666ff3544d594e7cff1945b774d6a6f3a5cb9057 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 25 Mar 2025 09:28:36 +0300 Subject: [PATCH 13/37] Specify pool at stage level --- .azure-pipelines/ci-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 559c4d9c8..74f38b361 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -203,6 +203,9 @@ extends: - stage: deploy condition: and(or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), not(contains(variables['Build.SourceBranch'], '-preview'))) dependsOn: build + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: ubuntu-latest jobs: # - deployment: deploy_hidi # templateContext: From dc0dd676c389f12754e40040c11f2332ecda6924 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 25 Mar 2025 09:53:59 +0300 Subject: [PATCH 14/37] Update image --- .azure-pipelines/ci-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 74f38b361..90a1a9fa0 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -205,6 +205,7 @@ extends: dependsOn: build pool: name: Azure-Pipelines-1ESPT-ExDShared + os: linux image: ubuntu-latest jobs: # - deployment: deploy_hidi From 29bcd0c74d88a2207fcbb7faaf2af94a68666e0b Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 25 Mar 2025 10:17:04 +0300 Subject: [PATCH 15/37] Fix buildx --- .azure-pipelines/ci-build.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 90a1a9fa0..30fee59f3 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -427,28 +427,23 @@ extends: echo "Building Docker image..." echo "Using build date: ${BUILDDATE}" # Using quotes around tags to prevent flag interpretation - docker buildx \ - --platform linux/arm64/v8 \ + docker buildx build \ + --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --push \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" - - echo "Pushing Docker image with nightly tag..." - docker push "$(REGISTRY)/$(IMAGE_NAME):nightly" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" + displayName: 'Build and Push Nightly Image' condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - bash: | echo "Building Docker image for release..." - docker buildx \ - --platform linux/arm64/v8 \ + docker buildx build\ + --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --push \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" - - echo "Pushing Docker image with latest and version tags..." - docker push "$(REGISTRY)/$(IMAGE_NAME):latest" - docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" displayName: 'Build and Push Release Image' condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From 3b7235ea37a52e87c9d134a3a17e7b9f7883c3ed Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 25 Mar 2025 14:27:04 +0300 Subject: [PATCH 16/37] Remove ARM v7 --- .azure-pipelines/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 30fee59f3..39d28a85a 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -428,7 +428,7 @@ extends: echo "Using build date: ${BUILDDATE}" # Using quotes around tags to prevent flag interpretation docker buildx build \ - --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --platform linux/amd64,linux/arm64/v8 \ --push \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ @@ -440,7 +440,7 @@ extends: - bash: | echo "Building Docker image for release..." docker buildx build\ - --platform linux/amd64,linux/arm64/v8,linux/arm/v7 \ + --platform linux/amd64,linux/arm64/v8 \ --push \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ From dc8e4ff38d1e9639fe778a1232ebd3e0c958464e Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 26 Mar 2025 09:58:38 +0300 Subject: [PATCH 17/37] Test on PPE --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 39d28a85a..a013b28aa 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -21,7 +21,7 @@ variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphprodregistry.azurecr.io' + REGISTRY: 'msgraphpperegistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' From e61a4a9ea22c7ea0432537e38e4ba985b0d217b8 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 26 Mar 2025 10:43:54 +0300 Subject: [PATCH 18/37] Switch to prod configs --- .azure-pipelines/ci-build.yml | 233 +++++++++++++++++----------------- 1 file changed, 118 insertions(+), 115 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index a013b28aa..bd320f766 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -21,7 +21,7 @@ variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphpperegistry.azurecr.io' + REGISTRY: 'msgraphprodregistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' @@ -201,127 +201,130 @@ extends: content: '*.nupkg' - stage: deploy - condition: and(or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), not(contains(variables['Build.SourceBranch'], '-preview'))) + condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']))) dependsOn: build pool: name: Azure-Pipelines-1ESPT-ExDShared os: linux image: ubuntu-latest jobs: - # - deployment: deploy_hidi - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_hidi + condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_lib - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - powershell: | - # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - # foreach($fileName in $fileNames) { - # if(Test-Path $fileName) { - # rm $fileName -Verbose - # } - # } - # displayName: remove other nupkgs to avoid duplication - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_lib + condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - powershell: | + $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + foreach($fileName in $fileNames) { + if(Test-Path $fileName) { + rm $fileName -Verbose + } + } + displayName: remove other nupkgs to avoid duplication + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_yaml_reader - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: deploy_lib - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_yaml_reader + condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: deploy_lib + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: create_github_release - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: kiota-github-releases - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - pwsh: | - # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - # #Set Variable $artifactName and $artifactVersion - # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - # echo "$artifactVersion" - # displayName: 'Fetch Artifact Name' - # - task: GitHubRelease@1 - # displayName: 'GitHub release (edit)' - # condition: succeededOrFailed() - # inputs: - # gitHubConnection: 'Github-MaggieKimani1' - # action: edit - # tagSource: userSpecifiedTag - # tag: 'v$(artifactVersion)' - # releaseNotesSource: inline - # assets: '$(Pipeline.Workspace)\**\*.exe' - # addChangeLog: false + - deployment: create_github_release + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: kiota-github-releases + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - pwsh: | + $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + #Set Variable $artifactName and $artifactVersion + Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + echo "$artifactVersion" + displayName: 'Fetch Artifact Name' + - task: GitHubRelease@1 + displayName: 'GitHub release (edit)' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: edit + tagSource: userSpecifiedTag + tag: 'v$(artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.exe' + addChangeLog: false - deployment: deploy_docker_image environment: kiota-github-releases @@ -336,11 +339,11 @@ extends: - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: - azureSubscription: 'ACR Push Test' + azureSubscription: 'ACR Images Push Service Connection' scriptType: bash scriptLocation: inlineScript inlineScript: | - az acr login --name msgraphpperegistry + az acr login --name msgraphprodregistry - powershell: | $content = [XML](Get-Content ./Directory.Build.props) From cffa9d30d453a85dca21bb5f455d5618103a49f7 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 26 Mar 2025 10:44:25 +0300 Subject: [PATCH 19/37] Fix trigger branch --- .azure-pipelines/ci-build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index bd320f766..cb7d962fe 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,7 +7,6 @@ trigger: include: - main - support/v1 - - task/move-to-deploy-stage tags: include: - 'v*' @@ -23,7 +22,7 @@ variables: ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' REGISTRY: 'msgraphprodregistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' + PREVIEW_BRANCH: 'refs/heads/main' resources: repositories: @@ -199,7 +198,7 @@ extends: targetFolder: $(Build.ArtifactStagingDirectory)/Nugets sourceFolder: $(Build.ArtifactStagingDirectory) content: '*.nupkg' - + - stage: deploy condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']))) dependsOn: build From 1aef4499ff36e8d6b33ce3cacaa952711ce41569 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 26 Mar 2025 10:48:43 +0300 Subject: [PATCH 20/37] Close and condition --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index cb7d962fe..9bb4ce366 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -200,7 +200,7 @@ extends: content: '*.nupkg' - stage: deploy - condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']))) + condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) dependsOn: build pool: name: Azure-Pipelines-1ESPT-ExDShared From 1ed040b966d59d89d26bb2621286e558399b11b2 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 26 Mar 2025 19:54:24 +0300 Subject: [PATCH 21/37] Test triggers --- .azure-pipelines/ci-build.yml | 190 +++++++++++++++++----------------- 1 file changed, 96 insertions(+), 94 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 9bb4ce366..3d5e38205 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,6 +7,7 @@ trigger: include: - main - support/v1 + - task/move-to-deploy-stage tags: include: - 'v*' @@ -15,14 +16,15 @@ pr: include: - main - support/v1 + - task/move-to-deploy-stage variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphprodregistry.azurecr.io' + REGISTRY: 'msgraphpperegistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/main' + PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' resources: repositories: @@ -232,98 +234,98 @@ extends: nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_lib - condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - powershell: | - $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - foreach($fileName in $fileNames) { - if(Test-Path $fileName) { - rm $fileName -Verbose - } - } - displayName: remove other nupkgs to avoid duplication - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_lib + # condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - powershell: | + # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + # foreach($fileName in $fileNames) { + # if(Test-Path $fileName) { + # rm $fileName -Verbose + # } + # } + # displayName: remove other nupkgs to avoid duplication + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_yaml_reader - condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: deploy_lib - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_yaml_reader + # condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: deploy_lib + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: create_github_release - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: kiota-github-releases - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - #Set Variable $artifactName and $artifactVersion - Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - echo "$artifactVersion" - displayName: 'Fetch Artifact Name' - - task: GitHubRelease@1 - displayName: 'GitHub release (edit)' - condition: succeededOrFailed() - inputs: - gitHubConnection: 'Github-MaggieKimani1' - action: edit - tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)' - releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.exe' - addChangeLog: false + # - deployment: create_github_release + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: kiota-github-releases + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - pwsh: | + # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + # #Set Variable $artifactName and $artifactVersion + # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + # echo "$artifactVersion" + # displayName: 'Fetch Artifact Name' + # - task: GitHubRelease@1 + # displayName: 'GitHub release (edit)' + # condition: succeededOrFailed() + # inputs: + # gitHubConnection: 'Github-MaggieKimani1' + # action: edit + # tagSource: userSpecifiedTag + # tag: 'v$(artifactVersion)' + # releaseNotesSource: inline + # assets: '$(Pipeline.Workspace)\**\*.exe' + # addChangeLog: false - deployment: deploy_docker_image environment: kiota-github-releases @@ -338,11 +340,11 @@ extends: - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: - azureSubscription: 'ACR Images Push Service Connection' + azureSubscription: 'ACR Push Test' scriptType: bash scriptLocation: inlineScript inlineScript: | - az acr login --name msgraphprodregistry + az acr login --name msgraphpperegistry - powershell: | $content = [XML](Get-Content ./Directory.Build.props) From 80e08a5b77b907504be41c0cf6f06a4f9a0e305f Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 26 Mar 2025 21:25:22 +0300 Subject: [PATCH 22/37] Fix typo in condition --- .azure-pipelines/ci-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 3d5e38205..434b1fd51 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -202,7 +202,7 @@ extends: content: '*.nupkg' - stage: deploy - condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) + condition: and(or(contains(variables['Build.sourceBranch'], 'refs/tags/v'), eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) dependsOn: build pool: name: Azure-Pipelines-1ESPT-ExDShared @@ -404,7 +404,7 @@ extends: echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" displayName: 'Get truncated run number' name: getrunnumber - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + condition: eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH']) - bash: | date=$(date +'%Y%m%d') @@ -413,7 +413,7 @@ extends: echo "##vso[task.setvariable variable=BUILDDATE]$date" displayName: 'Get current date' name: setdate - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + condition: eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH']) - script: | docker run --privileged --rm tonistiigi/binfmt --install all @@ -439,7 +439,7 @@ extends: "$(Build.SourcesDirectory)" displayName: 'Build and Push Nightly Image' - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + condition: eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH']) - bash: | echo "Building Docker image for release..." @@ -450,4 +450,4 @@ extends: -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" displayName: 'Build and Push Release Image' - condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file + condition: contains(variables['Build.sourceBranch'], 'refs/tags/v') \ No newline at end of file From 152946f5786b708b0cbdb4063f13609436b2118b Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 26 Mar 2025 21:37:06 +0300 Subject: [PATCH 23/37] Update references --- .azure-pipelines/ci-build.yml | 202 +++++++++++++++++----------------- 1 file changed, 100 insertions(+), 102 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 434b1fd51..be6144580 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,7 +7,6 @@ trigger: include: - main - support/v1 - - task/move-to-deploy-stage tags: include: - 'v*' @@ -16,15 +15,14 @@ pr: include: - main - support/v1 - - task/move-to-deploy-stage variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphpperegistry.azurecr.io' + REGISTRY: 'msgraphprodregistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' + PREVIEW_BRANCH: 'refs/heads/main' resources: repositories: @@ -202,7 +200,7 @@ extends: content: '*.nupkg' - stage: deploy - condition: and(or(contains(variables['Build.sourceBranch'], 'refs/tags/v'), eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) + condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) dependsOn: build pool: name: Azure-Pipelines-1ESPT-ExDShared @@ -210,7 +208,7 @@ extends: image: ubuntu-latest jobs: - deployment: deploy_hidi - condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) templateContext: type: releaseJob isProduction: true @@ -234,98 +232,98 @@ extends: nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_lib - # condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - powershell: | - # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - # foreach($fileName in $fileNames) { - # if(Test-Path $fileName) { - # rm $fileName -Verbose - # } - # } - # displayName: remove other nupkgs to avoid duplication - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_lib + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - powershell: | + $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + foreach($fileName in $fileNames) { + if(Test-Path $fileName) { + rm $fileName -Verbose + } + } + displayName: remove other nupkgs to avoid duplication + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_yaml_reader - # condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: deploy_lib - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_yaml_reader + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: deploy_lib + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: create_github_release - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: kiota-github-releases - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - pwsh: | - # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - # #Set Variable $artifactName and $artifactVersion - # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - # echo "$artifactVersion" - # displayName: 'Fetch Artifact Name' - # - task: GitHubRelease@1 - # displayName: 'GitHub release (edit)' - # condition: succeededOrFailed() - # inputs: - # gitHubConnection: 'Github-MaggieKimani1' - # action: edit - # tagSource: userSpecifiedTag - # tag: 'v$(artifactVersion)' - # releaseNotesSource: inline - # assets: '$(Pipeline.Workspace)\**\*.exe' - # addChangeLog: false + - deployment: create_github_release + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: kiota-github-releases + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - pwsh: | + $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + #Set Variable $artifactName and $artifactVersion + Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + echo "$artifactVersion" + displayName: 'Fetch Artifact Name' + - task: GitHubRelease@1 + displayName: 'GitHub release (edit)' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: edit + tagSource: userSpecifiedTag + tag: 'v$(artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.exe' + addChangeLog: false - deployment: deploy_docker_image environment: kiota-github-releases @@ -340,11 +338,11 @@ extends: - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: - azureSubscription: 'ACR Push Test' + azureSubscription: 'ACR Images Push Service Connection' scriptType: bash scriptLocation: inlineScript inlineScript: | - az acr login --name msgraphpperegistry + az acr login --name msgraphprodregistry - powershell: | $content = [XML](Get-Content ./Directory.Build.props) @@ -404,7 +402,7 @@ extends: echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" displayName: 'Get truncated run number' name: getrunnumber - condition: eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH']) + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - bash: | date=$(date +'%Y%m%d') @@ -413,7 +411,7 @@ extends: echo "##vso[task.setvariable variable=BUILDDATE]$date" displayName: 'Get current date' name: setdate - condition: eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH']) + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - script: | docker run --privileged --rm tonistiigi/binfmt --install all @@ -439,7 +437,7 @@ extends: "$(Build.SourcesDirectory)" displayName: 'Build and Push Nightly Image' - condition: eq(variables['Build.sourceBranch'], variables['PREVIEW_BRANCH']) + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - bash: | echo "Building Docker image for release..." @@ -450,4 +448,4 @@ extends: -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ "$(Build.SourcesDirectory)" displayName: 'Build and Push Release Image' - condition: contains(variables['Build.sourceBranch'], 'refs/tags/v') \ No newline at end of file + condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From 80d2a2f31b4354f187e0791b3514b403169ad062 Mon Sep 17 00:00:00 2001 From: EvansA Date: Fri, 28 Mar 2025 09:40:57 +0300 Subject: [PATCH 24/37] Update .azure-pipelines/ci-build.yml Co-authored-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index be6144580..1b0f7b7d4 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -326,7 +326,6 @@ extends: addChangeLog: false - deployment: deploy_docker_image - environment: kiota-github-releases strategy: runOnce: deploy: From 4519068c2a254e7aaf6f3b9729470176d11fe187 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Fri, 28 Mar 2025 10:35:51 +0300 Subject: [PATCH 25/37] Remove checkout step --- .azure-pipelines/ci-build.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 1b0f7b7d4..e7f84b522 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -15,14 +15,15 @@ pr: include: - main - support/v1 + - task/move-to-deploy-stage variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphprodregistry.azurecr.io' + REGISTRY: 'msgraphpperegistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/main' + PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' resources: repositories: @@ -326,22 +327,28 @@ extends: addChangeLog: false - deployment: deploy_docker_image + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + targetPath: '$(Pipeline.Workspace)' strategy: runOnce: deploy: pool: vmImage: 'ubuntu-latest' steps: - - checkout: self + # - checkout: self - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: - azureSubscription: 'ACR Images Push Service Connection' + azureSubscription: 'ACR Push Test' scriptType: bash scriptLocation: inlineScript inlineScript: | - az acr login --name msgraphprodregistry + az acr login --name msgraphpperegistry - powershell: | $content = [XML](Get-Content ./Directory.Build.props) From 21877085d829c9e879a57e82364c4443bf516238 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Fri, 28 Mar 2025 10:59:48 +0300 Subject: [PATCH 26/37] Add artifactname --- .azure-pipelines/ci-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index e7f84b522..83464e11f 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -332,6 +332,7 @@ extends: isProduction: true inputs: - input: pipelineArtifact + artifactName: Nugets targetPath: '$(Pipeline.Workspace)' strategy: runOnce: From dadca7cf81ca7d1e3ef834ec08457d607604c70d Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Fri, 28 Mar 2025 12:22:26 +0300 Subject: [PATCH 27/37] Add environment for tests --- .azure-pipelines/ci-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 83464e11f..581aeb71d 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -327,6 +327,7 @@ extends: addChangeLog: false - deployment: deploy_docker_image + environment: kiota-github-releases templateContext: type: releaseJob isProduction: true From 410bfa6e9e28018ff5231a373bde75624e219a0e Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Fri, 28 Mar 2025 15:16:42 +0300 Subject: [PATCH 28/37] Triger only docker_images deployment --- .azure-pipelines/ci-build.yml | 229 +++++++++++++++++----------------- 1 file changed, 115 insertions(+), 114 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 581aeb71d..b6d35efd4 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,6 +7,7 @@ trigger: include: - main - support/v1 + - task/move-to-deploy-stage tags: include: - 'v*' @@ -208,123 +209,123 @@ extends: os: linux image: ubuntu-latest jobs: - - deployment: deploy_hidi - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_hidi + # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_lib - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - powershell: | - $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - foreach($fileName in $fileNames) { - if(Test-Path $fileName) { - rm $fileName -Verbose - } - } - displayName: remove other nupkgs to avoid duplication - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_lib + # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - powershell: | + # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + # foreach($fileName in $fileNames) { + # if(Test-Path $fileName) { + # rm $fileName -Verbose + # } + # } + # displayName: remove other nupkgs to avoid duplication + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_yaml_reader - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: deploy_lib - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_yaml_reader + # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: deploy_lib + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: create_github_release - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: kiota-github-releases - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - #Set Variable $artifactName and $artifactVersion - Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - echo "$artifactVersion" - displayName: 'Fetch Artifact Name' - - task: GitHubRelease@1 - displayName: 'GitHub release (edit)' - condition: succeededOrFailed() - inputs: - gitHubConnection: 'Github-MaggieKimani1' - action: edit - tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)' - releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.exe' - addChangeLog: false + # - deployment: create_github_release + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: kiota-github-releases + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - pwsh: | + # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + # #Set Variable $artifactName and $artifactVersion + # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + # echo "$artifactVersion" + # displayName: 'Fetch Artifact Name' + # - task: GitHubRelease@1 + # displayName: 'GitHub release (edit)' + # condition: succeededOrFailed() + # inputs: + # gitHubConnection: 'Github-MaggieKimani1' + # action: edit + # tagSource: userSpecifiedTag + # tag: 'v$(artifactVersion)' + # releaseNotesSource: inline + # assets: '$(Pipeline.Workspace)\**\*.exe' + # addChangeLog: false - deployment: deploy_docker_image environment: kiota-github-releases From c08890cb3f65bdf9fab9ffc7d440e6dc79f688b0 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 1 Apr 2025 10:21:42 +0300 Subject: [PATCH 29/37] Copy over files at build --- .azure-pipelines/ci-build.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index b6d35efd4..645590f0f 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -201,6 +201,25 @@ extends: sourceFolder: $(Build.ArtifactStagingDirectory) content: '*.nupkg' + # Copy repository files to be used in the deploy stage + - task: CopyFiles@2 + displayName: 'Copy repository files for deploy stage' + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/* + !**/bin/** + !**/obj/** + !**/.git/** + TargetFolder: '$(Build.ArtifactStagingDirectory)/RepoFiles' + + # Publish repository files as an artifact + - task: PublishPipelineArtifact@1 + displayName: 'Publish Repository Files' + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/RepoFiles' + artifact: 'RepoFiles' + - stage: deploy condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) dependsOn: build @@ -334,8 +353,8 @@ extends: isProduction: true inputs: - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' + artifactName: RepoFiles + targetPath: '$(Pipeline.Workspace)/RepoFiles' strategy: runOnce: deploy: @@ -354,7 +373,7 @@ extends: az acr login --name msgraphpperegistry - powershell: | - $content = [XML](Get-Content ./Directory.Build.props) + $content = [XML](Get-Content $(Pipeline.Workspace)/RepoFiles/Directory.Build.props) Write-Host "XML loaded, finding version..." # Handle PropertyGroup as either a single element or array @@ -443,7 +462,7 @@ extends: --push \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Build.SourcesDirectory)" + "$(Pipeline.Workspace)/RepoFiles" displayName: 'Build and Push Nightly Image' condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) @@ -455,6 +474,6 @@ extends: --push \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Build.SourcesDirectory)" + "$(Pipeline.Workspace)/RepoFiles" displayName: 'Build and Push Release Image' condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From 6bb06b0bd43025a093ca1366bb8fd7a81604219e Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 1 Apr 2025 10:42:43 +0300 Subject: [PATCH 30/37] Remove publish task --- .azure-pipelines/ci-build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 645590f0f..cc58e46b1 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -212,13 +212,6 @@ extends: !**/obj/** !**/.git/** TargetFolder: '$(Build.ArtifactStagingDirectory)/RepoFiles' - - # Publish repository files as an artifact - - task: PublishPipelineArtifact@1 - displayName: 'Publish Repository Files' - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/RepoFiles' - artifact: 'RepoFiles' - stage: deploy condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) From a2964e80a843a547fe2a547e449706a13fba82be Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 1 Apr 2025 15:53:10 +0300 Subject: [PATCH 31/37] Add files to pipeline artifacts --- .azure-pipelines/ci-build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index cc58e46b1..2ade76630 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -51,6 +51,10 @@ extends: displayName: 'Publish Artifact: Nugets' artifactName: Nugets targetPath: '$(Build.ArtifactStagingDirectory)/Nugets' + - output: pipelineArtifact + displayName: 'Publish Artifact: RepoFiles' + artifactName: RepoFiles + targetPath: '$(Build.ArtifactStagingDirectory)/RepoFiles' steps: - task: UseDotNet@2 displayName: 'Use .NET 6' @@ -347,7 +351,7 @@ extends: inputs: - input: pipelineArtifact artifactName: RepoFiles - targetPath: '$(Pipeline.Workspace)/RepoFiles' + targetPath: '$(Pipeline.Workspace)' strategy: runOnce: deploy: From 758cab7d7b2f13190e6d5c1520486ad5a88f919f Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 1 Apr 2025 16:12:02 +0300 Subject: [PATCH 32/37] Fix file reference --- .azure-pipelines/ci-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 2ade76630..057013435 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -370,7 +370,7 @@ extends: az acr login --name msgraphpperegistry - powershell: | - $content = [XML](Get-Content $(Pipeline.Workspace)/RepoFiles/Directory.Build.props) + $content = [XML](Get-Content $(Pipeline.Workspace)/Directory.Build.props) Write-Host "XML loaded, finding version..." # Handle PropertyGroup as either a single element or array @@ -459,7 +459,7 @@ extends: --push \ -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Pipeline.Workspace)/RepoFiles" + "$(Pipeline.Workspace)" displayName: 'Build and Push Nightly Image' condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) @@ -471,6 +471,6 @@ extends: --push \ -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Pipeline.Workspace)/RepoFiles" + "$(Pipeline.Workspace)" displayName: 'Build and Push Release Image' condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file From a68e5e53e10129d4501f3d79bbc5975fe113210c Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 1 Apr 2025 16:32:30 +0300 Subject: [PATCH 33/37] Test new environment --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 057013435..fea10ac4f 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -344,7 +344,7 @@ extends: # addChangeLog: false - deployment: deploy_docker_image - environment: kiota-github-releases + environment: kiota-docker-images-releases templateContext: type: releaseJob isProduction: true From 2598dad81d68926b71afcfa678c6d4e3968417a6 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Tue, 1 Apr 2025 16:52:21 +0300 Subject: [PATCH 34/37] Cleanup and restore right variables --- .azure-pipelines/ci-build.yml | 242 +++++++++++++++++----------------- 1 file changed, 119 insertions(+), 123 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index fea10ac4f..aa682435c 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,7 +7,6 @@ trigger: include: - main - support/v1 - - task/move-to-deploy-stage tags: include: - 'v*' @@ -16,15 +15,14 @@ pr: include: - main - support/v1 - - task/move-to-deploy-stage variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphpperegistry.azurecr.io' + REGISTRY: 'msgraphprodregistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' + PREVIEW_BRANCH: 'refs/heads/main' resources: repositories: @@ -225,126 +223,126 @@ extends: os: linux image: ubuntu-latest jobs: - # - deployment: deploy_hidi - # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_hidi + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_lib - # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - powershell: | - # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - # foreach($fileName in $fileNames) { - # if(Test-Path $fileName) { - # rm $fileName -Verbose - # } - # } - # displayName: remove other nupkgs to avoid duplication - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_lib + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - powershell: | + $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + foreach($fileName in $fileNames) { + if(Test-Path $fileName) { + rm $fileName -Verbose + } + } + displayName: remove other nupkgs to avoid duplication + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_yaml_reader - # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: deploy_lib - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_yaml_reader + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: deploy_lib + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: create_github_release - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: kiota-github-releases - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - pwsh: | - # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - # #Set Variable $artifactName and $artifactVersion - # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - # echo "$artifactVersion" - # displayName: 'Fetch Artifact Name' - # - task: GitHubRelease@1 - # displayName: 'GitHub release (edit)' - # condition: succeededOrFailed() - # inputs: - # gitHubConnection: 'Github-MaggieKimani1' - # action: edit - # tagSource: userSpecifiedTag - # tag: 'v$(artifactVersion)' - # releaseNotesSource: inline - # assets: '$(Pipeline.Workspace)\**\*.exe' - # addChangeLog: false + - deployment: create_github_release + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: kiota-github-releases + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - pwsh: | + $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + #Set Variable $artifactName and $artifactVersion + Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + echo "$artifactVersion" + displayName: 'Fetch Artifact Name' + - task: GitHubRelease@1 + displayName: 'GitHub release (edit)' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: edit + tagSource: userSpecifiedTag + tag: 'v$(artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.exe' + addChangeLog: false - deployment: deploy_docker_image - environment: kiota-docker-images-releases + environment: docker-images-deploy templateContext: type: releaseJob isProduction: true @@ -358,16 +356,14 @@ extends: pool: vmImage: 'ubuntu-latest' steps: - # - checkout: self - - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: - azureSubscription: 'ACR Push Test' + azureSubscription: 'ACR Images Push Service Connection' scriptType: bash scriptLocation: inlineScript inlineScript: | - az acr login --name msgraphpperegistry + az acr login --name msgraphprodregistry - powershell: | $content = [XML](Get-Content $(Pipeline.Workspace)/Directory.Build.props) From 436e048b1ad40230d7e3678ea54bd123319b9a12 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 2 Apr 2025 13:17:57 +0300 Subject: [PATCH 35/37] Validate for this branch --- .azure-pipelines/ci-build.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index aa682435c..ea8d8a901 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,6 +7,7 @@ trigger: include: - main - support/v1 + - task/move-to-deploy-stage tags: include: - 'v*' @@ -15,14 +16,15 @@ pr: include: - main - support/v1 + - task/move-to-deploy-stage variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphprodregistry.azurecr.io' + REGISTRY: 'msgraphpperegistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/main' + PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' resources: repositories: @@ -359,11 +361,11 @@ extends: - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: - azureSubscription: 'ACR Images Push Service Connection' + azureSubscription: 'ACR Push Test' scriptType: bash scriptLocation: inlineScript inlineScript: | - az acr login --name msgraphprodregistry + az acr login --name msgraphpperegistry - powershell: | $content = [XML](Get-Content $(Pipeline.Workspace)/Directory.Build.props) From ec3e05d6b3fa98a8d99a729bbd3b045dd009ab4f Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 2 Apr 2025 21:14:16 +0300 Subject: [PATCH 36/37] Test deploy --- .azure-pipelines/ci-build.yml | 228 +++++++++++++++++----------------- 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index ea8d8a901..6c51f12bb 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -225,123 +225,123 @@ extends: os: linux image: ubuntu-latest jobs: - - deployment: deploy_hidi - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_hidi + # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_lib - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - powershell: | - $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - foreach($fileName in $fileNames) { - if(Test-Path $fileName) { - rm $fileName -Verbose - } - } - displayName: remove other nupkgs to avoid duplication - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_lib + # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - powershell: | + # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + # foreach($fileName in $fileNames) { + # if(Test-Path $fileName) { + # rm $fileName -Verbose + # } + # } + # displayName: remove other nupkgs to avoid duplication + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: deploy_yaml_reader - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: deploy_lib - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' + # - deployment: deploy_yaml_reader + # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: deploy_lib + # environment: nuget-org + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - task: 1ES.PublishNuget@1 + # displayName: 'NuGet push' + # inputs: + # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + # packageParentPath: '$(Pipeline.Workspace)' + # nuGetFeedType: external + # publishFeedCredentials: 'OpenAPI Nuget Connection' - - deployment: create_github_release - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: kiota-github-releases - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - #Set Variable $artifactName and $artifactVersion - Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - echo "$artifactVersion" - displayName: 'Fetch Artifact Name' - - task: GitHubRelease@1 - displayName: 'GitHub release (edit)' - condition: succeededOrFailed() - inputs: - gitHubConnection: 'Github-MaggieKimani1' - action: edit - tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)' - releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.exe' - addChangeLog: false + # - deployment: create_github_release + # templateContext: + # type: releaseJob + # isProduction: true + # inputs: + # - input: pipelineArtifact + # artifactName: Nugets + # targetPath: '$(Pipeline.Workspace)' + # dependsOn: [] + # environment: kiota-github-releases + # strategy: + # runOnce: + # deploy: + # pool: + # vmImage: ubuntu-latest + # steps: + # - pwsh: | + # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + # #Set Variable $artifactName and $artifactVersion + # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + # echo "$artifactVersion" + # displayName: 'Fetch Artifact Name' + # - task: GitHubRelease@1 + # displayName: 'GitHub release (edit)' + # condition: succeededOrFailed() + # inputs: + # gitHubConnection: 'Github-MaggieKimani1' + # action: edit + # tagSource: userSpecifiedTag + # tag: 'v$(artifactVersion)' + # releaseNotesSource: inline + # assets: '$(Pipeline.Workspace)\**\*.exe' + # addChangeLog: false - deployment: deploy_docker_image environment: docker-images-deploy From c10832708b935de19e3c626dbea3074fd4ec1804 Mon Sep 17 00:00:00 2001 From: "Evans Aboge (from Dev Box)" Date: Wed, 2 Apr 2025 21:51:35 +0300 Subject: [PATCH 37/37] Cleanup pipeline --- .azure-pipelines/ci-build.yml | 238 +++++++++++++++++----------------- 1 file changed, 118 insertions(+), 120 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 6c51f12bb..aa682435c 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,7 +7,6 @@ trigger: include: - main - support/v1 - - task/move-to-deploy-stage tags: include: - 'v*' @@ -16,15 +15,14 @@ pr: include: - main - support/v1 - - task/move-to-deploy-stage variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphpperegistry.azurecr.io' + REGISTRY: 'msgraphprodregistry.azurecr.io' IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/task/move-to-deploy-stage' + PREVIEW_BRANCH: 'refs/heads/main' resources: repositories: @@ -225,123 +223,123 @@ extends: os: linux image: ubuntu-latest jobs: - # - deployment: deploy_hidi - # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_hidi + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_lib - # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - powershell: | - # $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - # foreach($fileName in $fileNames) { - # if(Test-Path $fileName) { - # rm $fileName -Verbose - # } - # } - # displayName: remove other nupkgs to avoid duplication - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_lib + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - powershell: | + $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + foreach($fileName in $fileNames) { + if(Test-Path $fileName) { + rm $fileName -Verbose + } + } + displayName: remove other nupkgs to avoid duplication + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: deploy_yaml_reader - # condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: deploy_lib - # environment: nuget-org - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - task: 1ES.PublishNuget@1 - # displayName: 'NuGet push' - # inputs: - # packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - # packageParentPath: '$(Pipeline.Workspace)' - # nuGetFeedType: external - # publishFeedCredentials: 'OpenAPI Nuget Connection' + - deployment: deploy_yaml_reader + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: deploy_lib + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' - # - deployment: create_github_release - # templateContext: - # type: releaseJob - # isProduction: true - # inputs: - # - input: pipelineArtifact - # artifactName: Nugets - # targetPath: '$(Pipeline.Workspace)' - # dependsOn: [] - # environment: kiota-github-releases - # strategy: - # runOnce: - # deploy: - # pool: - # vmImage: ubuntu-latest - # steps: - # - pwsh: | - # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - # #Set Variable $artifactName and $artifactVersion - # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - # echo "$artifactVersion" - # displayName: 'Fetch Artifact Name' - # - task: GitHubRelease@1 - # displayName: 'GitHub release (edit)' - # condition: succeededOrFailed() - # inputs: - # gitHubConnection: 'Github-MaggieKimani1' - # action: edit - # tagSource: userSpecifiedTag - # tag: 'v$(artifactVersion)' - # releaseNotesSource: inline - # assets: '$(Pipeline.Workspace)\**\*.exe' - # addChangeLog: false + - deployment: create_github_release + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: kiota-github-releases + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - pwsh: | + $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + #Set Variable $artifactName and $artifactVersion + Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + echo "$artifactVersion" + displayName: 'Fetch Artifact Name' + - task: GitHubRelease@1 + displayName: 'GitHub release (edit)' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: edit + tagSource: userSpecifiedTag + tag: 'v$(artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.exe' + addChangeLog: false - deployment: deploy_docker_image environment: docker-images-deploy @@ -361,11 +359,11 @@ extends: - task: AzureCLI@2 displayName: 'Login to Azure Container Registry' inputs: - azureSubscription: 'ACR Push Test' + azureSubscription: 'ACR Images Push Service Connection' scriptType: bash scriptLocation: inlineScript inlineScript: | - az acr login --name msgraphpperegistry + az acr login --name msgraphprodregistry - powershell: | $content = [XML](Get-Content $(Pipeline.Workspace)/Directory.Build.props)