Hello,
currently we are migrating from Jenkins to Github Actions. In Jenkins we used this plugin to evaluate our policies, which unfortunately doesn’t exist for Github Actions. Therefore we are using the Rest API
But unfortunately, there is always an Internal Server Error with a different ID for every call, whenever calling the statusUrl. In the following you can see the Github Action step. Does anyone know, how to solve this error?
- name: 🛡️ Retrieve Security Scan Report
run: |
echo "Trigger SourceControl Evaluation"
postReportBody='{"stageId":"build","branchName":"develop","scanTargets":["**/target/*.jar"]}'
postReportUrl='${{ vars.NEXUS_IQ_URL }}/api/v2/evaluation/applications/${{ secrets.NEXUS_IQ_APP_ID }}/sourceControlEvaluation'
curl -u ${{ vars.NEXUS_IQ_USERNAME }}:${{ secrets.NEXUS_IQ_PASSWORD }} -X POST -H "Content-Type: application/json" -d ${postReportBody} ${postReportUrl} >> statusId.txt
statusId=$(echo "$(<statusId.txt)"| awk -F 'status/' '{print $2}' | cut -d'"' -f 1)
getStatusUrl="${{ vars.NEXUS_IQ_URL }}/api/v2/evaluation/applications/${{ secrets.NEXUS_IQ_APP_ID }}/status/${statusId}"
status="PENDING"
while [[ ${status} == "PENDING" ]]
do
sleep 10
curl -u ${{ vars.NEXUS_IQ_USERNAME }}:${{ secrets.NEXUS_IQ_PASSWORD }} ${getStatusUrl} >> status.txt
status=$(echo "$(<status.txt)"| awk -F '"status":"' '{print $2}' | cut -d'"' -f 1)
done
echo "Policy evaluation status: $status"
echo "Retrieve Report"
getReportUrl='${{ vars.NEXUS_IQ_URL }}/api/v2/reports/applications/${{ secrets.NEXUS_IQ_APP_ID }}/history?stage=build&limit=1'
curl -u ${{ vars.NEXUS_IQ_USERNAME }}:${{ secrets.NEXUS_IQ_PASSWORD }} -X GET ${getReportUrl} >> nexus_output.txt