|
46 | 46 | docker run -d --name "${{env.CONTAINER_NAME}}" $CONTAINER_IMAGE sleep infinity
|
47 | 47 | #docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "git clone ${{secrets.CI_UTILS_REPO}} ."
|
48 | 48 | docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "echo 'Running commands inside the container'"
|
| 49 | + |
| 50 | + - name: Escape pull request title |
| 51 | + run: | |
| 52 | + import json |
| 53 | + import os |
| 54 | + import shlex |
| 55 | + with open('${{ github.event_path }}') as fh: |
| 56 | + event = json.load(fh) |
| 57 | + escaped = event['pull_request']['title'] |
| 58 | + with open(os.environ['GITHUB_ENV'], 'a') as fh: |
| 59 | + print(f'PR_TITLE={escaped}', file=fh) |
| 60 | + shell: python3 {0} |
49 | 61 |
|
50 | 62 | - name: Run Jenkins Cancel Script
|
51 | 63 | env:
|
@@ -79,13 +91,15 @@ jobs:
|
79 | 91 | echo "github.event.pull_request.base.ref is: ${{github.event.pull_request.base.ref}}"
|
80 | 92 | echo "github.event.pull_request.merge_commit_sha is: ${{github.event.pull_request.merge_commit_sha}}"
|
81 | 93 | echo "github.event.pull_request is: ${{github.event.pull_request}}"
|
82 |
| - |
83 |
| - |
| 94 | + |
84 | 95 | - name: Trigger Jenkins Pipeline
|
85 | 96 | if: steps.check_changes.outcome != 'failure'
|
86 | 97 | run: |
|
87 | 98 | echo "--Running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url"
|
88 |
| - docker exec -e JENKINS_URL=${{secrets.CI_JENKINS_URL}} -e GITHUB_PAT=${{secrets.CI_GITHUB_TOKEN}} "${{env.CONTAINER_NAME}}" /bin/bash -c "python3 jenkins_api.py -s \"${JENKINS_URL}\" -jn \"${pipeline_name}\" -ghr \"${GITHUB_REPOSITORY}\" -ghsha \"${input_sha}\" -ghprn \"${input_pr_num}\" -ghpru \"${input_pr_url}\" -ghprt '${input_pr_title}' -ghpat=\"${svc_acc_org_secret}\"" |
| 99 | + docker exec -e GITHUB_REPOSITORY="$GITHUB_REPOSITORY" -e svc_acc_org_secret="$svc_acc_org_secret" -e input_sha="$input_sha" -e input_pr_url="$input_pr_url" -e pipeline_name="$pipeline_name" \ |
| 100 | + -e input_pr_num="$input_pr_num" -e PR_TITLE="$PR_TITLE" -e JENKINS_URL="$JENKINS_URL" -e GITHUB_PAT="$svc_acc_org_secret" "${{env.CONTAINER_NAME}}" \ |
| 101 | + /bin/bash -c 'echo \"PR NUM: "$input_pr_num"\" && python3 jenkins_api.py -s \"${JENKINS_URL}\" -jn "$pipeline_name" -ghr "$GITHUB_REPOSITORY" -ghsha "$input_sha" -ghprn "$input_pr_num" -ghpru "$input_pr_url" -ghprt "$PR_TITLE" -ghpat="$svc_acc_org_secret"' |
| 102 | + |
89 | 103 | - name: Stop and remove container
|
90 | 104 | if: always()
|
91 | 105 | run: |
|
|
0 commit comments