General understanding question - what are the mech...
# community-support
m
General understanding question - what are the mechanisms for injecting configuration at build time on the CI/CD server? For example, we want to ensure that every project is getting its dependencies via our Artifactory instance - I can see how we can tell the user to configure their project with artifactory plugin in build.gradle file, but it depends on them doing the right thing in every project and us trusting them to do the right thing. Is there a way to automatically inject plugins/configuration into the build project that does not depend on contents of build.gradle? Or at least a way to check that a plugin is installed/used/configured? I found the enforcer plugin, but again, without ability to apply it from outside the source code, its is not of much use, as both the enforcement rules and what they are applying to are written by same people in same place. There must be some equivalent of Maven’s settings.xml? What am i missing?
a
Unfortunately Gradle doesn't have an easy way of configuring repository mirrors. This is the issue to +1 https://github.com/gradle/gradle/issues/27808 You can inject buildscript config dynamically using init scripts though https://docs.gradle.org/current/userguide/init_scripts.html.
m
Init scripts may be the thing, need to understand how this works and what it can do. Primarily I want to start with a - loading artifactory plugin aand maybe b - loading the enforcer plugin
v
Yes, init scripts is what you need. You should be able to do any thing you will need with it. I think you could also do such a "repository mirrors" functionality. Cédric is probably just thinking it might be useful as a built-in convenience feature.
m
Yeah, the example for init script is pretty much a simple version of my use case.
👌 1
Thank you both, I now have plenty of rope…. 😉
👌 1
v
Don't hang yourself with it 🙂