You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by sm...@apache.org on 2021/07/13 19:13:29 UTC

[knox] branch master updated: KNOX-2629 - Fix new shellcheck errors (#465)

This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 875da32  KNOX-2629 - Fix new shellcheck errors (#465)
875da32 is described below

commit 875da32324a4d0beb2cb24e0553c3f622acd51ea
Author: Attila Magyar <m....@gmail.com>
AuthorDate: Tue Jul 13 21:13:22 2021 +0200

    KNOX-2629 - Fix new shellcheck errors (#465)
    
    * KNOX-2629 Fix new shellcheck errors (amagyar)
    
    * see if travis invokes shellcheck via maven
    
    * changing shellcheck plugin
    
    Co-authored-by: zeroflag <am...@cloudera.com>
---
 .travis.yml                                       |  6 +--
 gateway-release-common/home/bin/knox-functions.sh |  1 +
 gateway-release-common/pom.xml                    | 47 +++++++++++-----------
 gateway-release/home/bin/gateway.sh               |  1 +
 gateway-release/pom.xml                           | 49 ++++++++++++-----------
 gateway-shell-release/pom.xml                     | 45 +++++++++++----------
 pom.xml                                           | 26 ++++++++++++
 7 files changed, 101 insertions(+), 74 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 91398c5..07d1509 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,13 +37,9 @@ services:
   - docker
 before_install:
   - lscpu
-  - sudo apt-get -y install shellcheck
   - docker pull $IMAGE
 script:
-  - $DOCKERRUN $IMAGE mvn -T.75C clean verify -U -Dsurefire.useFile=false -Djavax.net.ssl.trustStorePassword=changeit -B -V
-  - shellcheck gateway-shell-release/home/bin/*.sh
-  - shellcheck gateway-release/home/bin/*.sh
-  - shellcheck gateway-release-common/home/bin/*.sh
+  - $DOCKERRUN $IMAGE mvn -T.75C clean verify -U -Dshellcheck=true -Dsurefire.useFile=false -Djavax.net.ssl.trustStorePassword=changeit -B -V
 git:
   depth: 1000
 cache:
diff --git a/gateway-release-common/home/bin/knox-functions.sh b/gateway-release-common/home/bin/knox-functions.sh
index aee3706..3e214cb 100644
--- a/gateway-release-common/home/bin/knox-functions.sh
+++ b/gateway-release-common/home/bin/knox-functions.sh
@@ -22,6 +22,7 @@
 ############################
 
 # The app's home dir
+# shellcheck disable=SC2153
 APP_HOME_DIR=$(dirname "$APP_BIN_DIR")
 export APP_HOME_DIR
 
diff --git a/gateway-release-common/pom.xml b/gateway-release-common/pom.xml
index 8be908e..6a177d4 100644
--- a/gateway-release-common/pom.xml
+++ b/gateway-release-common/pom.xml
@@ -41,29 +41,30 @@
            </activation>
            <build>
                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>exec-maven-plugin</artifactId>
-                        <version>${exec-maven-plugin.version}</version>
-                        <executions>
-                            <execution>
-                                <id>shellcheck_verification</id>
-                                <phase>validate</phase>
-                                <goals>
-                                    <goal>exec</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                        <configuration>
-                            <executable>shellcheck</executable>
-                            <arguments>
-                                <argument>-x</argument>
-                                <!-- for any reason *.sh does not work if I run it from Maven; it's ok to do it in the command line -->
-                                <argument>${project.basedir}/home/bin/knox-functions.sh</argument>
-                                <argument>${project.basedir}/home/bin/knox-env.sh</argument>
-                            </arguments>
-                        </configuration>
-                    </plugin>
+                   <plugin>
+                       <groupId>dev.dimlight</groupId>
+                       <artifactId>shellcheck-maven-plugin</artifactId>
+                       <executions>
+                           <execution>
+                               <id>shellcheck_verification</id>
+                               <phase>validate</phase>
+                               <goals>
+                                   <goal>check</goal>
+                               </goals>
+                               <configuration>
+                                   <sourceDirs>
+                                       <sourceDir>
+                                           <directory>${project.basedir}/home/bin/</directory>
+                                           <includes>
+                                               <include>knox-functions.sh</include>
+                                               <include>knox-env.sh</include>
+                                           </includes>
+                                       </sourceDir>
+                                   </sourceDirs>
+                               </configuration>
+                           </execution>
+                       </executions>
+                   </plugin>
                </plugins>
            </build>
         </profile>
diff --git a/gateway-release/home/bin/gateway.sh b/gateway-release/home/bin/gateway.sh
index 9ed0fd4..320fa84 100755
--- a/gateway-release/home/bin/gateway.sh
+++ b/gateway-release/home/bin/gateway.sh
@@ -107,6 +107,7 @@ function main {
          fi
          checkEnv
          export TEST_APP_STATUS=true
+         # shellcheck disable=SC2119
          appStart
          ;;
       stop)   
diff --git a/gateway-release/pom.xml b/gateway-release/pom.xml
index 8218f15..7ad4df7 100644
--- a/gateway-release/pom.xml
+++ b/gateway-release/pom.xml
@@ -178,30 +178,31 @@
            </activation>
            <build>
                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>exec-maven-plugin</artifactId>
-                        <version>${exec-maven-plugin.version}</version>
-                        <executions>
-                            <execution>
-                                <id>shellcheck_verification</id>
-                                <phase>validate</phase>
-                                <goals>
-                                    <goal>exec</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                        <configuration>
-                            <executable>shellcheck</executable>
-                            <arguments>
-                                <argument>-x</argument>
-                                <!-- for any reason *.sh does not work if I run it from Maven; it's ok to do it in the command line -->
-                                <argument>${project.basedir}/home/bin/ldap.sh</argument>
-                                <argument>${project.basedir}/home/bin/gateway.sh</argument>
-                                <argument>${project.basedir}/home/bin/knoxcli.sh</argument>
-                            </arguments>
-                        </configuration>
-                    </plugin>
+                   <plugin>
+                       <groupId>dev.dimlight</groupId>
+                       <artifactId>shellcheck-maven-plugin</artifactId>
+                       <executions>
+                           <execution>
+                               <id>shellcheck_verification</id>
+                               <phase>validate</phase>
+                               <goals>
+                                   <goal>check</goal>
+                               </goals>
+                               <configuration>
+                                   <sourceDirs>
+                                       <sourceDir>
+                                           <directory>${project.basedir}/home/bin/</directory>
+                                           <includes>
+                                               <include>ldap.sh</include>
+                                               <include>gateway.sh</include>
+                                               <include>knoxcli.sh</include>
+                                           </includes>
+                                       </sourceDir>
+                                   </sourceDirs>
+                               </configuration>
+                           </execution>
+                       </executions>
+                   </plugin>
                </plugins>
            </build>
         </profile>
diff --git a/gateway-shell-release/pom.xml b/gateway-shell-release/pom.xml
index 70bff8e..af4b9fd 100644
--- a/gateway-shell-release/pom.xml
+++ b/gateway-shell-release/pom.xml
@@ -178,28 +178,29 @@
            </activation>
            <build>
                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>exec-maven-plugin</artifactId>
-                        <version>${exec-maven-plugin.version}</version>
-                        <executions>
-                            <execution>
-                                <id>shellcheck_verification</id>
-                                <phase>validate</phase>
-                                <goals>
-                                    <goal>exec</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                        <configuration>
-                            <executable>shellcheck</executable>
-                            <arguments>
-                                <argument>-x</argument>
-                                <!-- for any reason *.sh does not work if I run it from Maven; it's ok to do it in the command line -->
-                                <argument>${project.basedir}/home/bin/knoxshell.sh</argument>
-                            </arguments>
-                        </configuration>
-                    </plugin>
+                   <plugin>
+                       <groupId>dev.dimlight</groupId>
+                       <artifactId>shellcheck-maven-plugin</artifactId>
+                       <executions>
+                           <execution>
+                               <id>shellcheck_verification</id>
+                               <phase>validate</phase>
+                               <goals>
+                                   <goal>check</goal>
+                               </goals>
+                               <configuration>
+                                   <sourceDirs>
+                                       <sourceDir>
+                                           <directory>${project.basedir}/home/bin/</directory>
+                                           <includes>
+                                               <include>knoxshell.sh</include>
+                                           </includes>
+                                       </sourceDir>
+                                   </sourceDirs>
+                               </configuration>
+                           </execution>
+                       </executions>
+                   </plugin>
                </plugins>
            </build>
         </profile>
diff --git a/pom.xml b/pom.xml
index 2546c58..7fb8c80 100644
--- a/pom.xml
+++ b/pom.xml
@@ -386,6 +386,32 @@
     </profiles>
 
     <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>dev.dimlight</groupId>
+                    <artifactId>shellcheck-maven-plugin</artifactId>
+                    <version>0.3.1</version>
+                    <executions>
+                        <execution>
+                            <id>shellcheck_verification</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                            <configuration>
+                                <args>
+                                    <arg>-x</arg>
+                                    <arg>--source-path=${project.parent.basedir}/gateway-release-common/home/bin</arg>
+                                </args>
+                                <failBuildIfWarnings>true</failBuildIfWarnings>
+                                <binaryResolutionMethod>download</binaryResolutionMethod>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
         <plugins>
             <plugin>
                 <groupId>org.apache.rat</groupId>