Skip to content

Commit

Permalink
KNOX-2629 - Fix new shellcheck errors (apache#465)
Browse files Browse the repository at this point in the history
* KNOX-2629 Fix new shellcheck errors (amagyar)

* see if travis invokes shellcheck via maven

* changing shellcheck plugin

Co-authored-by: zeroflag <[email protected]>
  • Loading branch information
zeroflag and zeroflag authored Jul 13, 2021
1 parent f60601f commit 875da32
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 74 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions gateway-release-common/home/bin/knox-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
############################

# The app's home dir
# shellcheck disable=SC2153
APP_HOME_DIR=$(dirname "$APP_BIN_DIR")
export APP_HOME_DIR

Expand Down
47 changes: 24 additions & 23 deletions gateway-release-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions gateway-release/home/bin/gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function main {
fi
checkEnv
export TEST_APP_STATUS=true
# shellcheck disable=SC2119
appStart
;;
stop)
Expand Down
49 changes: 25 additions & 24 deletions gateway-release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
45 changes: 23 additions & 22 deletions gateway-shell-release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 875da32

Please sign in to comment.