Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
288 changes: 22 additions & 266 deletions azure-pipelines/pull-request-validation/build-consumers.yml
Original file line number Diff line number Diff line change
@@ -1,273 +1,29 @@
# File: azure-pipelines\pull-request-validation\build-consumers.yml
# Description: Test new common in ADAL / MSAL / Broker (assembleLocal and testLocalDebugUnitTest)
# Variable: 'ENV_VSTS_MVN_ANDROIDADACCOUNTS_USERNAME' was defined in the Variables tab
# https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate
# Variable: 'commonBranchName' common branch to be used when running the pipeline manually
# Variable: 'skipConsumerValidationLabel' PR label used to skip the checks in this pipeline
name: $(date:yyyyMMdd)$(rev:.r)
# Description: Run instrumented test for Common.
name: Instrumented Tests

parameters:
- name: shouldSkipLongRunningTest
displayName: Should skip long running test?
type: boolean
default: true

variables:
- name: shouldSkipLongRunningTest
${{ if parameters.shouldSkipLongRunningTest }}:
value: "-PshouldSkipLongRunningTest"
${{ else }}:
value: ""
- name: robolectricSdkVersion
value: 28
- group: AndroidAuthClientAutomationSecrets
- group: MSIDLABVARS
- group: devex-ciam-test
# Name of the git project we want to checkout.
- name: androidAPILevel
displayName: Android Api Level
default: 30

resources:
repositories:
- repository: msal
type: github
name: AzureAD/microsoft-authentication-library-for-android
ref: dev
endpoint: ANDROID_GITHUB
- repository: broker
type: github
name: AzureAD/ad-accounts-for-android
ref: dev
endpoint: ANDROID_GITHUB
- repository: adal
type: github
name: AzureAD/azure-activedirectory-library-for-android
ref: dev
endpoint: ANDROID_GITHUB
- repository: AuthClientAndroidPipelines
type: git
name: Engineering/AuthClientAndroidPipelines
ref: fadi/non-1ES-instrumented

stages:
- stage: getLabel
# Check PR Label
displayName: Check for PR Label
pool:
name: Hosted Windows 2019 with VS2019
jobs:
- template: ../templates/steps/fetch-pr-labels.yml
- stage: validateConsumers
# Validate Consumers
displayName: 'Validate'
dependsOn: getLabel
pool:
name: Hosted Windows 2019 with VS2019
variables:
prLabels: $[ stageDependencies.getLabel.getLabelsJob.outputs['fetchPrCILabel.prLabels'] ]
jobs:
# setup
- job: setupBranch
displayName: Setup branch
condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) )
steps:
- checkout: none
- task: PowerShell@2
name: setvarStep
displayName: Set var branch
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
# msal
- job: msalValidation
displayName: MSAL
dependsOn:
- setupBranch
variables:
commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable
condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) )
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
- template: ../templates/steps/automation-cert.yml
- task: Gradle@3
displayName: Run msal Unit tests
inputs:
tasks: msal:testLocalDebugUnitTest -Plabtest -PlabSecret=$(LabVaultAppCert) -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PmockApiUrl=$(MOCK_API_URL)
jdkArchitecture: x64
jdkVersionOption: "1.11"
# broker
- job: brokerValidation
displayName: Broker
cancelTimeoutInMinutes: 1
timeoutInMinutes: 120
dependsOn:
- setupBranch
variables:
commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable
condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) )
pool:
name: 1ES-AndroidPool-EOC
steps:
- checkout: broker
displayName: Checkout broker repository
clean: true
submodules: recursive
persistCredentials: True
- template: ../templates/steps/automation-cert.yml
- 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 broker
inputs:
tasks: AADAuthenticator:clean AADAuthenticator:assembleLocal --build-cache --info
publishJUnitResults: false
jdkArchitecture: x64
jdkVersionOption: "1.11"
- task: Gradle@3
displayName: Run broker Unit tests
inputs:
tasks: AADAuthenticator:localDebugAADAuthenticatorUnitTestCoverageReport --build-cache --info -Plabtest -PlabSecret=$(LabVaultAppCert) -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PpowerLiftApiKey=$(powerliftApiKey) -PcodeCoverageEnabled=true ${{variables.shouldSkipLongRunningTest}}
jdkArchitecture: x64
jdkVersionOption: "1.11"
# Linux broker
- job: linuxBrokerValidation
displayName: Linux Broker
dependsOn:
- setupBranch
variables:
- name: commonBranch
value: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable
condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) )
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: broker
displayName: Checkout broker repository
clean: true
submodules: recursive
persistCredentials: True
- task: CmdLine@1
displayName: Set MVN Access Token in Environment
inputs:
filename: echo
arguments: '##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDADACCOUNTS_ACCESSTOKEN]$(System.AccessToken)'
- task: CmdLine@1
displayName: Set Office MVN Access Token in Environment
inputs:
filename: echo
arguments: '##vso[task.setvariable variable=ENV_VSTS_MVN_OFFICE_ACCESSTOKEN]$(System.AccessToken)'
- task: Gradle@3
name: Gradle3
displayName: Assemble Linux Broker
inputs:
cwd: $(Build.SourcesDirectory)/broker-java-root
tasks: LinuxBroker:clean LinuxBroker:assemble --build-cache --info
publishJUnitResults: false
jdkArchitecture: x64
jdkVersionOption: "1.11"
- task: Bash@3
retryCountOnTaskFailure: 3
displayName: Execute tests
inputs:
workingDirectory: $(Build.SourcesDirectory)/broker-java-root
targetType: 'inline'
script: |
sudo apt-get install -y dbus-x11
sudo apt-get install -y dos2unix
dos2unix gradlew
chmod +x gradlew
export DISPLAY=:0.0
eval $(dbus-launch --sh-syntax)
sudo apt install gnome-keyring
/usr/bin/gnome-keyring-daemon --start --components=secrets
./gradlew LinuxBroker:linuxBrokerUnitTestCoverageReport -Plabtest -PlabSecret=$(LabVaultAppCert) -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PcodeCoverageEnabled=true -Psystemd_mode_enabled=false
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TEST-*.xml'
searchFolder: 'LinuxBroker'
# adal
- job: adalValidation
displayName: ADAL
dependsOn:
- setupBranch
variables:
commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable
condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) )
steps:
- checkout: adal
displayName: Checkout adal 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
- template: ../templates/steps/automation-cert.yml
- task: Gradle@3
displayName: Assemble adal
inputs:
tasks: clean adal:assembleLocal
jdkArchitecture: x64
jdkVersionOption: "1.11"
- task: Gradle@3
displayName: Run adal Unit tests
inputs:
tasks: adal:testLocalDebugUnitTest -Plabtest -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PlabSecret=$(LabVaultAppCert)
jdkArchitecture: x64
jdkVersionOption: "1.11"
- stage: 'runInstrumentedTests'
displayName: Instrumented Tests
jobs:
- template: templates/runTests/run-instrumented-tests.yml@AuthClientAndroidPipelines
parameters:
gitProject: self
projectName: common
androidAPILevel: ${{ parameters.AndroidAPILevel }}
accessTokenKey: ENV_VSTS_MVN_ANDROIDADACCOUNTS_ACCESSTOKEN
gradleOptions: -Psugar=true -PlabSecret=/data/local/tmp/LabAuth.pfx
continueOnError: True
useUbuntuLatest: True
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Description: Run instrumented test for Common.
name: Instrumented Tests

resources:
repositories:
- repository: AuthClientAndroidPipelines
type: git
name: Engineering/AuthClientAndroidPipelines
ref: fadi/monthly-discovery

stages:
- stage: 'runInstrumentedTests'
displayName: Instrumented Tests
jobs:
- template: templates/runTests/run-instrumented-tests.yml@AuthClientAndroidPipelines
parameters:
gitProject: self
projectName: common
androidAPILevel: 28
accessTokenKey: ENV_VSTS_MVN_ANDROIDADACCOUNTS_ACCESSTOKEN
gradleOptions: -Psugar=true -PlabSecret=/data/local/tmp/LabAuth.pfx
continueOnError: True
useUbuntuLatest: True
Loading