Hi guys,
Gradle: 6.3
gradle-enterprise-plugin: 3.2.1
I’m building a 3-stage project using TravisCI. Each stage has a --scan
option assigned which generates three reports at the end of the build. Sometimes it seems a waste of time and resource to scan the project, so what I’d like to have is a possibility to activate the Gradle scan externally by setting up a system property or environment variable e.g.:
# Build Stage
./gradlew -Dscan=$REPORT_ON task1
# Test Stage
./gradlew -Dscan=$REPORT_ON task2
# Deploy Stage
./gradlew -Dscan=$REPORT_ON task3
Please advise if there is any way to do it now?
Thanks!
You already have the possibility to control the publishing of a build scan via the --scan
cmd line option. Alternatively, you can control the publishing in your build as described here.
Hi @etiennestuder, thank you for a quick reply!
Let me rephrase this how can I enable (or disable) Gradle scan for all stages without updating TravisCI pipeline? I assume on the publishing phase all that I can do is only hide the report link, but actual scanning will be made either way. Do you see any workaround here?
Another question regarding the termsOfService
properties. The document states:
Be careful not to commit agreement to the terms of service into a project that may be built by others.
- As a repository owner which already read the terms, I’d prefer to say ‘Yes’ always when I build the project locally (hardcoded value at buildScan section)
- When the project builds on CI box I definitely need to not forget to pre-set ‘Yes’ again.
- But, I cannot keep this setting in the CVS as someone can clone and build it without giving its agreement, right?
So far, I have these lines in my build and CI=true env on my local box to live with this:
if (!System.getenv("CI").isNullOrEmpty()) {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
Would it be better to have a property to accept the terms on build-start rather than at the end?
If the build scan plugin is applied, the build data is always captured on the machine where the build is run, but not necessarily published to scans.gradle.com depending on the publishing settings. For example, if you have the plugin applied and then run a build with --no-scan
, nothing will be sent to scans.gradle.com and no link is shown on the console, neither.
Re: the TOS agreement, this is something we intend to improve in that you can agree/disagree externally, i.e. from the cmd line when running a build, or via system properties. Currently, you could do something like this:
termsOfServiceAgree = System.getenv("CI") || tosAccepted
and add tosAccepted = true
to the gradle.properties file in your Gradle home directory.
This makes things clear. Thank you @etiennestuder!