Skip to content

Commit

Permalink
Update commands to avoid calling the output as another instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
dtwaddle2-r7 committed Nov 17, 2023
1 parent 5d6d2a5 commit acc972e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ pipeline {
script {
// Note: Inspect the response for error message since curl exits with code 0
// for the "Validation failed" response with status code 422 Unprocessable Entity
sh 'cat recog-content-releases-response.json'
RELEASE_ERROR_MSG=sh( script:'\$(cat recog-content-releases-response.json | jq -r .message)', returnStdout: true)
RELEASE_ERROR_MSG=sh( script: 'cat recog-content-releases-response.json | jq -r .message', returnStdout: true).trim()
echo "[DEBUG] RELEASE_ERROR_MSG = ${RELEASE_ERROR_MSG}"
if (RELEASE_ERROR_MSG) {
if (RELEASE_ERROR_MSG != 'null') {
echo 'Failed to create release.'
sh 'cat recog-content-releases-response.json'
currentBuild.result = 'FAILURE'
Expand All @@ -98,13 +97,13 @@ pipeline {
echo "[DEBUG] processed upload_url:"
sh 'cat recog-content-releases-response.json | jq -r .upload_url | cut -f 1 -d "{"'

RELEASE_HTML_URL=sh(script: '\$(cat recog-content-releases-response.json | jq -r .html_url)', returnStdout: true).trim()
RELEASE_HTML_URL=sh(script: 'cat recog-content-releases-response.json | jq -r .html_url', returnStdout: true).trim()
echo "[*] Release v${VERSION} available at: ${RELEASE_HTML_URL}"

// Note: This returns an `upload_url` key corresponding to the endpoint for uploading release assets.
// This key is a [hypermedia resource](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia).
// All URLs are expected to be proper RFC 6570 URI templates.
UPLOAD_URL=sh(script: '\$(cat recog-content-releases-response.json | jq -r .upload_url | cut -f 1 -d "{")', returnStdout: true).trim()
UPLOAD_URL=sh(script: 'cat recog-content-releases-response.json | jq -r .upload_url | cut -f 1 -d "{"', returnStdout: true).trim()
}
}
}
Expand Down

0 comments on commit acc972e

Please sign in to comment.