diff --git a/build.gradle b/build.gradle index 69a6f8400fd48260a1358c9cc0964fbe8c69d81e..96782f134eae4354d93117ba0e7cb4cf0aee9c3b 100644 --- a/build.gradle +++ b/build.gradle @@ -40,15 +40,30 @@ configure(project(':orbotservice')) { } repositories { - maven { - url "https://gitlab.e.foundation/api/v4/projects/1063/packages/maven" - credentials(HttpHeaderCredentials) { - name = "Private-Token" - value = gitLabPrivateToken - // the variable resides in ~/.gradle/gradle.properties + def ciJobToken = System.getenv("CI_JOB_TOKEN") + def ciApiV4Url = System.getenv("CI_API_V4_URL") + if (ciJobToken != null) { + maven { + url "${ciApiV4Url}/projects/1063/packages/maven" + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = ciJobToken + } + authentication { + header(HttpHeaderAuthentication) + } } - authentication { - header(HttpHeaderAuthentication) + } else { + maven { + url "https://gitlab.e.foundation/api/v4/projects/1063/packages/maven" + credentials(HttpHeaderCredentials) { + name = "Private-Token" + value = gitLabPrivateToken + // the variable resides in ~/.gradle/gradle.properties + } + authentication { + header(HttpHeaderAuthentication) + } } } } diff --git a/privacymoduletor/build.gradle b/privacymoduletor/build.gradle index 28a901884b3060365bd9682dff4342f5d09e1e68..a65c71fc4e01d369fe969829797d3a6d688cefbd 100644 --- a/privacymoduletor/build.gradle +++ b/privacymoduletor/build.gradle @@ -81,15 +81,30 @@ publishing { } } repositories { - maven { - url "https://gitlab.e.foundation/api/v4/projects/1063/packages/maven" - credentials(HttpHeaderCredentials) { - name = "Private-Token" - value = gitLabPrivateToken - // the variable resides in ~/.gradle/gradle.properties + def ciJobToken = System.getenv("CI_JOB_TOKEN") + def ciApiV4Url = System.getenv("CI_API_V4_URL") + if (ciJobToken != null) { + maven { + url "${ciApiV4Url}/projects/1063/packages/maven" + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = ciJobToken + } + authentication { + header(HttpHeaderAuthentication) + } } - authentication { - header(HttpHeaderAuthentication) + } else { + maven { + url "https://gitlab.e.foundation/api/v4/projects/1063/packages/maven" + credentials(HttpHeaderCredentials) { + name = "Private-Token" + value = gitLabPrivateToken + // the variable resides in ~/.gradle/gradle.properties + } + authentication { + header(HttpHeaderAuthentication) + } } } } diff --git a/settings.gradle b/settings.gradle index e912ceb17fb9a0178861fe0d5875b91d56e5fcea..4ebab8ce2d4f2484d1a7de0b8cc9d569472c8df6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,17 +7,34 @@ dependencyResolutionManagement { maven { url 'https://jitpack.io' } mavenLocal() - maven { - url "https://gitlab.e.foundation/api/v4/groups/13662/-/packages/maven" - name "GitLab" - credentials(HttpHeaderCredentials) { - name = 'Private-Token' - value = gitLabPrivateToken + def ciJobToken = System.getenv("CI_JOB_TOKEN") + def ciApiV4Url = System.getenv("CI_API_V4_URL") + if (ciJobToken != null) { + maven { + url "${ciApiV4Url}/groups/9/-/packages/maven" + name "GitLab" + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = ciJobToken + } + authentication { + header(HttpHeaderAuthentication) + } } - authentication { - header(HttpHeaderAuthentication) + } else { + maven { + url "https://gitlab.e.foundation/api/v4/groups/9/-/packages/maven" + name "GitLab" + credentials(HttpHeaderCredentials) { + name = 'Private-Token' + value = gitLabPrivateToken + } + authentication { + header(HttpHeaderAuthentication) + } } } + } }