From a4d30c122282cf6f5fc2d4fc43a8686cb20859a6 Mon Sep 17 00:00:00 2001 From: TheScarastic Date: Tue, 31 May 2022 13:54:42 +0530 Subject: [PATCH] privacymoduletor: fix ci pipeline and fix project id --- build.gradle | 31 +++++++++++++++++++++++-------- privacymoduletor/build.gradle | 31 +++++++++++++++++++++++-------- settings.gradle | 33 +++++++++++++++++++++++++-------- 3 files changed, 71 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 69a6f84..96782f1 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 28a9018..a65c71f 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 e912ceb..4ebab8c 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) + } } } + } } -- GitLab