Skip to content

Commit

Permalink
Fix #1755 - Fix SpellSheck runner and warning in script files
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Zanini <[email protected]>
  • Loading branch information
ricardozanini committed Apr 10, 2024
1 parent e93091b commit cd4b14e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 18 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/kogito-images-pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install xmllint
run: |
sudo apt-get update
sudo apt-get install libxml2-utils --fix-missing
sudo apt-get update &&\
sudo apt-get -y install --no-install-recommends --fix-missing \
libxml2-utils
- name: Cache bats binaries
uses: actions/cache@v1
with:
Expand All @@ -25,22 +26,22 @@ jobs:
- name: run bats
run: |
./scripts/run-bats.sh
validate_kogito_imagestream:
concurrency:
group: ${{ github.repository.name }}_validate_kogito_imagestream-${{ github.head_ref }}
cancel-in-progress: true
name: Validate Kogito imagestreams
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download openshift-validator-tool
run: |
wget https://github.com/jboss-container-images/jboss-kie-modules/raw/main/tools/openshift-template-validator/openshift-template-validator-linux-amd64
- name: Add execution permission to openshift-validator-tool
run: |
chmod +x openshift-template-validator-linux-amd64
mv openshift-template-validator-linux-amd64 ${HOME}
mv openshift-template-validator-linux-amd64 ${HOME}
- name: validate kogito imagestream
run: |
${HOME}/openshift-template-validator-linux-amd64 validate -f kogito-imagestream.yaml
Expand All @@ -53,11 +54,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Shellcheck
run: sudo apt install shellcheck
run: |
sudo apt-get update &&\
sudo apt-get -y install --no-install-recommends \
shellcheck
- name: Check configure scripts
run: |
# Ignore SC2034 since we have many var which are unused in the script but can be used while deployment at runtime by setting env. For eg: ${KOGITO_QUARKUS_JVM_PROPS}
# Ignore SC1090 since the source files in our case didn't need to be checked
shellcheck -e SC2034 -e SC1090 modules/**/configure modules/**/*.sh
shopt -s globstar nullglob
shellcheck -e SC2034 -e SC1090 -S warning modules/**/configure modules/**/*.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand All @@ -20,6 +20,7 @@
set -e

# imports
# shellcheck source=/dev/null
source "${KOGITO_HOME}"/launch/logging.sh

function prepareEnv() {
Expand Down
2 changes: 2 additions & 0 deletions modules/kogito-launch-scripts/added/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function prepareModule() {
# $1 - module file
# $2 - function name
function executeModule() {
# shellcheck source=/dev/null
source "$1"
if [ -n "$(type -t "$2")" ]; then
eval "$2"
Expand All @@ -93,6 +94,7 @@ function executeModule() {
# Run through the list of scripts, executing the specified function for each.
# $1 - function name
function executeModules() {
# shellcheck disable=SC2048
for module in ${CONFIGURE_SCRIPTS[*]}; do
prepareModule
executeModule "${module}" "${1}"
Expand Down
2 changes: 1 addition & 1 deletion modules/kogito-maven/common/configure
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SCRIPT_DIR=$(dirname "${0}")
mvn_install_dir="/usr/share/maven"

# Verify if mvn is installed
if [ ! -d ${mvn_install_dir} ] && ! command -v mvn &> /dev/null ;
if [ ! -d ${mvn_install_dir} ] && ! command -v mvn > /dev/null 2>&1 ;
then
echo "---> Maven not found, downloading and installing it"
tar xzf "${SOURCES_DIR}"/apache-maven-"${MAVEN_VERSION}"-bin.tar.gz -C /usr/share
Expand Down
2 changes: 1 addition & 1 deletion modules/kogito-swf/common/build/added/cleanup_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rm -rfv "${PROJECT_ARTIFACT_ID}"/*.bak
echo 'Clean Maven useless files'
find "${KOGITO_HOME}"/.m2/repository -name _remote.repositories -type f -delete
find "${KOGITO_HOME}"/.m2/repository -name _maven.repositories -type f -delete
find "${KOGITO_HOME}"/.m2/repository -name *.lastUpdated -type f -delete
find "${KOGITO_HOME}"/.m2/repository -name '*.lastUpdated' -type f -delete

# Remove files that include build timestamps to have reproducible images
find "${KOGITO_HOME}"/.m2/ -name resolver-status.properties -delete
Expand Down
3 changes: 2 additions & 1 deletion modules/kogito-swf/common/scripts/added/add-extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

set -e

script_dir_path="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
script_dir_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# extensions to be added, comma separated.
extensions="$1"
# parameter passed which will trigger or not the jvm/maven configuration.
ignore_jvm_settings=${2:-false}

# shellcheck source=/dev/null
source "${script_dir_path}"/logging.sh

if [ "${SCRIPT_DEBUG}" = "true" ] ; then
Expand Down
3 changes: 2 additions & 1 deletion modules/kogito-swf/common/scripts/added/build-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

set -e

script_dir_path="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
script_dir_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
resources_path="$1"
if [ -n "${resources_path}" ]; then
resources_path="$(realpath "${resources_path}")"
fi

# shellcheck source=/dev/null
source "${script_dir_path}"/logging.sh

if [ "${SCRIPT_DEBUG}" = "true" ] ; then
Expand Down
3 changes: 2 additions & 1 deletion modules/kogito-swf/common/scripts/added/create-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

set -e

script_dir_path="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
script_dir_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck source=/dev/null
source "${script_dir_path}"/logging.sh

if [ "${SCRIPT_DEBUG}" = "true" ] ; then
Expand Down
7 changes: 5 additions & 2 deletions modules/kogito-swf/common/scripts/added/jvm-settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@

set -e

# shellcheck source=/dev/null
source "${KOGITO_HOME}"/launch/logging.sh

log_info "--> checking if .mvn/jvm.config exists."
if [ -f ".mvn/jvm.config" ]; then
log_info "---> .mvn/jvm.config exists."
export JAVA_OPTIONS=$(cat .mvn/jvm.config)
JAVA_OPTIONS=$(cat .mvn/jvm.config)
export JAVA_OPTIONS
else
log_info "---> .mvn/jvm.config does not exists, memory will be calculated based on container limits."
fi

export MAVEN_OPTS="${JAVA_OPTIONS} $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/debug-options)"
MAVEN_OPTS="${JAVA_OPTIONS} $("${JBOSS_CONTAINER_JAVA_JVM_MODULE}"/java-default-options) $("${JBOSS_CONTAINER_JAVA_JVM_MODULE}"/debug-options)"
export MAVEN_OPTS
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

set -e

script_dir_path="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
script_dir_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck source=/dev/null
source "${script_dir_path}"/logging.sh

if [ "${SCRIPT_DEBUG}" = "true" ] ; then
Expand Down

0 comments on commit cd4b14e

Please sign in to comment.