Skip to content

Commit d72fbde

Browse files
authored
Move our Libraries to only use artifact feed for packages, no Maven Central, Fixes AB#3395409 (#2830)
Received an s360 item asking our libraries to always pull packages from feeds, and not declare mavenCentral as a repository to source dependencies. The feed itself has maven as an upstream. We cannot use AndroidADAL feed as that one has some versions deleted (once a version is deleted from a feed, it cannot be restored, even if an upstream has it). Created a new feed to support this https://identitydivision.visualstudio.com/Engineering/_artifacts/feed/NewAndroid. We pull packages from this new feed, but we still publish our versions to AndroidADAL. The new feed has AndroidADAL as an upstream still, so our existing collection of artifacts is still accessible. I also took this chance to consolidate the Maven VSTS Username and Access Token fields, which are fields used to authenticate and pull artifacts from the feed. Previously, each library had their own names for these fields with an identifier based on the library in question. These PRs make it so all libraries use the same names, `ENV_VSTS_MVN_CRED_USERNAME` and `ENV_VSTS_MVN_CRED_ACCESSTOKEN`. **Validation** Weekly: https://identitydivision.visualstudio.com/Engineering/_build/results?buildId=1568877&view=results (LTW msal automation app failed because ltw branch does not have these changes, will work once this is in dev and we rebase. Consumers: https://identitydivision.visualstudio.com/Engineering/_build/results?buildId=1568839&view=results Test Library: https://identitydivision.visualstudio.com/Engineering/_build/results?buildId=1568872&view=results [AB#3395409](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3395409)
1 parent 73c232e commit d72fbde

File tree

24 files changed

+122
-131
lines changed

24 files changed

+122
-131
lines changed

LabApiUtilities/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ plugins {
1515

1616
apply from: '../versioning/version_tasks.gradle'
1717

18-
project.ext.vstsUsername = System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME") : project.findProperty("vstsUsername")
19-
project.ext.vstsPassword = System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
18+
project.ext.vstsUsername = System.getenv("ENV_VSTS_MVN_CRED_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_CRED_USERNAME") : project.findProperty("vstsUsername")
19+
project.ext.vstsMavenAccessToken = System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
2020

2121
version = getAppVersionName()
2222

@@ -117,15 +117,15 @@ publishing {
117117
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
118118
credentials {
119119
username project.ext.vstsUsername
120-
password project.ext.vstsPassword
120+
password project.ext.vstsMavenAccessToken
121121
}
122122
}
123123
maven {
124124
name "vsts-maven-android"
125125
url 'https://identitydivision.pkgs.visualstudio.com/IDDP/_packaging/Android/maven/v1'
126126
credentials {
127127
username project.vstsUsername
128-
password project.vstsPassword
128+
password project.vstsMavenAccessToken
129129
}
130130
}
131131
}

LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/authentication/LabApiAuthenticationClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class LabApiAuthenticationClient implements IAccessTokenSupplier {
5151
private final static int ATTEMPT_RETRY_WAIT = 3;
5252
private final String mLabCredential;
5353
private final String mLabCertPassword;
54-
private final String defaultScope = LabConstants.DEFAULT_LAB_SCOPE;
5554
private final String mClientId;
5655

5756
public LabApiAuthenticationClient(@NonNull final String labSecret) {
@@ -124,7 +123,7 @@ private String getAccessTokenInternal(final String customScope) throws LabApiExc
124123
if (customScope != null) {
125124
authScope = customScope;
126125
} else {
127-
authScope = defaultScope;
126+
authScope = LabConstants.DEFAULT_LAB_SCOPE;
128127
}
129128

130129
final IConfidentialAuthClient confidentialAuthClient = new Msal4jAuthClient();

azure-pipelines/continuous-delivery/common-cd.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# File: azure-pipelines/continuous-delivery/common-cd.yml
22
# Description: Assemble & publish latest keyvault, labapi, labapiutilities, testutil release to internal vsts feed
3-
# Variable: 'ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME' was defined in the Variables tab
43
# Variable: 'customVersion' overrides the version number of the published libraries
54

65
name: 0.0.$(Date:yyyyMMdd)$(Rev:.r) # $(Build.BuildNumber) = name

azure-pipelines/pull-request-validation/build-consumers.yml

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# File: azure-pipelines\pull-request-validation\build-consumers.yml
22
# Description: Test new common in ADAL / MSAL / Broker (assembleLocal and testLocalDebugUnitTest)
3-
# Variable: 'ENV_VSTS_MVN_ANDROIDADACCOUNTS_USERNAME' was defined in the Variables tab
43
# https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate
54
# Variable: 'commonBranchName' common branch to be used when running the pipeline manually
65
# Variable: 'skipConsumerValidationLabel' PR label used to skip the checks in this pipeline
@@ -36,11 +35,6 @@ resources:
3635
name: AzureAD/ad-accounts-for-android
3736
ref: dev
3837
endpoint: ANDROID_GITHUB
39-
- repository: adal
40-
type: github
41-
name: AzureAD/azure-activedirectory-library-for-android
42-
ref: dev
43-
endpoint: ANDROID_GITHUB
4438

4539
stages:
4640
- stage: getLabel
@@ -121,6 +115,10 @@ stages:
121115
git status
122116
git rev-parse HEAD
123117
workingDirectory: $(Agent.BuildDirectory)/s/common
118+
- bash: |
119+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
120+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
121+
displayName: 'Set VSTS Fields in Environment'
124122
- task: Gradle@3
125123
displayName: Assemble msal
126124
inputs:
@@ -154,6 +152,10 @@ stages:
154152
clean: true
155153
submodules: recursive
156154
persistCredentials: True
155+
- bash: |
156+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
157+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
158+
displayName: 'Set VSTS Fields in Environment'
157159
- template: ../templates/steps/automation-cert.yml
158160
- task: CmdLine@2
159161
displayName: Checkout common submodule $(commonBranch)
@@ -195,6 +197,10 @@ stages:
195197
clean: true
196198
submodules: recursive
197199
persistCredentials: True
200+
- bash: |
201+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
202+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
203+
displayName: 'Set VSTS Fields in Environment'
198204
- task: AzureKeyVault@2
199205
displayName: 'Get Key vault LabAuth'
200206
inputs:
@@ -208,11 +214,6 @@ stages:
208214
inputs:
209215
targetType: inline
210216
script: java -version
211-
- task: CmdLine@1
212-
displayName: Set MVN Access Token in Environment
213-
inputs:
214-
filename: echo
215-
arguments: '##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDADACCOUNTS_ACCESSTOKEN]$(System.AccessToken)'
216217
- task: CmdLine@1
217218
displayName: Set Office MVN Access Token in Environment
218219
inputs:
@@ -257,40 +258,3 @@ stages:
257258
testResultsFormat: 'JUnit'
258259
testResultsFiles: '**/TEST-*.xml'
259260
searchFolder: 'LinuxBroker'
260-
# adal
261-
- job: adalValidation
262-
displayName: ADAL
263-
dependsOn:
264-
- setupBranch
265-
variables:
266-
commonBranch: $[ dependencies.setupBranch.outputs['setvarStep.commonBranch'] ] # map in the variable
267-
condition: and( succeeded(), not(contains(variables['prLabels'], variables['skipConsumerValidationLabel'])) )
268-
steps:
269-
- checkout: adal
270-
displayName: Checkout adal repository
271-
clean: true
272-
submodules: recursive
273-
persistCredentials: True
274-
- task: CmdLine@2
275-
displayName: Checkout common submodule $(commonBranch)
276-
inputs:
277-
script: |
278-
git fetch
279-
git checkout $(commonBranch)
280-
git pull
281-
git status
282-
git rev-parse HEAD
283-
workingDirectory: $(Agent.BuildDirectory)/s/common
284-
- template: ../templates/steps/automation-cert.yml
285-
- task: Gradle@3
286-
displayName: Assemble adal
287-
inputs:
288-
tasks: clean adal:assembleLocal
289-
jdkArchitecture: x64
290-
jdkVersionOption: "1.17"
291-
- task: Gradle@3
292-
displayName: Run adal Unit tests
293-
inputs:
294-
tasks: adal:testLocalDebugUnitTest -Plabtest -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PlabSecret=$(LabVaultAppCert)
295-
jdkArchitecture: x64
296-
jdkVersionOption: "1.17"

azure-pipelines/pull-request-validation/common.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ jobs:
2828
submodules: recursive
2929
persistCredentials: True
3030
- template: ../templates/steps/automation-cert.yml
31-
- task: CmdLine@1
32-
displayName: Set Office MVN Access Token in Environment
33-
inputs:
34-
filename: echo
35-
arguments: '##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)'
31+
- bash: |
32+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
33+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
34+
displayName: 'Set VSTS Fields in Environment'
3635
- task: CodeQL3000Init@0
3736
- task: Gradle@3
3837
name: Gradle3
@@ -78,11 +77,10 @@ jobs:
7877
clean: true
7978
submodules: recursive
8079
persistCredentials: True
81-
- task: CmdLine@1
82-
displayName: Set Office MVN Access Token in Environment
83-
inputs:
84-
filename: echo
85-
arguments: '##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN]$(System.AccessToken)'
80+
- bash: |
81+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
82+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
83+
displayName: 'Set VSTS Fields in Environment'
8684
- task: Gradle@3
8785
displayName: Lint
8886
inputs:

azure-pipelines/templates/steps/automation-cert.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
parameters:
44
- name: envVstsMvnAt
5-
default: ENV_VSTS_MVN_ANDROIDADACCOUNTS_ACCESSTOKEN
5+
default: ENV_VSTS_MVN_CRED_ACCESSTOKEN
66

77
steps:
8-
- task: CmdLine@1
9-
displayName: Set MVN Access Token in Environment
10-
inputs:
11-
filename: echo
12-
arguments: '##vso[task.setvariable variable=${{ parameters.envVstsMvnAt }}]$(System.AccessToken)'
8+
- bash: |
9+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
10+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
11+
displayName: 'Set VSTS Fields in Environment'
1312
- task: AzureKeyVault@2
1413
displayName: 'Azure Key Vault: Download Cert for Automation'
1514
inputs:

azure-pipelines/templates/steps/continuous-delivery/assemble-publish-projversion.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
parameters:
1111
- name: project
1212
- name: envVstsMvnAt
13-
default: 'ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN'
13+
default: 'ENV_VSTS_MVN_CRED_ACCESSTOKEN'
1414
- name: variant
1515
default: ''
1616
- name: buildArguments
@@ -25,14 +25,13 @@ steps:
2525
clean: true
2626
submodules: recursive
2727
persistCredentials: True
28-
- task: CmdLine@1
29-
displayName: Set MVN Access Token in Environment
30-
inputs:
31-
filename: echo
32-
arguments: '##vso[task.setvariable variable=${{ parameters.envVstsMvnAt }}]$(System.AccessToken)'
28+
- bash: |
29+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
30+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
31+
displayName: 'Set VSTS Fields in Environment'
3332
- template: ../automation-cert.yml
3433
parameters:
35-
envVstsMvnAt: ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN
34+
envVstsMvnAt: ENV_VSTS_MVN_CRED_ACCESSTOKEN
3635
- task: Gradle@2
3736
displayName: Assemble ${{ parameters.project }} ${{ parameters.variant }}
3837
inputs:

azure-pipelines/templates/steps/spotbugs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ parameters:
1313
- name: javaVersion
1414
default: "1.17"
1515
steps:
16+
- bash: |
17+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
18+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
19+
displayName: 'Set VSTS Fields in Environment'
1620
- task: Gradle@3
1721
displayName: 'Run Spotbugs'
1822
inputs:

azure-pipelines/templates/steps/vsts-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# File: azure-pipelines\templates\steps\nightly-snapshot-releases\vsts-release.yml
22
# Description: Template to assemble and publish Snapshot/Latest versions of ${{ parameters.projectName }}
3-
# Variable: 'ENV_VSTS_MVN_ANDROIDADACCOUNTS_USERNAME' was defined in the Variables tab
43
# Variable: 'gradleTasks' list all the gradle tasks to be used.
54
# Variable: 'accessTokenName' secret used to access the private azure devops maven feed.
65
# Variable: 'runUnitTest' boolean: refers to whether the pipeline will run unit tests or not.

azure-pipelines/templates/steps/vsts-release/vsts-release-template.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
clean: true
2626
submodules: recursive
2727
persistCredentials: True
28+
- task: CmdLine@1
29+
displayName: Set MVN Username in Environment
30+
inputs:
31+
filename: echo
32+
arguments: '##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS'
2833
- task: CmdLine@1
2934
displayName: Set MVN AccessToken in Environment
3035
inputs:

0 commit comments

Comments
 (0)