-
Notifications
You must be signed in to change notification settings - Fork 133
[ci] Updating retrieve_bucket_info to pull artifacts from correct bucket based on run ID
#2357
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: main
Are you sure you want to change the base?
Conversation
| ) | ||
| def test_retrieve_newer_bucket_info(self): | ||
| # https://github.com/ROCm/TheRock/actions/runs/19680190301 | ||
| external_repo, bucket = retrieve_bucket_info("ROCm/TheRock", "19680190301") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why are we adding a hardcoded runid. Can you clarify ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those are unit tests :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So for Unit tests do we have to hardcode the runid of an action ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, in this case, we are pulling GH data with "retrieve_bucket_info" and running asserts to ensure it works
For the changes I made, we need to check whether it's an old bucket or new bucket, and this is done via run ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also mock the network requests, in which case the run IDs could be arbitrary numbers. I started on that in https://github.com/ScottTodd/TheRock/tree/gha-test-mock.
I do like at least having the ability to test against the real github API with actual data though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have to use something dynamic instead of hardcode run IDs. Please check if there any methods to pull the run ID dynamically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For pulling run IDs dynamically, it's fairly easy to do this for new jobs. for old jobs, this would be quite an effort on GH APIs and for unit tests.
Since these run IDs are known and usable numbers, I'm going to keep these static for unit testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a TODO comment on that.
| "GITHUB_TOKEN not set, skipping test that requires GitHub API access", | ||
| ) | ||
| def test_retrieve_bucket_info_from_fork(self): | ||
| # https://github.com/ROCm/TheRock/actions/runs/18023442478?pr=1596 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can remove this commented lines and add some docs as comments for This function will be helpful to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are docs in retrieve_bucket_info, while this function is a unit test. let me know if more clarification is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments where is the retreive_bucket_info. That might help who are looking at the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a unit test suite for github_action_utils and it is testing various functions from github_action_utils, I hope that is clear enough? similar to gha_query_workflow_run_information function
although if still confusing, i can add a comment if needed
| os.getenv("GITHUB_TOKEN"), | ||
| "GITHUB_TOKEN not set, skipping test that requires GitHub API access", | ||
| ) | ||
| def test_retrieve_newer_bucket_info_from_rocm_libraries(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above can you add some docs in comments explaining the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are docs in retrieve_bucket_info, while this function is a unit test. let me know if more clarification is needed
| ) | ||
| def test_retrieve_newer_bucket_info(self): | ||
| # https://github.com/ROCm/TheRock/actions/runs/19680190301 | ||
| external_repo, bucket = retrieve_bucket_info("ROCm/TheRock", "19680190301") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have to use something dynamic instead of hardcode run IDs. Please check if there any methods to pull the run ID dynamically.
| external_repo, bucket = retrieve_bucket_info("ROCm/TheRock", "18023442478") | ||
| self.assertEqual(external_repo, "ROCm-TheRock/") | ||
| self.assertEqual(bucket, "therock-ci-artifacts-external") | ||
| self.assertEqual(bucket, "therock-artifacts-external") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add this bucket dynamically by using other variables instead of hardcode the bucket name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "dynamic retrieval" is actually the bucket variable. the "therock-artifacts-external" string is what the variable is comparing too for unit tests correctness!
User reported issue when trying example from https://github.com/ROCm/TheRock/blob/main/RELEASES.md#installing-tarballs-using-install_rocm_from_artifactspy due to old run ID no longer accessing new s3 bucket
Tested locally:
Newer run id: https://github.com/ROCm/TheRock/actions/runs/19688861356/job/56406062109
Older run id: https://github.com/ROCm/TheRock/actions/runs/18740768335
Closes #2295