Update mend.yml #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Mend | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - site/** | |
| - examples/** | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| type: string | |
| required: true | |
| default: main | |
| workflow_call: | |
| secrets: | |
| WS_APIKEY_NGINX: | |
| required: true | |
| WS_USER_KEY: | |
| required: true | |
| inputs: | |
| product_name: | |
| type: string | |
| required: true | |
| project_name: | |
| required: true | |
| type: string | |
| concurrency: | |
| group: ${{ github.ref_name }}-mend | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| scan: | |
| name: Mend | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| # with: | |
| # ref: ${{ inputs.branch && inputs.branch || github.ref }} | |
| - name: Download agent | |
| run: curl -fsSLJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar | |
| - name: Verify JAR | |
| run: jarsigner -verify wss-unified-agent.jar | |
| - name: Scan and upload | |
| env: | |
| WS_URL: "https://f5.whitesourcesoftware.com/agent" | |
| WS_APIKEY_NGINX: ${{ secrets.WS_APIKEY_NGINX }} | |
| PRODUCT_NAME: ${{ inputs.product_name}} | |
| PROJECT_NAME: ${{ inputs.project_name}} | |
| WS_CHECKPOLICIES: true | |
| WS_FORCECHECKALLDEPENDENCIES: true | |
| WS_GENERATESCANREPORT: true | |
| WS_FORCEUPDATE: true | |
| WS_FORCEUPDATE_FAILBUILDONPOLICYVIOLATION: true | |
| WS_USER_KEY: ${{ secrets.WS_USER_KEY }} | |
| run: | | |
| if [ -z "$WS_APIKEY_NGINX" ]; then | |
| echo "Secret is empty" | |
| exit 1 | |
| else | |
| echo "Secret is available" | |
| fi | |
| if [ -z "$WS_USER_KEY" ]; then | |
| echo "User Key is empty" | |
| exit 1 | |
| else | |
| echo "User Key is available" | |
| fi | |
| java -jar wss-unified-agent.jar -noConfig true -wss.url $WS_URL -apiKey $WS_APIKEY_NGINX -userKey $WS_USER_KEY -product $PRODUCT_NAME -project $PROJECT_NAME -d ./ | |
| exit_code=$? | |
| echo -e "\nEXIT CODE is: $exit_code\n" | |
| if (( exit_code == 254 )); then | |
| exit 254 | |
| else | |
| printf "\nMend scan completed successfully. Exiting with code = 0\n" | |
| exit 0 | |
| fi | |
| # file=$(find . -type f -regex ".*/$WS_PROJECT.*scan_report\.json" | head -n 1) | |
| # echo -e "\nFound Mend scan log file - $file\n" | |
| # exit_code=$? | |