c00ler commented on code in PR #1288: URL: https://github.com/apache/pekko/pull/1288#discussion_r1579417379
########## project/PekkoDevelocityPlugin.scala: ########## @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import com.gradle.develocity.agent.sbt.DevelocityPlugin +import com.gradle.develocity.agent.sbt.DevelocityPlugin.autoImport.{ + develocityConfiguration, + FlakyTestPolicy, + ProjectId, + Publishing +} +import sbt.{ url, AutoPlugin, Def, PluginTrigger, Plugins, Setting } +import sbt.Keys.insideCI + +object PekkoDevelocityPlugin extends AutoPlugin { + + private val ApacheDevelocityUrl = url("https://ge.apache.org") + private val PekkoProjectId = ProjectId("pekko") + private val ObfuscatedIPv4Address = "0.0.0.0" + + override lazy val trigger: PluginTrigger = allRequirements + override lazy val requires: Plugins = DevelocityPlugin + + override lazy val buildSettings: Seq[Setting[_]] = Def.settings( + develocityConfiguration := { + val isCI = insideCI.value + + val original = develocityConfiguration.value + val apacheDevelocityConfiguration = + original + .withProjectId(PekkoProjectId) + .withServer( + original.server + .withUrl(Some(ApacheDevelocityUrl)) + .withAllowUntrusted(false)) + .withBuildScan( + original.buildScan + .withPublishing(Publishing.onlyIf(_.authenticated)) + .withBackgroundUpload(!isCI) + .withObfuscation( + original.buildScan.obfuscation + .withIpAddresses(_.map(_ => ObfuscatedIPv4Address)))) + if (isCI) { Review Comment: Yes. There are two things in this configuration with regards local and CI runs. First is this condition `.withPublishing(Publishing.onlyIf(_.authenticated))`. It ensures that the Build Scan will not be published to ge.apache.org (this server is running on ASF infrastructure and Gradle does not have access to it) unless there is an authentication token. On CI the token is provided via the environment variable added in this PR. On CI the predicate will evaluate to `true` and the Build Scan will be published. Locally the predicate will evaluate to `false` unless the user explicitly authenticates with the Develocity instance. The standard way to authenticate is to execute `develocityProvisionAccessKey` task as described [here](https://docs.gradle.com/develocity/sbt-plugin/#authenticating). In order to be able to do so the user needs to have an account at ge.apache.org. Only Apache committers can have an account there. After that the Build Scan will be published from the local computer. To stop publishing from the local computer, users would need to delete the fil e with the access key. The second is test retries. By default test retries are disabled. Yes, locally, even if the user is authenticated, due to this condition, the retries will be disabled. It make sense to enable retries on CI, because it will allow Develocity to detect whether the test is flaky or not. This is an [example](https://ge.apache.org/scans/tests?search.rootProjectNames=kafka&search.timeZoneId=Europe%2FBerlin&tests.container=org.apache.kafka.tools.MetadataQuorumCommandTest&tests.test=testDescribeQuorumReplicationSuccessful()%5B1%5D) test result for a test in Apache Kafka project. In the Build Scan it will be possible to see whether the test was really failing or it was flaky. We choose to provide a very conservative retry configuration. Only 1 retry attempt (does not add much to the build time) and the build outcome will still be `failed`. This approach allows us to detect and surface the flakyness, but the decision, whether to proceed with the failed build or not, is still on the team. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org