-
Notifications
You must be signed in to change notification settings - Fork 39
Preserve multi-word parameters. Use TEMP and JAVA_HOME. #299
base: master
Are you sure you want to change the base?
Conversation
else | ||
if [ -z "${DETECT_RELEASE_VERSION}" ]; then | ||
DETECT_RELEASE_VERSION=$(curl $DETECT_CURL_OPTS 'https://test-repo.blackducksoftware.com/artifactory/api/search/latestVersion?g=com.blackducksoftware.integration&a=hub-detect&repos=bds-integrations-release') | ||
DETECT_RELEASE_VERSION=$(curl -sSL $DETECT_CURL_OPTS 'https://test-repo.blackducksoftware.com/artifactory/api/search/latestVersion?g=com.blackducksoftware.integration&a=hub-detect&repos=bds-integrations-release') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking up the Curl man page, I think this is supposed to be -ssl not -sSL. Could you change these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each letter in the -XYZ notation is a separate option. I added the lower-case "s" to hide the progress screen and an upper-case S to show error messages such as Zscaler certificate errors.
My employer has a ticket 00085307 on specifying a space-separated value in one of the parameters,
--detect.maven.build.command="compile -s settings.xml"
The error comes from Travis with regard to submitting Sonar analysis.
The existing SonarQube server may be correct. The SONAR_HOST_URL variable had no value.
The error said, > You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator. I just reverted my attempts to work this around now that I logged in and authorized sonarcloud.io.
Follow Travis documentation implying that pull requests from forks are not to be inspected with SonarCloud. https://docs.travis-ci.com/user/sonarcloud/ Attempt to classify the secure token as belonging to a certain organization so that a pull request from my fork does not get a SonarCloud inspection.
Get rid of SonarCloud as I fail to prevent its integration failure in my pull request from a fork. https://stackoverflow.com/questions/45612758/how-do-i-get-sonarcloud-to-run-on-pull-requests-from-forks-with-travis-maven https://travis-ci.org/blackducksoftware/hub-detect/builds/413657598 Maintainers, please re-add "sonarqube" to the script command line after my requests pulls through.
Changes to the shell script right now are concerning because they aren't tied to a release and are immediately put into customer's hands. This is changing soon so we'll be able to more safely introduce changes to the shell script. This method of preserving multi-word parameters is much better than what we original did since our implementation demanded the 'rm' command be used to clean up the file we create and a customer just experienced problems with that. In the fullness of time, we should be able to merge this PR to change the shell script as soon as we can change and test it - I'm hoping for detect 4.3.0 (sometime in the early fall of 2018). |
echo "will look for snapshot: hub-detect-latest-SNAPSHOT.jar" | ||
DETECT_SOURCE="https://test-repo.blackducksoftware.com/artifactory/bds-integrations-snapshot/com/blackducksoftware/integration/hub-detect/latest-SNAPSHOT/hub-detect-latest-SNAPSHOT.jar" | ||
DETECT_DESTINATION="${DETECT_JAR_PATH}/hub-detect-latest-SNAPSHOT.jar" | ||
echo "will look for snapshot: ${DETECT_SOURCE}" >&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the edits with redirects to stderr in here are info type of messages, not errors. My opinion is that they should be sent to stdout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for stipulating that. I dropped the ball after seeing no change in production concerning the bug itself (as opposed to following the diagnostic conventions).
rm -f $DETECT_JAR_PATH/hub-detect-java.sh | ||
exit $RESULT | ||
javacmd=(java ${DETECT_JAVA_OPTS} -jar "${DETECT_DESTINATION}") | ||
type -a java || return -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 'type -a' vs just type? It feels that using the '-a' option adds more noise than is necessary and could be misleading to someone trying to troubleshoot.
I would also move the check of java to the top after the handling of JAVA_HOME.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised I did not redirect stderr to /dev/null here. The -a
option has an unfortunate double meaning in checking for all possible executable commands (not just files in PATH) and in showing them.
javacmd=(java ${DETECT_JAVA_OPTS} -jar "${DETECT_DESTINATION}") | ||
type -a java || return -1 | ||
echo "running detect: ${javacmd[*]@Q} ${loggable_script_args[*]@Q}" >&2 | ||
"${javacmd[@]}" "${script_args[@]}" || return $? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a valid condition to have special characters within these 2 variables which require the need to print them with '@q'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @Q
operator quotes array elements, according to the new "parameter transformation" man paragraph,
https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
Should the original script use “set -x”? Can’t possible check/test for everything, so using set -x can be a good catch all.
|
Any updates on this? When can this be integrated? (Asking since I've run into the same issue...) |
Did you mean |
The scripts have moved to https://github.com/synopsys-sig/synopsys-detect-scripts and changes similar to these should be made available with the release of 5.5.0 of Synopsys-Detect (https://github.com/blackducksoftware/synopsys-detect) |
Pull Request template
Link to github issue (if applicable):
Changes proposed in this pull request: