Skip to content

Commit b2b91b3

Browse files
authored
Move our Libraries to only use artifact feed for packages, no Maven Central, Fixes AB#3395409 (#2413)
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: https://identitydivision.visualstudio.com/Engineering/_build/results?buildId=1568877&view=results [AB#3395409](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3395409)
1 parent 390feda commit b2b91b3

File tree

6 files changed

+37
-22
lines changed

6 files changed

+37
-22
lines changed

azure-pipelines/pull-request-validation/pr-msal.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ jobs:
4040
clean: true
4141
submodules: recursive
4242
persistCredentials: True
43+
- bash: |
44+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
45+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
46+
displayName: 'Set VSTS Fields in Environment'
4347
- template: azure-pipelines/templates/steps/automation-cert.yml@common
4448
- task: JavaToolInstaller@0
4549
displayName: Use Java 17
@@ -73,6 +77,10 @@ jobs:
7377
clean: true
7478
submodules: recursive
7579
persistCredentials: True
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'
7684
- template: azure-pipelines/templates/steps/spotbugs.yml@common
7785
parameters:
7886
project: msal
@@ -84,11 +92,10 @@ jobs:
8492
clean: true
8593
submodules: recursive
8694
persistCredentials: True
87-
- task: CmdLine@1
88-
displayName: Set Office MVN Access Token in Environment
89-
inputs:
90-
filename: echo
91-
arguments: '##vso[task.setvariable variable=ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN]$(System.AccessToken)'
95+
- bash: |
96+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_USERNAME]VSTS"
97+
echo "##vso[task.setvariable variable=ENV_VSTS_MVN_CRED_ACCESSTOKEN]$(System.AccessToken)"
98+
displayName: 'Set VSTS Fields in Environment'
9299
- task: Gradle@3
93100
displayName: Lint Local debug
94101
inputs:

build.gradle

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
// Load credentials for VSTS Maven
2-
project.ext.vstsUsername = System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") : project.findProperty("vstsUsername")
3-
project.ext.vstsPassword = System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
2+
project.ext.vstsUsername = System.getenv("ENV_VSTS_MVN_CRED_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_CRED_USERNAME") : project.findProperty("vstsUsername")
3+
project.ext.vstsMavenAccessToken = System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
44

55
buildscript {
66
apply from: rootProject.file("gradle/versions.gradle")
77

88
repositories {
9+
// If you don't have access to the package feed uncomment these repositories
10+
// mavenCentral()
911
google()
10-
mavenCentral()
12+
maven {
13+
// msazure and aria are consumed via upstream sources of the NewAndroid feed.
14+
name "vsts-maven-new-android"
15+
url "https://identitydivision.pkgs.visualstudio.com/_packaging/NewAndroid/maven/v1"
16+
credentials {
17+
username System.getenv("ENV_VSTS_MVN_CRED_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_CRED_USERNAME") : project.findProperty("vstsUsername")
18+
password System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
19+
}
20+
}
1121
}
1222

1323
dependencies {
@@ -18,20 +28,16 @@ buildscript {
1828

1929
allprojects {
2030
repositories {
31+
// If you don't have access to the package feed uncomment these repositories
32+
// mavenCentral()
2133
google()
2234
mavenLocal()
23-
mavenCentral()
24-
// Adding here because Travis cannot access AndroidADAL feed.
25-
maven {
26-
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
27-
name 'Duo-SDK-Feed'
28-
}
2935
maven {
30-
name "vsts-maven-adal-android"
31-
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
36+
name "vsts-maven-new-android"
37+
url "https://identitydivision.pkgs.visualstudio.com/_packaging/NewAndroid/maven/v1"
3238
credentials {
3339
username project.vstsUsername
34-
password project.vstsPassword
40+
password project.vstsMavenAccessToken
3541
}
3642
}
3743
}

changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ MSAL Wiki : https://github.com/AzureAD/microsoft-authentication-library-for-andr
22

33
vNext
44
----------
5+
- [MINOR] Remove MavenCentral repository from build.gradle files (#2413)
56

67
Version 8.1.1
78
----------

common

Submodule common updated 48 files

msal/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ afterEvaluate {
362362
name "vsts-maven-adal-android"
363363
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
364364
credentials {
365-
username System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") : project.findProperty("vstsUsername")
366-
password System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
365+
username System.getenv("ENV_VSTS_MVN_CRED_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_CRED_USERNAME") : project.findProperty("vstsUsername")
366+
password System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
367367
}
368368
}
369369
}

settings.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
pluginManagement {
2-
// Note: Since our plugin references the android plugin we need to include google() and mavenCentral() here.
2+
// Note: Since our plugin references the android plugin we need to include google() here.
33
repositories {
4+
// If you don't have access to the package feed uncomment these repositories
5+
// mavenCentral()
46
google()
5-
mavenCentral()
67
gradlePluginPortal()
78
}
89
}

0 commit comments

Comments
 (0)