Hey, got a question about Gradle Enterprise. If I...
# develocity
j
Hey, got a question about Gradle Enterprise. If I wanted to tag a build failure in order to aggregate build scans using a given tag, is that something I could do from Kotlin code somehow, after catching the exception? Or tagging can only be done via gradle config file using the gradle enterprise plugin? I wonder what would be the appropriate way to do this. Thanks in advance! 🙏
d
You can do it in your build script like this: https://docs.gradle.com/enterprise/gradle-plugin/#adding_data_at_the_end_of_the_build. To add a custom tag, use the
tag()
method instead of
value()
in the example.
You can already filter by build outcome without any custom tag, so this will only be necessary if you want to tag builds with a particular type of failure.
j
Is it possible to filter by some pattern found in the build logs?
If we could do that to aggregate builds failing with a common cause (that we might be able to determine by finding some specific words in the log), that might shortcut our use case here.
Otherwise we might be able to read the build output logs somehow from the
buildFinished
to tag is only if they contain a specific pattern?
Thanks, by the way 🙂
d
No, there's no way to filter the main scans view by log message. However you might want to explore the functionality in the Failures Dashboard which provides similar functionality: https://ge.gradle.org/scans/failures?search.timeZoneId=America/Edmonton
message has been deleted
Going back to your custom tagging idea, I don't think you'll be able to access the build output from within
buildFinished
. If the information you require isn't in the failure exception, then you'd need to capture the information in a way that can be later accessed in
buildFinished
.
j
I’m not sure it is somewhere within the failing exception or not, since it fails with an “error: some error message with reason and advance”, but then it says:
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sometask'.
> Compilation failed; see the compiler error output for details.
So not sure if the error might be accessible or not
d
If you run the build with
--stacktrace
you'll see the full exception. The actual compiler error is not available though. I don't know what
error: some error message with reason and advance
is.
c
I don't remember but I think it groups failures by the same exception
And at buildFinished you only have a com.gradle.scan.plugin.BuildResult that contains the failure: Throwable
So group by exception my work for you or not, we don't know your usecase