Conversation
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
|
@adarshagrawal38 @iv1111
|
| echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV | ||
| echo "COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | ||
| echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV | ||
|
|
There was a problem hiding this comment.
Please remove Extract PR commit SHA and branch, as we can use env tag to fill values
There was a problem hiding this comment.
I agree with using step-level env: block. The only reason I used $GITHUB_ENV so the values are available to other steps without duplication just in case the job grows. That being said, I have deleted this block now and used env: .
There was a problem hiding this comment.
I also removed the BRANCH variable. It was a left over code from my previous lines. Good catch.
| echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV | ||
|
|
||
| - name: Build Jenkins Deployment URL | ||
| shell: bash |
There was a problem hiding this comment.
| shell: bash | |
| shell: bash | |
| env: | |
| PR_NUMBER: {{ github.event.pull_request.number }} | |
| COMMIT_SHA: {{ github.event.pull_request.head.sha }} |
|
|
||
| # Add encoding | ||
| PR_Q=$(printf %s "$PR_NUMBER" | jq -sRr @uri) | ||
| APP_Q=$(printf %s "$APP_LIST" | jq -sRr @uri) |
There was a problem hiding this comment.
Can we give some different name instead of PR_Q and APP_Q
| JENKINS_URL="https://sys-powercloud-team-jenkins.swg-devops.com" | ||
|
|
||
| # Default ApplicationList value | ||
| APP_LIST="rag-dev" |
There was a problem hiding this comment.
| APP_LIST="rag-dev" | |
| DEFAULT_APPLICATION="rag-dev" |
There was a problem hiding this comment.
Good catch. That came from my Jenkins configuration testing time. There is no list here.
Done
| APP_LIST="rag-dev" | ||
|
|
||
| # pass this to downstream pipeline, so that it can update the check status if needed | ||
| UPDATE_STATUS=true |
There was a problem hiding this comment.
Can we please remove UPDATE_STATUS var
| APP_Q=$(printf %s "$APP_LIST" | jq -sRr @uri) | ||
|
|
||
| # Construct Jenkins Build-with-Parameters URL | ||
| DEPLOY_URL="${JENKINS_URL}/job/${JOB_NAME}/parambuild/?CHECKOUT=${PR_Q}&ApplicationList=${APP_Q}&updateGitStatus=${UPDATE_STATUS}" |
There was a problem hiding this comment.
| DEPLOY_URL="${JENKINS_URL}/job/${JOB_NAME}/parambuild/?CHECKOUT=${PR_Q}&ApplicationList=${APP_Q}&updateGitStatus=${UPDATE_STATUS}" | |
| DEPLOY_URL="${JENKINS_URL}/job/${JOB_NAME}/parambuild/?CHECKOUT=${PR_Q}&ApplicationList=${APP_Q}&updateGitStatus=true" |
There was a problem hiding this comment.
I was using the control flag outside, just to not hide it in the long URL. But I have no issues going with your suggestion.
Updated the code with your suggestion.
|
|
||
| - name: Post GitHub Commit Status (Pending) | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} # built-in GitHub token |
There was a problem hiding this comment.
| GH_TOKEN: ${{ github.token }} # built-in GitHub token | |
| GH_TOKEN: ${{ github.token }} |
There was a problem hiding this comment.
I am assuming you want me to remove the comment here.
Done.
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
GH Action to support pr-preview status check