Skip to content

Commit 4535aa3

Browse files
committed
Create jQAssistant configuration only if missing
1 parent 297bbd9 commit 4535aa3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

scripts/resetAndScan.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ echo "resetAndScan: SCRIPTS_DIR=${SCRIPTS_DIR}"
3232
# Internal constants
3333
JQASSISTANT_DIRECTORY="${TOOLS_DIRECTORY}/${JQASSISTANT_CLI_ARTIFACT}-${JQASSISTANT_CLI_VERSION}"
3434
JQASSISTANT_BIN="${JQASSISTANT_DIRECTORY}/bin"
35-
#JQASSISTANT_NEO4J_OPTIONS="-D jqassistant.store.uri=${NEO4J_BOLT_URI} -D jqassistant.store.remote.username=${NEO4J_USER} -D jqassistant.store.remote.password=${NEO4J_INITIAL_PASSWORD}"
36-
#JQASSISTANT_NEO4J_OPTIONS=-configurationLocations "${JQASSISTANT_CONFIG}/.jqassistant.yaml"
35+
JQASSISTANT_CONFIG_TEMPLATE_PATH="${SCRIPTS_DIR}/configuration/${JQASSISTANT_CONFIG_TEMPLATE}"
3736

3837
# Check if environment variable is set
3938
if [ -z "${NEO4J_INITIAL_PASSWORD}" ]; then
@@ -55,9 +54,16 @@ else
5554
echo "resetAndScan: Using jQAssistant binary directory ${JQASSISTANT_BIN}"
5655
fi
5756

58-
# Create jQAssistant configuration YAML file by copying a template for it
57+
# Create jQAssistant configuration YAML file by copying it from a corresponding template
5958
mkdir -p "./.jqassistant"
60-
cp "${SCRIPTS_DIR}/configuration/${JQASSISTANT_CONFIG_TEMPLATE}" "./.jqassistant/"
59+
60+
echo "resetAndScan: Check if ./.jqassistant/${JQASSISTANT_CONFIG_TEMPLATE} needs to be copied."
61+
if [ ! -f "./.jqassistant/${JQASSISTANT_CONFIG_TEMPLATE}" ]; then
62+
cp "${JQASSISTANT_CONFIG_TEMPLATE_PATH}" "./.jqassistant/"
63+
echo "resetAndScan: jQAssistant configuration copied from configuration template"
64+
else
65+
echo "resetAndScan: jQAssistant configuration won't be changed since it already exists."
66+
fi
6167

6268
# Use jQAssistant to scan the downloaded artifacts and write the results into the separate, local Neo4j Graph Database
6369
echo "resetAndScan: Scanning ${ARTIFACTS_DIRECTORY} with jQAssistant CLI version ${JQASSISTANT_CLI_VERSION}"

0 commit comments

Comments
 (0)