You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/11/10 15:55:30 UTC

[GitHub] [maven] MartinKanters opened a new pull request, #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

MartinKanters opened a new pull request, #869:
URL: https://github.com/apache/maven/pull/869

   After a discussion with @rmannibucau, @slawekjaranowski and @michael-o, I think this is the best solution.
   The env CI check is done in Java code, making it easy to unit test. Also, a new flag had to be added to de-activate the CI=true behavior (named `--force-interactive`). To make it consistent I created an additional flag/alias to -B (`--non-interactive`). The flags were suggested by @michael-o since it's also used in other widely used CLI tools such as SVN.
   
   Happy to hear your thoughts.
   
   --- 
   
   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed
          for the change (usually before you start working on it).  Trivial changes like typos do not
          require a JIRA issue. Your pull request should address just this issue, without
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MNG-XXX] SUMMARY`, where you replace `MNG-XXX`
          and `SUMMARY` with the appropriate JIRA issue. Best practice is to use the JIRA issue
          title in the pull request title and in the first line of the commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet merged pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #869:
URL: https://github.com/apache/maven/pull/869


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] MartinKanters commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "MartinKanters (via GitHub)" <gi...@apache.org>.
MartinKanters commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1180127108


##########
maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java:
##########
@@ -173,7 +177,17 @@ public CLIManager() {
                 .build());
         options.addOption(Option.builder(Character.toString(BATCH_MODE))
                 .longOpt("batch-mode")
-                .desc("Run in non-interactive (batch) mode (disables output color)")
+                .desc(
+                        "Run in non-interactive (batch) mode (disables output color) - alias for --non-interactive (kept for backwards compatability)")

Review Comment:
   Yeah, that's true. I copied the original description of --batch-mode, but I agree that it doesn't cover the functionally anymore. I've rewritten them.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] rmannibucau commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019463457


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   https://github.com/gradle/gradle/blob/master/build-logic/buildquality/src/test/kotlin/gradlebuild/testcleanup/TestFilesCleanupServiceTest.kt#L31
   https://github.com/gradle/gradle/blob/master/gradle/shared-with-buildSrc/mirrors.settings.gradle.kts#L46
   https://github.com/gradle/gradle/blob/master/subprojects/docs/src/snippets/buildCache/conditional-action/groovy/build.gradle#L6
   



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] michael-o commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019482470


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   Well, when I search for "CI=true" on all GH I get different results.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] michael-o commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1148871056


##########
maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java:
##########
@@ -173,7 +177,17 @@ public CLIManager() {
                 .build());
         options.addOption(Option.builder(Character.toString(BATCH_MODE))
                 .longOpt("batch-mode")
-                .desc("Run in non-interactive (batch) mode (disables output color)")
+                .desc(
+                        "Run in non-interactive (batch) mode (disables output color) - alias for --non-interactive (kept for backwards compatability)")

Review Comment:
   I think this is not just color. There more cases. Basically everything where standard streams aren't connected to a tty. Also blocking for input, like Maven release. Since one cannot cover all cases, I would remove the parentheses.



##########
maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java:
##########
@@ -38,6 +38,10 @@ public class CLIManager {
 
     public static final char BATCH_MODE = 'B';
 
+    public static final String NON_INTERACTIVE = "ni";
+
+    public static final String FORCE_INTERACTIVE = "fi";

Review Comment:
   I wonder whether such important flags should really have short options, especially `force`. Keeping `-B` as short hand is fine.



##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -444,10 +447,10 @@ private CommandLine cliMerge(CommandLine mavenConfig, CommandLine mavenCli) {
      */
     void logging(CliRequest cliRequest) {
         // LOG LEVEL
-        cliRequest.verbose = cliRequest.commandLine.hasOption(CLIManager.VERBOSE)
-                || cliRequest.commandLine.hasOption(CLIManager.DEBUG);
-        cliRequest.quiet = !cliRequest.verbose && cliRequest.commandLine.hasOption(CLIManager.QUIET);
-        cliRequest.showErrors = cliRequest.verbose || cliRequest.commandLine.hasOption(CLIManager.ERRORS);
+        CommandLine commandLine = cliRequest.commandLine;
+        cliRequest.verbose = commandLine.hasOption(CLIManager.VERBOSE) || commandLine.hasOption(CLIManager.DEBUG);

Review Comment:
   This is a nice improvement. Can we move it to a separate PR and apply it basically immediately to 3.9.x and master?



##########
maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java:
##########
@@ -173,7 +177,17 @@ public CLIManager() {
                 .build());
         options.addOption(Option.builder(Character.toString(BATCH_MODE))
                 .longOpt("batch-mode")
-                .desc("Run in non-interactive (batch) mode (disables output color)")
+                .desc(
+                        "Run in non-interactive (batch) mode (disables output color) - alias for --non-interactive (kept for backwards compatability)")
+                .build());
+        options.addOption(Option.builder(NON_INTERACTIVE)
+                .longOpt("non-interactive")
+                .desc("Run in non-interactive (batch) mode (disables output color) - alias for --batch-mode")
+                .build());
+        options.addOption(Option.builder(FORCE_INTERACTIVE)
+                .longOpt("force-interactive")
+                .desc(
+                        "Run in interactive mode - even when the environment variable CI is set to true and --non-interactive or --batch-mode are set")

Review Comment:
   Here we need to check that Jansi and friends get this flag properly since Jansi uses `isatty(2)` to test that.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] michael-o commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019443790


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   > Should not but you know, real life. So just testing `!=null && !false` is more robust as of today IMHO.
   
   I'd like to see what other tools do.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] MartinKanters commented on pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "MartinKanters (via GitHub)" <gi...@apache.org>.
MartinKanters commented on PR #869:
URL: https://github.com/apache/maven/pull/869#issuecomment-1574727489

   Thanks for merging master in and the approval @gnodet . I'm on holidays for the next couple of weeks, so feel free to merge it, if you want.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI. [maven]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on PR #869:
URL: https://github.com/apache/maven/pull/869#issuecomment-2952858008

   source branch deleted


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] MartinKanters commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "MartinKanters (via GitHub)" <gi...@apache.org>.
MartinKanters commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1180126255


##########
maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java:
##########
@@ -173,7 +177,17 @@ public CLIManager() {
                 .build());
         options.addOption(Option.builder(Character.toString(BATCH_MODE))
                 .longOpt("batch-mode")
-                .desc("Run in non-interactive (batch) mode (disables output color)")
+                .desc(
+                        "Run in non-interactive (batch) mode (disables output color) - alias for --non-interactive (kept for backwards compatability)")
+                .build());
+        options.addOption(Option.builder(NON_INTERACTIVE)
+                .longOpt("non-interactive")
+                .desc("Run in non-interactive (batch) mode (disables output color) - alias for --batch-mode")
+                .build());
+        options.addOption(Option.builder(FORCE_INTERACTIVE)
+                .longOpt("force-interactive")
+                .desc(
+                        "Run in interactive mode - even when the environment variable CI is set to true and --non-interactive or --batch-mode are set")

Review Comment:
   I'm not sure how to pass this information to Jansi. `isatty(2)` will atm just return 1/true. Also if `--batch-mode` is set. 
   Do you think a change like this should be part of this PR? 



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] MartinKanters commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "MartinKanters (via GitHub)" <gi...@apache.org>.
MartinKanters commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1180163974


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -444,10 +447,10 @@ private CommandLine cliMerge(CommandLine mavenConfig, CommandLine mavenCli) {
      */
     void logging(CliRequest cliRequest) {
         // LOG LEVEL
-        cliRequest.verbose = cliRequest.commandLine.hasOption(CLIManager.VERBOSE)
-                || cliRequest.commandLine.hasOption(CLIManager.DEBUG);
-        cliRequest.quiet = !cliRequest.verbose && cliRequest.commandLine.hasOption(CLIManager.QUIET);
-        cliRequest.showErrors = cliRequest.verbose || cliRequest.commandLine.hasOption(CLIManager.ERRORS);
+        CommandLine commandLine = cliRequest.commandLine;
+        cliRequest.verbose = commandLine.hasOption(CLIManager.VERBOSE) || commandLine.hasOption(CLIManager.DEBUG);

Review Comment:
   Hmm, I think it's a nice improvement, but since it's just formatting related, I would rather just ship it with this PR. 



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] rmannibucau commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1020018988


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   As of today all are on premise and they are less and less but a few yes. Anyway impact is low so not critical



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] rmannibucau commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019424733


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   Should not but you know, real life. So just testing `!=null && !false` is more robust as of today IMHO.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] rmannibucau commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019401966


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   `!"false".equals( ciEnv )`, value can be anything (`CI=<platform>`) so guess only testing negative case is saner on the long run



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1214326567


##########
maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java:
##########
@@ -173,7 +177,17 @@ public CLIManager() {
                 .build());
         options.addOption(Option.builder(Character.toString(BATCH_MODE))
                 .longOpt("batch-mode")
-                .desc("Run in non-interactive (batch) mode (disables output color)")
+                .desc(
+                        "Run in non-interactive (batch) mode (disables output color) - alias for --non-interactive (kept for backwards compatability)")
+                .build());
+        options.addOption(Option.builder(NON_INTERACTIVE)
+                .longOpt("non-interactive")
+                .desc("Run in non-interactive (batch) mode (disables output color) - alias for --batch-mode")
+                .build());
+        options.addOption(Option.builder(FORCE_INTERACTIVE)
+                .longOpt("force-interactive")
+                .desc(
+                        "Run in interactive mode - even when the environment variable CI is set to true and --non-interactive or --batch-mode are set")

Review Comment:
   I'm not sure the flag is relevant for jansi.  



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] rmannibucau commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019516366


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   Github sets CI to true so not sure it is a relevant result :s.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] MartinKanters commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "MartinKanters (via GitHub)" <gi...@apache.org>.
MartinKanters commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1180126561


##########
maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java:
##########
@@ -38,6 +38,10 @@ public class CLIManager {
 
     public static final char BATCH_MODE = 'B';
 
+    public static final String NON_INTERACTIVE = "ni";
+
+    public static final String FORCE_INTERACTIVE = "fi";

Review Comment:
   I agree, I've removed them



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] michael-o commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019414975


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   This is not the way the value is defined.



##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   This is not the way the variable is defined.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] michael-o commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1180344798


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -444,10 +447,10 @@ private CommandLine cliMerge(CommandLine mavenConfig, CommandLine mavenCli) {
      */
     void logging(CliRequest cliRequest) {
         // LOG LEVEL
-        cliRequest.verbose = cliRequest.commandLine.hasOption(CLIManager.VERBOSE)
-                || cliRequest.commandLine.hasOption(CLIManager.DEBUG);
-        cliRequest.quiet = !cliRequest.verbose && cliRequest.commandLine.hasOption(CLIManager.QUIET);
-        cliRequest.showErrors = cliRequest.verbose || cliRequest.commandLine.hasOption(CLIManager.ERRORS);
+        CommandLine commandLine = cliRequest.commandLine;
+        cliRequest.verbose = commandLine.hasOption(CLIManager.VERBOSE) || commandLine.hasOption(CLIManager.DEBUG);

Review Comment:
   Fine



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] slawekjaranowski commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1020113059


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1438,6 +1446,33 @@ private MavenExecutionRequest populateRequest( CliRequest cliRequest, MavenExecu
         return request;
     }
 
+    private void disableInteractiveModeIfNeeded( final CliRequest cliRequest, final MavenExecutionRequest request )
+    {
+        CommandLine commandLine = cliRequest.getCommandLine();
+        if ( commandLine.hasOption( FORCE_INTERACTIVE ) )
+        {
+            return;
+        }
+
+        boolean runningOnCI = isRunningOnCI( cliRequest.getSystemProperties() );
+        if ( runningOnCI )
+        {
+            slf4jLogger.info( "Detected a CI build, because the environment variable CI equals \"true\". "
+                + "Disable this detection by removing that variable or adding --force-interactive." );

Review Comment:
   What does mean that we detected CI builds?
   maybe, some thing like:
   
   ```
   Using non interactive build due to CI environment present.
   ```



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] MartinKanters commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
MartinKanters commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1019982363


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1593,7 +1622,10 @@ private TransferListener determineTransferListener( final boolean quiet,
                                                         final CommandLine commandLine,
                                                         final MavenExecutionRequest request )
     {
-        if ( quiet || commandLine.hasOption( CLIManager.NO_TRANSFER_PROGRESS ) )
+        String ciEnv = request.getSystemProperties().getProperty( "env.CI" );
+        boolean quietCI = "true".equals( ciEnv ) && !commandLine.hasOption( FORCE_INTERACTIVE );

Review Comment:
   Are there CI servers that are actually setting it to another value than true that you know of? 
   Anyway, it doesn't hurt I guess, I have changed it



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] MartinKanters commented on a diff in pull request #869: [MNG-7338] Automatically activate batch-mode and make output quiet when running in CI.

Posted by GitBox <gi...@apache.org>.
MartinKanters commented on code in PR #869:
URL: https://github.com/apache/maven/pull/869#discussion_r1026584591


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1438,6 +1446,33 @@ private MavenExecutionRequest populateRequest( CliRequest cliRequest, MavenExecu
         return request;
     }
 
+    private void disableInteractiveModeIfNeeded( final CliRequest cliRequest, final MavenExecutionRequest request )
+    {
+        CommandLine commandLine = cliRequest.getCommandLine();
+        if ( commandLine.hasOption( FORCE_INTERACTIVE ) )
+        {
+            return;
+        }
+
+        boolean runningOnCI = isRunningOnCI( cliRequest.getSystemProperties() );
+        if ( runningOnCI )
+        {
+            slf4jLogger.info( "Detected a CI build, because the environment variable CI equals \"true\". "
+                + "Disable this detection by removing that variable or adding --force-interactive." );

Review Comment:
   I agree! That is much clearer for the users. I will change it.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org