Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable build scan publication for test builds #34158

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .mvn/gradle-enterprise.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
</server>
<buildScan>
<!-- adjust conditions ?
mvn gradle-enterprise:provision-access-key
mvn gradle-enterprise:provision-access-key
https://docs.gradle.com/enterprise/maven-extension/#publishing_based_on_criteria
-->
<!-- only publish test runs when failure (no option to completely avoid it)-->
<publish>#{basedir.contains('test-classes') ? 'ON_FAILURE' : 'ALWAYS'}</publish>
<!-- tag which builds are tests vs real -->
<tags>
<tag>#{basedir.contains('test-classes') ? 'TEST-BUILD' : 'MAIN-BUILD'}</tag>
</tags>
<publish>ALWAYS</publish>
<obfuscation>
<!-- Don't share ip addresses-->
<ipAddresses>#{{'0.0.0.0'}}</ipAddresses>
Expand Down
2 changes: 1 addition & 1 deletion devtools/cli/src/test/java/io/quarkus/cli/CliDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public static Result invokeValidateDryRunBuild(Path projectRoot) throws Exceptio

public static Result invokeValidateBuild(Path projectRoot) throws Exception {
Result result = execute(projectRoot, "build", "-e", "-B", "--clean",
"-Dproperty=value1", "-Dproperty2=value2");
"-Dproperty=value1", "-Dproperty2=value2", "-Dscan=false");
Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode,
"Expected OK return code. Result:\n" + result);
return result;
Expand Down
1 change: 1 addition & 0 deletions independent-projects/enforcer-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<version>${maven-invoker-plugin.version}</version>
<!-- https://maven.apache.org/plugins/maven-invoker-plugin/usage.html -->
<configuration>
<mavenOpts>-Dscan=false</mavenOpts>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why set it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some smoke tests are triggering some Maven builds which would publish some build scans.

<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<settingsFile>src/it/settings.xml</settingsFile>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ private void mavenExecPom(String dir) throws MavenInvocationException {
request.setPomFile(projectPath);

request.setGoals(Collections.singletonList("install"));
request.addArg("-Dscan=false");

Invoker invoker = new DefaultInvoker();

// This is a bit ugly, but bake in knowledge about where we are in the hierarchy to find maven
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
</execution>
</executions>
<configuration>
<mavenOpts>-Dscan=false</mavenOpts>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<cloneClean>true</cloneClean>
<preBuildHookScript>setup</preBuildHookScript>
Expand Down
1 change: 1 addition & 0 deletions integration-tests/istio/maven-invoker-way/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
</execution>
</executions>
<configuration>
<mavenOpts>-Dscan=false</mavenOpts>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<cloneClean>true</cloneClean>
<postBuildHookScript>verify</postBuildHookScript>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ private InvocationResult setup(Properties params)
getMavenPluginGroupId() + ":" + getMavenPluginArtifactId() + ":" + getMavenPluginVersion() + ":create"));
request.setProperties(params);
request.setShowErrors(true);
disableBuildScanPublication(request);

File log = new File(testDir, "build-create-" + testDir.getName() + ".log");
PrintStreamLogger logger = new PrintStreamLogger(new PrintStream(new FileOutputStream(log), false, "UTF-8"),
InvokerLogger.DEBUG);
Expand Down
1 change: 1 addition & 0 deletions integration-tests/kubernetes/maven-invoker-way/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
</execution>
</executions>
<configuration>
<mavenOpts>-Dscan=false</mavenOpts>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<cloneClean>true</cloneClean>
<postBuildHookScript>verify</postBuildHookScript>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native
invoker.goals=clean package
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true
invoker.mavenOpts=-Dscan=false
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ private void addExtension(boolean plural, String ext)
properties.setProperty("extension", ext);
}
request.setProperties(properties);
disableBuildScanPublication(request);

File log = new File(testDir, "build-add-extension-" + testDir.getName() + ".log");
PrintStreamLogger logger = new PrintStreamLogger(new PrintStream(new FileOutputStream(log), false, "UTF-8"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private InvocationResult setup(Properties params)
request.setDebug(false);
request.setShowErrors(true);
request.setProperties(params);
disableBuildScanPublication(request);
File log = new File(testDir.getParent(), "build-create-extension-" + testDir.getName() + ".log");
PrintStreamLogger logger = new PrintStreamLogger(new PrintStream(new FileOutputStream(log), false, "UTF-8"),
InvokerLogger.DEBUG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private InvocationResult setup(Properties params)
request.setDebug(false);
request.setShowErrors(true);
request.setProperties(params);
disableBuildScanPublication(request);
File log = new File(testDir, "build-create-" + testDir.getName() + ".log");
PrintStreamLogger logger = new PrintStreamLogger(new PrintStream(new FileOutputStream(log), false, "UTF-8"),
InvokerLogger.DEBUG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void testCodestartOutsideCatalog() throws Exception {
request.setGoals(List.of("install"));
request.setDebug(false);
request.setShowErrors(true);
disableBuildScanPublication(request);
File log = new File(testDir, "install-extension-" + testDir.getName() + ".log");
PrintStreamLogger logger = new PrintStreamLogger(new PrintStream(new FileOutputStream(log), false, "UTF-8"),
InvokerLogger.DEBUG);
Expand Down Expand Up @@ -194,6 +195,7 @@ private InvocationResult executeCreate(Properties params)
request.setDebug(false);
request.setShowErrors(true);
request.setProperties(params);
disableBuildScanPublication(request);

PrintStreamLogger logger = getPrintStreamLogger("create-codestart.log");
invoker.setLogger(logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ private InvocationResult setup(Properties params)
request.setDebug(false);
request.setShowErrors(true);
request.setProperties(params);
disableBuildScanPublication(request);

File log = new File(testDir, "build-create-" + testDir.getName() + ".log");
PrintStreamLogger logger = new PrintStreamLogger(new PrintStream(new FileOutputStream(log), false, "UTF-8"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private List<String> listExtensions()
request.setGoals(Collections.singletonList(
getMavenPluginGroupId() + ":" + getMavenPluginArtifactId() + ":" + getMavenPluginVersion()
+ ":list-extensions"));
disableBuildScanPublication(request);

File outputLog = new File(testDir, "output.log");
InvocationOutputHandler outputHandler = new PrintStreamHandler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private InvocationResult setup(Properties params)
request.setGoals(Collections.singletonList(
getMavenPluginGroupId() + ":" + getMavenPluginArtifactId() + ":" + getMavenPluginVersion() + ":create"));
request.setProperties(params);
disableBuildScanPublication(request);
File log = new File(testDir, "build-create-" + testDir.getName() + ".log");
final PrintStreamLogger logger = new PrintStreamLogger(new PrintStream(new FileOutputStream(log), false, "UTF-8"),
InvokerLogger.INFO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.Properties;

import org.apache.maven.shared.invoker.InvocationRequest;

import io.quarkus.devtools.project.QuarkusProjectHelper;
import io.quarkus.platform.tools.ToolsUtils;
import io.quarkus.registry.RegistryResolutionException;
Expand Down Expand Up @@ -57,4 +59,8 @@ protected String getBomArtifactId() {
protected String getBomVersion() {
return getPlatformDescriptor().getBom().getVersion();
}

protected void disableBuildScanPublication(InvocationRequest request) {
request.addArg("-Dscan=false");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public MavenProcessInvocationResult execute(List<String> goals, Map<String, Stri
envVars.forEach(request::addShellEnvironment);
request.setOutputHandler(outStreamHandler);
request.setErrorHandler(errStreamHandler);
request.addArg("-Dscan=false");
this.result = (MavenProcessInvocationResult) execute(request);
return result;
}
Expand Down