-
Notifications
You must be signed in to change notification settings - Fork 135
CmampTask7965_Fix_the_triggering_of_the_release_Docker_images_workflow #1096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
806d920
ca000f5
e464fa2
e72485d
d3020f3
4e5b56f
c30ff7d
dea3d61
f402445
fa18b6f
847db00
11b8ddc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,12 +1,14 @@ | ||||||||||||||
| name: Common Dev Image Release | ||||||||||||||
| on: | ||||||||||||||
| workflow_call: | ||||||||||||||
| inputs: | ||||||||||||||
| container-dir-name: | ||||||||||||||
| description: 'Container directory name - directory where Dockerfile and changelog.txt are located.' | ||||||||||||||
| required: false | ||||||||||||||
| type: string | ||||||||||||||
| default: '.' | ||||||||||||||
| workflow_call: | ||||||||||||||
| inputs: | ||||||||||||||
| container-dir-name: | ||||||||||||||
| # Repo root or runnable dir to release the image from (must have devops/ and changelog.txt). | ||||||||||||||
| # Examples: '.' (repo root, default) or 'subdir_name' (runnable dir) | ||||||||||||||
| description: 'Container directory name - directory where Dockerfile and changelog.txt are located.' | ||||||||||||||
| required: false | ||||||||||||||
| type: string | ||||||||||||||
| default: '.' | ||||||||||||||
| env: | ||||||||||||||
| CSFY_CI: true | ||||||||||||||
| # CSFY_ECR_BASE_PATH: ${{ vars.CSFY_ECR_BASE_PATH }} | ||||||||||||||
|
|
@@ -45,7 +47,7 @@ jobs: | |||||||||||||
| # This is needed to pull the Docker image. | ||||||||||||||
| - name: Login to GHCR | ||||||||||||||
| run: | | ||||||||||||||
| echo "${{ secrets.GH_ACTION_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}" \ | ||||||||||||||
| echo "${{ secrets.GITHUB_TOKEN }}" \ | ||||||||||||||
| | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||||||||||||||
|
Comment on lines
48
to
51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also could we see how the PR would like when it's filed by the GH app as well?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch!
The question is: who is able to set up these variables and secrets in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which variables need to be set?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We need to set:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see they are already set as ORG level secrets/vars so they should already be accessible by //helpers right?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could also try to test it on //csfy too
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I tried to debug in in the ssh-session inside the GitHub workflow run, but they are empty: helpers/.github/workflows/common_dev_image_build.yml Lines 31 to 36 in 23192e7
Probably need to set permission for these variable and secret on the repo level also. @heanhsok
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They should be there now. I don't have perm to check that but I could replicate them in //helpers. |
||||||||||||||
|
|
||||||||||||||
| # Make everything accessible by any user to avoid permission errors. | ||||||||||||||
|
|
@@ -62,7 +64,7 @@ jobs: | |||||||||||||
| # make it a default behavior? For certain tests to pass, we need entire | ||||||||||||||
| # commit history of the repo including sub-modules. | ||||||||||||||
| fetch-depth: 0 | ||||||||||||||
| token: ${{ secrets.GH_ACTION_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | ||||||||||||||
| token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||
|
|
||||||||||||||
| # To access modules in `amp` and `helpers_root`, make sure PYTHONPATH includes | ||||||||||||||
| # them, just as it's set in `setenv.sh`. | ||||||||||||||
|
|
@@ -89,8 +91,8 @@ jobs: | |||||||||||||
| CSFY_AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }} | ||||||||||||||
| CSFY_AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }} | ||||||||||||||
| CSFY_AWS_S3_BUCKET: ${{ vars.CSFY_AWS_S3_BUCKET }} | ||||||||||||||
| GH_ACTION_ACCESS_TOKEN: ${{ secrets.GH_ACTION_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | ||||||||||||||
| run: invoke docker_tag_push_dev_image | ||||||||||||||
| GH_ACTION_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||
| run: invoke docker_tag_push_dev_image --container-dir-name="${{ inputs.container-dir-name }}" | ||||||||||||||
|
|
||||||||||||||
| # Generate release message. | ||||||||||||||
| - name: Generate release message | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,10 @@ | ||||||||||||
| name: Dev image release | ||||||||||||
| on: | ||||||||||||
| # Trigger on a merged PR, with restrictions applied at the job level. | ||||||||||||
| pull_request: | ||||||||||||
| types: [closed] | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this CI pipeline going to appear in all the closed PR?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but there’s an helpers/.github/workflows/dev_image_release.yml Lines 21 to 25 in 806d920
So, the workflow will be triggered, but the job itself won’t run unless the condition is met.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think let's not have it triggered and shown for non relevant PRs
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't find a way to prevent the GitHub workflow from triggering when we merge a PR with the Another possible approach could be:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about triggered it on merged to master when the changelog.txt is changed? We can do path filtering |
||||||||||||
| branches: | ||||||||||||
| - master | ||||||||||||
| # Run manually. | ||||||||||||
| workflow_dispatch: | ||||||||||||
| # Set up permissions for OIDC authentication. | ||||||||||||
|
|
@@ -14,12 +19,10 @@ concurrency: | |||||||||||
| jobs: | ||||||||||||
| dev_image_release: | ||||||||||||
| if: > | ||||||||||||
| ${{ | ||||||||||||
| (github.event_name == 'pull_request' | ||||||||||||
| && github.event.pull_request.merged == true | ||||||||||||
| && contains(github.event.pull_request.labels.*.name, 'Automated release')) || | ||||||||||||
| github.event_name == 'workflow_dispatch' | ||||||||||||
| }} | ||||||||||||
| ( | ||||||||||||
| github.event.pull_request.merged == true | ||||||||||||
| && contains(github.event.pull_request.labels.*.name, 'Automated release') | ||||||||||||
| ) || github.event_name == 'workflow_dispatch' | ||||||||||||
| uses: ./.github/workflows/common_dev_image_release.yml | ||||||||||||
| with: | ||||||||||||
| container-dir-name: . | ||||||||||||
|
|
||||||||||||
Uh oh!
There was an error while loading. Please reload this page.