Gábor Török
05/22/2024, 4:53 PMgradle.wrapperPassword
and gradle.wrapperUser
system properties to authenticate the download, and the secret is available in the secret store for our internal builds. now the problem is that how to do that without going through all our build scripts/build configurations in GHA and Jenkins.
the simplest way would be to just edit the gradlew
scripts to fetch the secret and store in the environment variable, but that seems to go against best practices? i could also just build our own gradle-wrapper.jar
, so it's able to fetch the necessary secrets for the authenticated download, but that seems to be an overkill too...
so what IS the best practice for this kind of problem? is there a way to extend the wrapper scripts in a way that's more idiomatic to gradle?Vampire
05/22/2024, 5:29 PMGábor Török
05/22/2024, 5:55 PM$GRADLE_HOME/gradle.properties
, they just have to do it once every now and then, which is not that painful. i guess i am more concerned about the code duplication for all our build configs.
for modifying gradlew
- i can just add a check that would only fetch the secret in CI - IF there is a way to customize it, i am a bit wary of just editing the generated file.Chris Lee
05/22/2024, 6:06 PMVampire
05/22/2024, 6:10 PMGábor Török
05/22/2024, 7:10 PMwrapper {
def newScript = """\
#!/bin/sh
# custom script to fetch credentials
fetch_credentials.sh
""".stripIndent()
doLast {
scriptFile.text = scriptFile.text.replace("#!/bin/sh", newScript)
}
}
is there a better way to do this that i am missing? what are the potential pitfalls with this solution?Vampire
05/22/2024, 7:48 PMGábor Török
05/23/2024, 3:08 PMCI
environmental variable is true
• and we are okay with it only running when we are explicitly calling the gradlew
script - otherwise we expect the credentials to be there already (like with an IDE)
so given the above two preconditions, hacking the gradlew
script like this is a reasonable solution? :)Vampire
05/23/2024, 3:21 PMJAVA_HOME
to JAVA17_HOME
as we are not yet on JVM toolchains for the main build and that way are able to build different branches with different Java versions.Niels Doucet
05/24/2024, 7:32 AMVampire
05/24/2024, 7:39 AM-P
parameters with the CI server knowing the secrets and making sure they do not land in any log or similar.