From 388bbd4250ce23e7d831a4df2fbd801431468e12 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 13:24:10 -0800 Subject: [PATCH 01/17] Update build-consumers.yml for Azure Pipelines --- .../build-consumers.yml | 59 ++++++++----------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index e6781a449a..068017e915 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -6,6 +6,9 @@ # Variable: 'skipConsumerValidationLabel' PR label used to skip the checks in this pipeline name: $(date:yyyyMMdd)$(rev:.r) +pr: +- dev + parameters: - name: shouldSkipLongRunningTest displayName: Should skip long running test? @@ -64,39 +67,23 @@ stages: displayName: Setup branch condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) steps: - - checkout: none - - task: PowerShell@2 - name: setvarStep - displayName: Set var branch + - checkout: self + - task: Gradle@3 + displayName: Assemble common inputs: - targetType: inline - script: | - $branch = switch ( '$(Build.Reason)' ) - { - PullRequest - { - '$(System.PullRequest.SourceBranch)' - } - Manual - { - '$(commonBranchName)' - } - default - { - '' - } - } - Write-Output "$branch" - echo "##vso[task.setvariable variable=commonBranch;isOutput=true]$branch" - - powershell: | - if ("$(setvarStep.commonBranch)" -eq "") { - Write-Output "commonBranchName is not set using default common" - } - else{ - Write-Output "Using common branch $(setvarStep.commonBranch) in consumers" - } - name: echovar - displayName: Echo branch name + tasks: common:clean common:assembleLocal + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" + + - task: Gradle@3 + displayName: Publish common + inputs: + tasks: common:publish -PprojVersion=0.0.$(build.buildid) + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" + # msal - job: msalValidation displayName: MSAL @@ -104,7 +91,7 @@ stages: - setupBranch variables: commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable - condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) + condition: false steps: - checkout: msal displayName: Checkout msal repository @@ -143,7 +130,7 @@ stages: - setupBranch variables: commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable - condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) + condition: false pool: name: 1ES-AndroidPool-EOC steps: @@ -184,7 +171,7 @@ stages: variables: - name: commonBranch value: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable - condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) + condition: false pool: vmImage: 'ubuntu-latest' steps: @@ -241,7 +228,7 @@ stages: - setupBranch variables: commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable - condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) + condition: false steps: - checkout: adal displayName: Checkout adal repository From 38433cb387d03fd910ee31d7bfd21c0eaf961bca Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:26:47 -0800 Subject: [PATCH 02/17] Update build-consumers.yml for Azure Pipelines --- .../build-consumers.yml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 068017e915..30fb57d5d7 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -76,6 +76,13 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" + - task: Gradle@3 + displayName: Publish common4j + inputs: + tasks: common3j:publish -PprojVersion=0.0.$(build.buildid) + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" - task: Gradle@3 displayName: Publish common inputs: @@ -83,7 +90,54 @@ stages: publishJUnitResults: false jdkArchitecture: x64 jdkVersionOption: "1.11" + - task: PowerShell@2 + inputs: + targetType: 'inline' + script: | + Param ( + [Parameter(Mandatory = $true)][String]$PackagingPAT, + [Parameter(Mandatory = $false)][String]$common4jVersion, + [Parameter(Mandatory = $false)][String]$commonVersion, + [Parameter(Mandatory = $false)][String]$PromoteToView = "Prerelease", + [Parameter(Mandatory = $false)][String]$Organization = "identitydivision", + [Parameter(Mandatory = $false)][String]$FeedName="AndroidADAL" + ) + + #request uri + $baseUri = "https://pkgs.dev.azure.com/$Organization"; + $promotePackagesApi = "_apis/packaging/feeds/$FeedName/maven/packagesbatch?api-version=7.1-preview.1" + $promotePackagesUri = "$baseUri/$promotePackagesApi" + + # Auth header + $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("token:{0}" -f $PackagingPAT))) + $authHeader = @{Authorization = ("Basic {0}" -f $base64AuthInfo)}; + + + # Request Body + $MavenPackagesBatchRequest = New-Object PSObject -Property @{ + data = @{ viewId = $PromoteToView } + operation = "promote" + packages = @( + @{ artifact = "common4j"; group = "com.microsoft.identity"; version = $common4jVersion}, + @{ artifact = "common"; group = "com.microsoft.identity"; version = $commonVersion} + ) + } + + $requestBody = $MavenPackagesBatchRequest | ConvertTo-Json + # Call ADO Rest API + try { + $Result = Invoke-RestMethod -Uri $promotePackagesUri -Method Post -ContentType "application/json" -Headers $authHeader -Body $requestBody; + } catch { + if($_.ErrorDetails.Message){ + Write-Error $_.ErrorDetails.Message + } + throw $_.Exception + } + arguments: + -PackagingPAT "$(System.AccessToken)" + -common4jVersion "0.0.$(build.buildid)" + -commonVersion "0.0.$(build.buildid)" # msal - job: msalValidation displayName: MSAL From 9cdeda6a890705844a5583bdadcb50e9d356c088 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:38:54 -0800 Subject: [PATCH 03/17] Update build-consumers.yml for Azure Pipelines --- .../build-consumers.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 30fb57d5d7..7d161c4988 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -69,20 +69,29 @@ stages: steps: - checkout: self - task: Gradle@3 - displayName: Assemble common + displayName: Assemble common4j inputs: - tasks: common:clean common:assembleLocal + tasks: common4j:clean common4j:assemble publishJUnitResults: false jdkArchitecture: x64 jdkVersionOption: "1.11" - + options: "-PprojVersion=0.0.$(build.buildid)" - task: Gradle@3 displayName: Publish common4j inputs: - tasks: common3j:publish -PprojVersion=0.0.$(build.buildid) + tasks: common4j:publish + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" + options: "-PprojVersion=0.0.$(build.buildid)" + - task: Gradle@3 + displayName: Assemble common + inputs: + tasks: common:clean common:assembleDist publishJUnitResults: false jdkArchitecture: x64 jdkVersionOption: "1.11" + options: "PdistCommon4jVersion=0.0.$(build.buildid) -PprojVersion=0.0.$(build.buildid)" - task: Gradle@3 displayName: Publish common inputs: @@ -90,6 +99,7 @@ stages: publishJUnitResults: false jdkArchitecture: x64 jdkVersionOption: "1.11" + options: "-PprojVersion=0.0.$(build.buildid)" - task: PowerShell@2 inputs: targetType: 'inline' From 7488e604aad6eb9eac659880ed607f89a6fdaa86 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:56:09 -0800 Subject: [PATCH 04/17] Update build-consumers.yml for Azure Pipelines --- .../build-consumers.yml | 46 ++++++------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 7d161c4988..a2cb72d14b 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -6,6 +6,7 @@ # Variable: 'skipConsumerValidationLabel' PR label used to skip the checks in this pipeline name: $(date:yyyyMMdd)$(rev:.r) +trigger: none pr: - dev @@ -53,9 +54,9 @@ stages: name: Hosted Windows 2019 with VS2019 jobs: - template: ../templates/steps/fetch-pr-labels.yml -- stage: validateConsumers +- stage: publishCommon # Validate Consumers - displayName: 'Validate' + displayName: 'Publish common' dependsOn: getLabel pool: name: Hosted Windows 2019 with VS2019 @@ -63,11 +64,12 @@ stages: prLabels: $[ stageDependencies.getLabel.getLabelsJob.outputs['fetchPrCILabel.prLabels'] ] jobs: # setup - - job: setupBranch - displayName: Setup branch + - job: publishcommonlibs + displayName: Publish common condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) steps: - checkout: self + - template: ../templates/steps/automation-cert.yml - task: Gradle@3 displayName: Assemble common4j inputs: @@ -148,36 +150,25 @@ stages: -PackagingPAT "$(System.AccessToken)" -common4jVersion "0.0.$(build.buildid)" -commonVersion "0.0.$(build.buildid)" - # msal + +- stage: validateMSAL + displayName: 'Validate MSAL' + dependsOn: publishCommon + jobs: - job: msalValidation displayName: MSAL - dependsOn: - - setupBranch - variables: - commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable - condition: false steps: - checkout: msal displayName: Checkout msal repository clean: true submodules: recursive persistCredentials: True - - task: CmdLine@2 - displayName: Checkout common submodule $(commonBranch) - inputs: - script: | - git fetch - git checkout $(commonBranch) - git pull - git status - git rev-parse HEAD - workingDirectory: $(Agent.BuildDirectory)/s/common - task: Gradle@3 displayName: Assemble msal inputs: jdkArchitecture: x64 jdkVersionOption: "1.11" - tasks: clean msal:assembleLocal + tasks: clean msal:assembleDist - template: ../templates/steps/automation-cert.yml - task: Gradle@3 displayName: Run msal Unit tests @@ -190,10 +181,8 @@ stages: displayName: Broker cancelTimeoutInMinutes: 1 timeoutInMinutes: 120 - dependsOn: - - setupBranch variables: - commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable + commonBranch: $[ dependencies.publishcommon.outputs['setvarStep.commonBranch'] ] # map in the variable condition: false pool: name: 1ES-AndroidPool-EOC @@ -230,11 +219,6 @@ stages: # Linux broker - job: linuxBrokerValidation displayName: Linux Broker - dependsOn: - - setupBranch - variables: - - name: commonBranch - value: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable condition: false pool: vmImage: 'ubuntu-latest' @@ -288,10 +272,6 @@ stages: # adal - job: adalValidation displayName: ADAL - dependsOn: - - setupBranch - variables: - commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable condition: false steps: - checkout: adal From 0dac74c717897e966fb5864078bd371fdbd77464 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:10:40 -0800 Subject: [PATCH 05/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index a2cb72d14b..dd215d85da 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -169,7 +169,10 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" tasks: clean msal:assembleDist - - template: ../templates/steps/automation-cert.yml + - bash: | + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME]VSTS" + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)" + displayName: 'Set Environmnet variables' - task: Gradle@3 displayName: Run msal Unit tests inputs: From 692ed04b5c4e8fb7d7e0a1f76abd9bd123eb1561 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:30:56 -0800 Subject: [PATCH 06/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index dd215d85da..f7cd07ac9a 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -7,6 +7,7 @@ name: $(date:yyyyMMdd)$(rev:.r) trigger: none + pr: - dev From fbe4dc5894826cc776a09a9d14867e6ef6148b15 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:36:22 -0800 Subject: [PATCH 07/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index f7cd07ac9a..bebd277e5f 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -70,7 +70,10 @@ stages: condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) steps: - checkout: self - - template: ../templates/steps/automation-cert.yml + - bash: | + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME]VSTS" + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)" + displayName: 'Set Environmnet variables' - task: Gradle@3 displayName: Assemble common4j inputs: From 4e6e64fe72dbc4d7f12cca7db5ec9470b5c02e69 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 17:27:00 -0800 Subject: [PATCH 08/17] Update build-consumers.yml for Azure Pipelines --- .../pull-request-validation/build-consumers.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index bebd277e5f..014d230e27 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -46,6 +46,11 @@ resources: name: AzureAD/azure-activedirectory-library-for-android ref: dev endpoint: ANDROID_GITHUB + - repository: android-complete + type: github + name: AzureAD/android-complete + ref: pedroro/update-scripts + endpoint: ANDROID_GITHUB stages: - stage: getLabel @@ -70,6 +75,7 @@ stages: condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) steps: - checkout: self + - checkout: android-complete - bash: | echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME]VSTS" echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)" @@ -90,6 +96,14 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(build.buildid)" + + - task: PowerShell@2 + inputs: + targetType: 'filePath' + filePath: 'promote-package.ps1' + arguments: "-PAT=$(System.AccessToken)" + + - task: Gradle@3 displayName: Assemble common inputs: From 039b234a13d14dc48bc7292bef6f59702c6fdebb Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 17:39:15 -0800 Subject: [PATCH 09/17] Update build-consumers.yml for Azure Pipelines --- .../pull-request-validation/build-consumers.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 014d230e27..bae2549caf 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -75,7 +75,9 @@ stages: condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) steps: - checkout: self + path: common - checkout: android-complete + path: android-complete - bash: | echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME]VSTS" echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)" @@ -88,6 +90,7 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(build.buildid)" + workingDirectory: $(Agent.BuildDirectory)/common - task: Gradle@3 displayName: Publish common4j inputs: @@ -96,13 +99,14 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(build.buildid)" + workingDirectory: $(Agent.BuildDirectory)/common - task: PowerShell@2 inputs: targetType: 'filePath' filePath: 'promote-package.ps1' - arguments: "-PAT=$(System.AccessToken)" - + arguments: "-personalAccessToken=$(System.AccessToken) -packageName=com.microsoft.identity.common4j -packageVersion=0.0.$(build.buildid)" + workingDirectory: $(Agent.BuildDirectory)/android-complete/scripts/ado - task: Gradle@3 displayName: Assemble common From 635370c528f1727ea6c5b585da22f27dcf26f9fe Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 17:46:55 -0800 Subject: [PATCH 10/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index bae2549caf..129285fe47 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -90,7 +90,7 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(build.buildid)" - workingDirectory: $(Agent.BuildDirectory)/common + workingDirectory: $(Agent.BuildDirectory)\common - task: Gradle@3 displayName: Publish common4j inputs: @@ -99,7 +99,7 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(build.buildid)" - workingDirectory: $(Agent.BuildDirectory)/common + workingDirectory: $(Agent.BuildDirectory)\common - task: PowerShell@2 inputs: From ccde0dfb3c842b2f42690f9bd5669202e880f914 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 17:53:03 -0800 Subject: [PATCH 11/17] Update build-consumers.yml for Azure Pipelines --- .../build-consumers.yml | 186 +++++++++--------- 1 file changed, 95 insertions(+), 91 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 129285fe47..4fbeae209c 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -72,106 +72,110 @@ stages: # setup - job: publishcommonlibs displayName: Publish common - condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) ) + condition: and(succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel']))) steps: - - checkout: self - path: common - - checkout: android-complete - path: android-complete - - bash: | - echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME]VSTS" - echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)" - displayName: 'Set Environmnet variables' - - task: Gradle@3 - displayName: Assemble common4j - inputs: - tasks: common4j:clean common4j:assemble - publishJUnitResults: false - jdkArchitecture: x64 - jdkVersionOption: "1.11" - options: "-PprojVersion=0.0.$(build.buildid)" - workingDirectory: $(Agent.BuildDirectory)\common - - task: Gradle@3 - displayName: Publish common4j - inputs: - tasks: common4j:publish - publishJUnitResults: false - jdkArchitecture: x64 - jdkVersionOption: "1.11" - options: "-PprojVersion=0.0.$(build.buildid)" - workingDirectory: $(Agent.BuildDirectory)\common + - checkout: self + path: common - - task: PowerShell@2 - inputs: - targetType: 'filePath' - filePath: 'promote-package.ps1' - arguments: "-personalAccessToken=$(System.AccessToken) -packageName=com.microsoft.identity.common4j -packageVersion=0.0.$(build.buildid)" - workingDirectory: $(Agent.BuildDirectory)/android-complete/scripts/ado + - checkout: android-complete + path: android-complete - - task: Gradle@3 - displayName: Assemble common - inputs: - tasks: common:clean common:assembleDist - publishJUnitResults: false - jdkArchitecture: x64 - jdkVersionOption: "1.11" - options: "PdistCommon4jVersion=0.0.$(build.buildid) -PprojVersion=0.0.$(build.buildid)" - - task: Gradle@3 - displayName: Publish common - inputs: - tasks: common:publish -PprojVersion=0.0.$(build.buildid) - publishJUnitResults: false - jdkArchitecture: x64 - jdkVersionOption: "1.11" - options: "-PprojVersion=0.0.$(build.buildid)" - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: | - Param ( - [Parameter(Mandatory = $true)][String]$PackagingPAT, - [Parameter(Mandatory = $false)][String]$common4jVersion, - [Parameter(Mandatory = $false)][String]$commonVersion, - [Parameter(Mandatory = $false)][String]$PromoteToView = "Prerelease", - [Parameter(Mandatory = $false)][String]$Organization = "identitydivision", - [Parameter(Mandatory = $false)][String]$FeedName="AndroidADAL" - ) + - script: | + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME;]VSTS" + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN;]$(System.AccessToken)" + displayName: 'Set Environment Variables' + + - task: Gradle@3 + displayName: Assemble common4j + inputs: + tasks: common4j:clean common4j:assemble + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" + options: "-PprojVersion=0.0.$(Build.BuildId)" + workingDirectory: $(Agent.SourcesDirectory)/common + + - task: Gradle@3 + displayName: Publish common4j + inputs: + tasks: common4j:publish + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" + options: "-PprojVersion=0.0.$(Build.BuildId)" + workingDirectory: $(Agent.SourcesDirectory)/common + + - task: PowerShell@2 + inputs: + targetType: 'filePath' + filePath: 'promote-package.ps1' + arguments: "-personalAccessToken=$(System.AccessToken) -packageName=com.microsoft.identity.common4j -packageVersion=0.0.$(build.buildid)" + workingDirectory: $(Agent.SourcesDirectory)/android-complete/scripts/ado + + - task: Gradle@3 + displayName: Assemble common + inputs: + tasks: common:clean common:assembleDist + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" + options: "PdistCommon4jVersion=0.0.$(build.buildid) -PprojVersion=0.0.$(build.buildid)" + - task: Gradle@3 + displayName: Publish common + inputs: + tasks: common:publish -PprojVersion=0.0.$(build.buildid) + publishJUnitResults: false + jdkArchitecture: x64 + jdkVersionOption: "1.11" + options: "-PprojVersion=0.0.$(build.buildid)" + - task: PowerShell@2 + inputs: + targetType: 'inline' + script: | + Param ( + [Parameter(Mandatory = $true)][String]$PackagingPAT, + [Parameter(Mandatory = $false)][String]$common4jVersion, + [Parameter(Mandatory = $false)][String]$commonVersion, + [Parameter(Mandatory = $false)][String]$PromoteToView = "Prerelease", + [Parameter(Mandatory = $false)][String]$Organization = "identitydivision", + [Parameter(Mandatory = $false)][String]$FeedName="AndroidADAL" + ) - #request uri - $baseUri = "https://pkgs.dev.azure.com/$Organization"; - $promotePackagesApi = "_apis/packaging/feeds/$FeedName/maven/packagesbatch?api-version=7.1-preview.1" - $promotePackagesUri = "$baseUri/$promotePackagesApi" + #request uri + $baseUri = "https://pkgs.dev.azure.com/$Organization"; + $promotePackagesApi = "_apis/packaging/feeds/$FeedName/maven/packagesbatch?api-version=7.1-preview.1" + $promotePackagesUri = "$baseUri/$promotePackagesApi" - # Auth header - $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("token:{0}" -f $PackagingPAT))) - $authHeader = @{Authorization = ("Basic {0}" -f $base64AuthInfo)}; + # Auth header + $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("token:{0}" -f $PackagingPAT))) + $authHeader = @{Authorization = ("Basic {0}" -f $base64AuthInfo)}; - # Request Body - $MavenPackagesBatchRequest = New-Object PSObject -Property @{ - data = @{ viewId = $PromoteToView } - operation = "promote" - packages = @( - @{ artifact = "common4j"; group = "com.microsoft.identity"; version = $common4jVersion}, - @{ artifact = "common"; group = "com.microsoft.identity"; version = $commonVersion} - ) - } + # Request Body + $MavenPackagesBatchRequest = New-Object PSObject -Property @{ + data = @{ viewId = $PromoteToView } + operation = "promote" + packages = @( + @{ artifact = "common4j"; group = "com.microsoft.identity"; version = $common4jVersion}, + @{ artifact = "common"; group = "com.microsoft.identity"; version = $commonVersion} + ) + } - $requestBody = $MavenPackagesBatchRequest | ConvertTo-Json + $requestBody = $MavenPackagesBatchRequest | ConvertTo-Json - # Call ADO Rest API - try { - $Result = Invoke-RestMethod -Uri $promotePackagesUri -Method Post -ContentType "application/json" -Headers $authHeader -Body $requestBody; - } catch { - if($_.ErrorDetails.Message){ - Write-Error $_.ErrorDetails.Message - } - throw $_.Exception - } - arguments: - -PackagingPAT "$(System.AccessToken)" - -common4jVersion "0.0.$(build.buildid)" - -commonVersion "0.0.$(build.buildid)" + # Call ADO Rest API + try { + $Result = Invoke-RestMethod -Uri $promotePackagesUri -Method Post -ContentType "application/json" -Headers $authHeader -Body $requestBody; + } catch { + if($_.ErrorDetails.Message){ + Write-Error $_.ErrorDetails.Message + } + throw $_.Exception + } + arguments: + -PackagingPAT "$(System.AccessToken)" + -common4jVersion "0.0.$(build.buildid)" + -commonVersion "0.0.$(build.buildid)" - stage: validateMSAL displayName: 'Validate MSAL' From 2bc9a79c86be410dd00673064c7af5107b12161a Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 17:57:13 -0800 Subject: [PATCH 12/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 4fbeae209c..5158ee2c0d 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -88,6 +88,7 @@ stages: - task: Gradle@3 displayName: Assemble common4j inputs: + gradleWrapperFile: $(Agent.SourcesDirectory)/common/gradlew tasks: common4j:clean common4j:assemble publishJUnitResults: false jdkArchitecture: x64 @@ -98,6 +99,7 @@ stages: - task: Gradle@3 displayName: Publish common4j inputs: + gradleWrapperFile: $(Agent.SourcesDirectory)/common/gradlew tasks: common4j:publish publishJUnitResults: false jdkArchitecture: x64 From 6e338967645441ceb0fce324e1fd3361960a9cc4 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 18:01:40 -0800 Subject: [PATCH 13/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 5158ee2c0d..137c15f991 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -88,7 +88,7 @@ stages: - task: Gradle@3 displayName: Assemble common4j inputs: - gradleWrapperFile: $(Agent.SourcesDirectory)/common/gradlew + gradleWrapperFile: $(Build.SourcesDirectory)/common/gradlew tasks: common4j:clean common4j:assemble publishJUnitResults: false jdkArchitecture: x64 @@ -99,7 +99,7 @@ stages: - task: Gradle@3 displayName: Publish common4j inputs: - gradleWrapperFile: $(Agent.SourcesDirectory)/common/gradlew + gradleWrapperFile: $(Build.SourcesDirectory)/common/gradlew tasks: common4j:publish publishJUnitResults: false jdkArchitecture: x64 From a829bcc4ef4def42dae34b5b05d95202b0963aa3 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 18:02:20 -0800 Subject: [PATCH 14/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 137c15f991..7f09bd6e07 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -94,7 +94,7 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(Build.BuildId)" - workingDirectory: $(Agent.SourcesDirectory)/common + workingDirectory: $(Build.SourcesDirectory)/common - task: Gradle@3 displayName: Publish common4j @@ -105,7 +105,7 @@ stages: jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(Build.BuildId)" - workingDirectory: $(Agent.SourcesDirectory)/common + workingDirectory: $(Build.SourcesDirectory)/common - task: PowerShell@2 inputs: From be418a7c60544e5dd6fc35ec9103e911d270d5e4 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:27:59 -0800 Subject: [PATCH 15/17] Update build-consumers.yml for Azure Pipelines --- .../pull-request-validation/build-consumers.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 7f09bd6e07..532d4222d7 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -88,24 +88,24 @@ stages: - task: Gradle@3 displayName: Assemble common4j inputs: - gradleWrapperFile: $(Build.SourcesDirectory)/common/gradlew + gradleWrapperFile: $(Pipeline.Workspace)/common/gradlew tasks: common4j:clean common4j:assemble publishJUnitResults: false jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(Build.BuildId)" - workingDirectory: $(Build.SourcesDirectory)/common + workingDirectory: $(Pipeline.Workspace)/common - task: Gradle@3 displayName: Publish common4j inputs: - gradleWrapperFile: $(Build.SourcesDirectory)/common/gradlew + gradleWrapperFile: $(Pipeline.Workspace)/common/gradlew tasks: common4j:publish publishJUnitResults: false jdkArchitecture: x64 jdkVersionOption: "1.11" options: "-PprojVersion=0.0.$(Build.BuildId)" - workingDirectory: $(Build.SourcesDirectory)/common + workingDirectory: $(Pipeline.Workspace)/common - task: PowerShell@2 inputs: From ea4068a3d35fc37f5789c27cad2375b288ef37ea Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:41:53 -0800 Subject: [PATCH 16/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 532d4222d7..0d54fac98a 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -84,6 +84,7 @@ stages: echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME;]VSTS" echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN;]$(System.AccessToken)" displayName: 'Set Environment Variables' + workingDirectory: $(Pipeline.Workspace)/common - task: Gradle@3 displayName: Assemble common4j From d5a6a5e2469debabe13f3c2fadf92d6a74ebf099 Mon Sep 17 00:00:00 2001 From: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:51:10 -0800 Subject: [PATCH 17/17] Update build-consumers.yml for Azure Pipelines --- azure-pipelines/pull-request-validation/build-consumers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/pull-request-validation/build-consumers.yml b/azure-pipelines/pull-request-validation/build-consumers.yml index 0d54fac98a..cf09f6f7dc 100644 --- a/azure-pipelines/pull-request-validation/build-consumers.yml +++ b/azure-pipelines/pull-request-validation/build-consumers.yml @@ -81,8 +81,8 @@ stages: path: android-complete - script: | - echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME;]VSTS" - echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN;]$(System.AccessToken)" + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME]VSTS" + echo "##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)" displayName: 'Set Environment Variables' workingDirectory: $(Pipeline.Workspace)/common