From 55352f183eb89980046a1123a82514f5d0dbf863 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 10:18:53 -0500 Subject: [PATCH 1/4] ci: updates main with the latest ci changes --- .azure-pipelines/ci-build.yml | 48 ++++++++++++++++----------- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docker.yml | 16 ++++----- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index f381a4303..e9aa773a3 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -5,13 +5,15 @@ name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) trigger: branches: include: - - master - - vnext + - main + - dev + - support/v1 pr: branches: include: - - master - - vnext + - main + - dev + - support/v1 variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' @@ -206,10 +208,17 @@ extends: content: '*.nupkg' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded()) + condition: and(or(contains(variables['build.sourceBranch'], 'refs/heads/main'),contains(variables['build.sourceBranch'], 'refs/heads/support/v1')), succeeded()) dependsOn: build jobs: - deployment: deploy_hidi + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: @@ -218,11 +227,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - task: DownloadPipelineArtifact@2 displayName: Download hidi executable from artifacts inputs: @@ -264,6 +268,13 @@ extends: ]' - deployment: deploy_lib + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: @@ -272,11 +283,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - powershell: | $fileNames = "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Workbench.*.nupkg" foreach($fileName in $fileNames) { @@ -294,6 +300,13 @@ extends: publishFeedCredentials: 'OpenAPI Nuget Connection' - deployment: deploy_readers + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' dependsOn: deploy_lib environment: nuget-org strategy: @@ -302,11 +315,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 22eb5f8fa..4224ace24 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,7 +2,7 @@ name: CodeQL Analysis on: push: - branches: [ vnext ] + branches: [ main, dev ] pull_request: schedule: - cron: '0 8 * * *' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a2a2bb104..7e81a456d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,7 +2,7 @@ name: Publish Docker image on: workflow_dispatch: push: - branches: [master, vnext] + branches: [main, dev, support/v1] paths: ['src/Microsoft.OpenApi.Hidi/**', '.github/workflows/**'] env: REGISTRY: msgraphprod.azurecr.io @@ -16,7 +16,7 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v4 - - name: Login to GitHub package feed + - name: Login to registry uses: docker/login-action@v3.3.0 with: username: ${{ secrets.ACR_USERNAME }} @@ -28,15 +28,15 @@ jobs: echo "::set-output name=version::${version}" shell: pwsh id: getversion - - name: Push to GitHub Packages - Nightly - if: ${{ github.ref == 'refs/heads/vnext' }} - uses: docker/build-push-action@v6.9.0 + - name: Push to registry - Nightly + if: ${{ github.ref == 'refs/heads/dev' }} + uses: docker/build-push-action@v6.10.0 with: push: true tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly - - name: Push to GitHub Packages - Release - if: ${{ github.ref == 'refs/heads/master' }} - uses: docker/build-push-action@v6.9.0 + - name: Push to registry - Release + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/support/v1' }} + uses: docker/build-push-action@v6.10.0 with: push: true tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }} From a3c6c8330f26db5a181f17024a2b9e20ca8529f2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 12:12:27 -0500 Subject: [PATCH 2/4] fix: removes extraneous download artifact task Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index e9aa773a3..2303ea0a0 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -227,10 +227,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download hidi executable from artifacts - inputs: - source: current - pwsh: | $artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" From 662e9d7405b1d75099348a28e4884c08dc4da7ad Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 13:02:08 -0500 Subject: [PATCH 3/4] fix: hidi GH release Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 2303ea0a0..922fde421 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -45,8 +45,8 @@ extends: targetPath: '$(Build.ArtifactStagingDirectory)/Nugets' - output: pipelineArtifact displayName: 'Publish Artifact: Hidi' - artifactName: Microsoft.OpenApi.Hidi-v$(hidiversion) - targetPath: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)' + artifactName: Hidi + targetPath: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi' steps: - task: UseDotNet@2 displayName: 'Use .NET 6' @@ -179,23 +179,13 @@ extends: MaxConcurrency: '50' MaxRetryAttempts: '5' PendingAnalysisWaitTimeoutMinutes: '5' - - - task: PowerShell@2 - displayName: "Get Hidi's version-number from .csproj" - inputs: - targetType: 'inline' - script: | - $xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj) - $version = $xml.Project.PropertyGroup.Version - echo $version - echo "##vso[task.setvariable variable=hidiversion]$version" - + # publish hidi as an .exe - task: DotNetCoreCLI@2 displayName: publish Hidi as executable inputs: command: 'publish' - arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion) + arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj' publishWebProjects: False zipAfterPublish: false @@ -219,6 +209,9 @@ extends: - input: pipelineArtifact artifactName: Nugets targetPath: '$(Pipeline.Workspace)' + - input: pipelineArtifact + artifactName: Hidi + targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: From 1ae06b1ed1d1870236f24e7894dc46af25cf8c90 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 13:39:59 -0500 Subject: [PATCH 4/4] fix: redundant artifact upload Signed-off-by: Vincent Biret --- .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 922fde421..449142a91 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -43,10 +43,6 @@ extends: displayName: 'Publish Artifact: Nugets' artifactName: Nugets targetPath: '$(Build.ArtifactStagingDirectory)/Nugets' - - output: pipelineArtifact - displayName: 'Publish Artifact: Hidi' - artifactName: Hidi - targetPath: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi' steps: - task: UseDotNet@2 displayName: 'Use .NET 6' @@ -209,9 +205,6 @@ extends: - input: pipelineArtifact artifactName: Nugets targetPath: '$(Pipeline.Workspace)' - - input: pipelineArtifact - artifactName: Hidi - targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: