Skip to content

Commit 61fe14f

Browse files
authored
Add token management and update workflows.
1 parent 9973ef7 commit 61fe14f

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

.github/workflows/dependency-submission.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
jobs:
88
maintenance_workflow:
99
runs-on: ubuntu-latest
10+
env:
11+
CODEARTIFACT_AUTH_TOKEN: ${{ secrets.CODEARTIFACT_AUTH_TOKEN }}
1012
steps:
1113
- name: Checkout sources
1214
uses: actions/checkout@v4.2.1
@@ -18,6 +20,7 @@ jobs:
1820
- name: Generate and submit dependency graph
1921
uses: gradle/actions/dependency-submission@v4.1.0
2022
with:
23+
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
2124
gradle-version: wrapper
2225
dependency-graph: generate-and-submit
2326
# Include only relevant configurations

gradle/utils/token-utils.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def fetchCodeArtifactToken() {
2+
String token = providers.environmentVariable("CODEARTIFACT_AUTH_TOKEN").getOrNull()
3+
if (token == null || providers.environmentVariable("CI").getOrNull() == null) {
4+
token = """aws codeartifact get-authorization-token
5+
--profile production/developer
6+
--domain getyourguide
7+
--domain-owner 130607246975
8+
--query authorizationToken
9+
--output text""".execute().onExit().get().text
10+
}
11+
if (token == null || token.isEmpty()) {
12+
throw new RuntimeException("Error getting codeartifact token. Please call `gygauth setup` in cli and try again.")
13+
}
14+
logger.info("Use codeartifact token: " + token.substring(0, 10) + "...")
15+
return token
16+
}
17+
18+
ext {
19+
fetchCodeArtifactTokenMethod = this.&fetchCodeArtifactToken
20+
}

settings.gradle.kts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
pluginManagement {
2+
repositories {
3+
apply(from = "${rootProject.projectDir}/gradle/utils/token-utils.gradle")
4+
val fetchToken = (extra["fetchCodeArtifactTokenMethod"] as groovy.lang.Closure<*>).call() as String
5+
maven {
6+
name = "codeartifact"
7+
url =
8+
uri("https://getyourguide-130607246975.d.codeartifact.eu-central-1.amazonaws.com/maven/private/")
9+
credentials {
10+
username = "aws"
11+
password = fetchToken
12+
}
13+
}
14+
}
15+
}
116

217
plugins {
3-
id 'com.getyourguide.libs.gradle.develocity.configuration' version '4.14.2'
18+
id("com.getyourguide.libs.gradle.develocity.configuration") version "4.14.2"
419
}
520

621
rootProject.name = "paparazzi"

0 commit comments

Comments
 (0)