Skip to content

Commit

Permalink
updated shell commands to fix errors
Browse files Browse the repository at this point in the history
updated shell commands to fix errors
  • Loading branch information
amauch-adobe committed Nov 25, 2024
1 parent 1851649 commit da0a480
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/servicenow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ jobs:
echo "$str"
}
echo "release_title=$(sanitizeStr '${{ github.event.pull_request.title }}')" >> $GITHUB_ENV
echo "release_title=$(sanitizeStr "${{ github.event.pull_request.title }}")" >> $GITHUB_ENV
release_details=$(sanitizeStr "${{ github.event.pull_request.body }}")
release=Release_Details--"${release_details}"--Pull_Request_Number--"${{ github.event.pull_request.number }}"--Pull_Request_Created_At--"${{ github.event.pull_request.created_at }}"--Pull_Request_Merged_At--"${{ github.event.pull_request.merged_at }}"
release=Release_Details--"$release_details"--Pull_Request_Number--"${{ github.event.pull_request.number }}"--Pull_Request_Created_At--"${{ github.event.pull_request.created_at }}"--Pull_Request_Merged_At--"${{ github.event.pull_request.merged_at }}"
echo "release_summary<<RS_EOF" >> $GITHUB_ENV
echo "$release" >> $GITHUB_ENV
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
url=$DEFAULT_IMS_URL
fi
curl --request POST --silent --url "${url}" --header 'content-type: multipart/form-data' --form client_id=${client_id} --form client_secret=${client_secret} --form grant_type=authorization_code --form code=${ims_code} > response.txt
curl --request POST --silent --url "$url" --header 'content-type: multipart/form-data' --form client_id="$client_id" --form client_secret="$client_secret" --form grant_type=authorization_code --form code="$ims_code" > response.txt
if [[ -f response.txt && ! -s response.txt ]]; then
echo "CURL call failed, returned response copied to response.txt was empty."
Expand All @@ -115,7 +115,7 @@ jobs:
fi
}
ims_request ${{ secrets.IMSACCESS_CLIENT_ID }} ${{ secrets.IMSACCESS_CLIENT_SECRET_STAGE }} ${{ secrets.IMSACCESS_AUTH_CODE_STAGE }}
ims_request "${{ secrets.IMSACCESS_CLIENT_ID }}" "${{ secrets.IMSACCESS_CLIENT_SECRET_STAGE }}" "${{ secrets.IMSACCESS_AUTH_CODE_STAGE }}"
- name: Create CMR in ServiceNow
run: |
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
fi
if [ -z "$planned_end_time" ]; then
echo "Missing end time: ${planned_end_time}"
echo "Missing end time: $planned_end_time"
echo "Number of parameters: $#"
return 1
fi
Expand All @@ -165,7 +165,7 @@ jobs:
url=$DEFAULT_SERVICENOW_URL
fi
curl --request POST --silent --url "${url}" --header 'Accept: application/json' --header 'Authorization: ${access_token}' --header 'Content-Type: application/json' --header 'api_key: ${api_key}' --data '{"title": "${title}", "description": "${description}", "instanceIds": [ 537445 ], "plannedStartDate": ${planned_start_time}, "plannedEndDate": ${planned_end_time},"coordinator": "narcis@adobe.com", "executor": "mauchley@adobe.com", "customerImpact": "No Impact", "changeReason": [ "New Features", "Bug Fixes", "Enhancement", "Maintenance", "Security" ], "risk": "Straight Forward", "preProductionTestingType": [ "End-to-End", "Functional", "Integrations", "QA", "Regression", "UAT", "Unit Test" ], "backoutPlanType": "Roll back", "approvedBy": [ "osahin@adobe.com" ], "testPlan": "Test plan is documented in the PR link in the Milo repository above. See the PR'\''s merge checks to see Unit and Nala testing.", "implementationPlan": "The change will be realeased as part of the continuous deployment of Milo'\''s production branch, i.e., \"main\"", "backoutPlan": "Revert merge to the Milo production branch by creating a revert commit.", "testResults": "Changes are tested and validated successfully in staging environment. Please see the link of the PR in the description for the test results and/or the \"#nala-test-results\" slack channel."}' > response.txt
curl --request POST --silent --url "$url" --header 'Accept: application/json' --header "Authorization: $access_token" --header 'Content-Type: application/json' --header "api_key: $api_key" --data '{"title": ""$title"", "description": ""$description"", "instanceIds": [ 537445 ], "plannedStartDate": "$planned_start_time", "plannedEndDate": "$planned_end_time","coordinator": "narcis@adobe.com", "executor": "mauchley@adobe.com", "customerImpact": "No Impact", "changeReason": [ "New Features", "Bug Fixes", "Enhancement", "Maintenance", "Security" ], "risk": "Straight Forward", "preProductionTestingType": [ "End-to-End", "Functional", "Integrations", "QA", "Regression", "UAT", "Unit Test" ], "backoutPlanType": "Roll back", "approvedBy": [ "osahin@adobe.com" ], "testPlan": "Test plan is documented in the PR link in the Milo repository above. See the PR\'s merge checks to see Unit and Nala testing.", "implementationPlan": "The change will be released as part of the continuous deployment of Milo\'s production branch, i.e., \"main\"", "backoutPlan": "Revert merge to the Milo production branch by creating a revert commit.", "testResults": "Changes are tested and validated successfully in staging environment. Please see the link of the PR in the description for the test results and/or the \"#nala-test-results\" slack channel."}' > response.txt
if [[ -f response.txt && ! -s response.txt ]]; then
echo "CURL call failed, returned response copied to response.txt was empty."
Expand All @@ -180,7 +180,7 @@ jobs:
fi
}
servicenow_create_cmr ${{ secrets.IPAAS_KEY_STAGE }} $token "$release_title" "$release_summary" $start_time $end_time
servicenow_create_cmr "${{ secrets.IPAAS_KEY_STAGE }}" "$token" "$release_title" "$release_summary" "$start_time" "$end_time"
- name: Retrieve CMR ID in ServiceNow
run: |
Expand Down Expand Up @@ -209,10 +209,10 @@ jobs:
if [ -z "$url" ]; then
url=$DEFAULT_SERVICENOW_URL
url+="/${transactionId}"
url+="/$transactionId"
fi
curl --request GET --silent --url "${url}" --header 'Accept: application/json' --header 'Authorization: ${access_token}' --header 'api_key: ${api_key}' > response.txt
curl --request GET --silent --url "$url" --header 'Accept: application/json' --header "Authorization: $access_token" --header "api_key: $api_key" > response.txt
if [[ -f response.txt && ! -s response.txt ]]; then
echo "CURL call failed, returned response copied to response.txt was empty."
Expand All @@ -227,7 +227,7 @@ jobs:
fi
}
servicenow_request_cmr ${{ secrets.IPAAS_KEY_STAGE }} $token $transaction_id
servicenow_request_cmr "${{ secrets.IPAAS_KEY_STAGE }}" "$token" "$transaction_id"
- name: Set Actual Maintenance Time Windows for CMR
run: |
Expand Down Expand Up @@ -266,7 +266,7 @@ jobs:
return 1
fi
if [ -z "$cmr_id" ]; then
if [ -z "$cmrId" ]; then
echo "Missing change management request ID"
return 1
fi
Expand All @@ -275,7 +275,7 @@ jobs:
url=$DEFAULT_SERVICENOW_URL
fi
curl --request POST --silent --url "${url}" --header 'Accept: application/json' --header 'Authorization: ${access_token}' --header 'Content-Type: application/json' --header 'api_key: ${api_key}' --data '{"id": "${cmrId}", "actualStartDate": ${actualStart_time}, "actualEndDate": ${actualEnd_time}, "state": "Closed", "closeCode": "Successful", "notes": "The change request is closed as the change was released successfully"}' > response.txt
curl --request POST --silent --url "$url" --header 'Accept: application/json' --header "Authorization: $access_token" --header 'Content-Type: application/json' --header "api_key: $api_key" --data '{"id": ""$cmrId"", "actualStartDate": "$actualStart_time", "actualEndDate": "$actualEnd_time", "state": "Closed", "closeCode": "Successful", "notes": "The change request is closed as the change was released successfully"}' > response.txt
if [[ -f response.txt && ! -s response.txt ]]; then
echo "CURL call failed, returned response copied to response.txt was empty."
Expand All @@ -289,4 +289,4 @@ jobs:
fi
}
servicenow_close_cmr ${{ secrets.IPAAS_KEY_STAGE }} $token $actual_start_time $actual_end_time $cmr_id
servicenow_close_cmr "${{ secrets.IPAAS_KEY_STAGE }}" "$token" "$actual_start_time" "$actual_end_time" "$cmr_id"

0 comments on commit da0a480

Please sign in to comment.