From 2b197f2f6c027f490cd054e2f89b201a3b3fc862 Mon Sep 17 00:00:00 2001 From: Saad BENBOUZID Date: Fri, 13 Jan 2023 21:42:47 -0500 Subject: [PATCH] #18 : Overriding ability to change the mvn repository url to download jar from --- README.md | 12 ++++++++++++ entrypoint.sh | 12 ++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 380b39d..1af1157 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,16 @@ Veracode recommends that you use the toplevel parameter if you want to ensure th **Optional** BOOLEAN - Set to true to show detailed diagnostic information, which you can use for debugging, in the output. +## Environment variables + +### Optional envvars + +### `MVN_REPO_URL` + +**Optional** STRING - Set to use an alternative maven repository. + +If `MVN_REPO_URL` is set then the jar wrapper is downloaded from this url. Otherwise, the default central will be used (`https://repo1.maven.apache.org/maven2`). + ## Examples ### General Usage @@ -137,6 +147,8 @@ jobs: - name: Veracode Upload And Scan uses: veracode/veracode-uploadandscan-action@0.2.4 +# env: +# MVN_REPO_URL: "https://my.company.com/repository/central" with: appname: 'VeraDemo' createprofile: false diff --git a/entrypoint.sh b/entrypoint.sh index 96c786c..1181727 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -234,12 +234,16 @@ fi echo " -createprofile \"$createprofile\" \\" >> runJava.sh +if [ ! -n "$MVN_REPO_URL" ]; then + MVN_REPO_URL="https://repo1.maven.apache.org/maven2" +fi + if [ "$javawrapperversion" ] -then +then javawrapperversion=$javawrapperversion else #fetch latest wrapper version from Maven - javawrapperversion=$(curl https://repo1.maven.org/maven2/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/maven-metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1) -fi + javawrapperversion=$(curl $MVN_REPO_URL/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/maven-metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1) +fi echo "javawrapperversion: $javawrapperversion" @@ -248,7 +252,7 @@ then echo " -debug \"$debug\"" >> runJava.sh fi -curl -sS -o VeracodeJavaAPI.jar "https://repo1.maven.org/maven2/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/$javawrapperversion/vosp-api-wrappers-java-$javawrapperversion.jar" +curl -sS -o VeracodeJavaAPI.jar "$MVN_REPO_URL/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/$javawrapperversion/vosp-api-wrappers-java-$javawrapperversion.jar" chmod 777 runJava.sh cat runJava.sh ./runJava.sh