Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ if [[ "${GITHUB_EVENT_NAME:-}" =~ ^pull_request ]]; then
export BRANCH_FOR_SCAN="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}"
fi

# make a usable copy of the packaged client coming from the parent image
cp /tmp/meterian-cli-www.jar /tmp/packaged-meterian-cli.jar
chown meterian:meterian /tmp/packaged-meterian-cli.jar

set +e
# launch meterian client with the newly created user
if [[ "$METERIAN_CLI_ARGS" =~ --debug ]]; then
Expand Down
22 changes: 21 additions & 1 deletion meterian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ goVersionControlCustomConfig() {
}
goVersionControlCustomConfig

isClientFunctioning() {
METERIAN_JAR="$1"
java -jar ${METERIAN_JAR} --version >> /dev/null 2>&1
if [[ "$?" != "0" ]];then
echo "true"
else
echo "false"
fi
}

updateClient() {
METERIAN_JAR_PATH=$1
CLIENT_TARGET_URL=$2
Expand All @@ -76,7 +86,11 @@ updateClient() {
# curl -s -o ${METERIAN_JAR_PATH} "${CLIENT_TARGET_URL}" >/dev/null
# fi
echo "Checking client..."
curl -s -o ${METERIAN_JAR_PATH} "${CLIENT_TARGET_URL}" >/dev/null
if [[ "$METERIAN_CLI_ARGS" =~ --debug ]]; then
curl -o ${METERIAN_JAR_PATH} "${CLIENT_TARGET_URL}"
else
curl -s -o ${METERIAN_JAR_PATH} "${CLIENT_TARGET_URL}" >/dev/null
fi
}

# meterian jar location
Expand All @@ -85,6 +99,12 @@ METERIAN_JAR=/tmp/meterian-cli.jar
# update the client if necessary
updateClient "${METERIAN_JAR}" "${METERIAN_PROTO}://${METERIAN_ENV}.${METERIAN_DOMAIN}/downloads/meterian-cli.jar"

# Check that just downloaded client is usable
if [[ "$(isClientFunctioning "$METERIAN_JAR_PATH")" == "true" ]];then
echo "Client update failed, will use packaged client"
cp /tmp/packaged-meterian-cli.jar $METERIAN_JAR
fi

# provide SCM info overrides through GH action env vars
METERIAN_CLI_ARGS="--project-url=${GITHUB_SERVER_URL:-}/${GITHUB_REPOSITORY:-} --project-branch=${BRANCH_FOR_SCAN:-} --project-commit=${GITHUB_SHA:-} $METERIAN_CLI_ARGS"

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.16
1.0.17