-
Notifications
You must be signed in to change notification settings - Fork 137
[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
Changes from all commits
d70cb92
7840e31
402723e
fab2fea
5652577
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 |
|---|---|---|
|
|
@@ -46,9 +46,20 @@ def test_gha_query_workflow_run_information(self): | |
| "GITHUB_TOKEN not set, skipping test that requires GitHub API access", | ||
| ) | ||
| def test_retrieve_bucket_info(self): | ||
| # TODO(geomin12): work on pulling these run IDs more dynamically | ||
| # https://github.com/ROCm/TheRock/actions/runs/18022609292?pr=1597 | ||
| external_repo, bucket = retrieve_bucket_info("ROCm/TheRock", "18022609292") | ||
| self.assertEqual(external_repo, "") | ||
| self.assertEqual(bucket, "therock-artifacts") | ||
|
|
||
| @unittest.skipUnless( | ||
| os.getenv("GITHUB_TOKEN"), | ||
| "GITHUB_TOKEN not set, skipping test that requires GitHub API access", | ||
| ) | ||
| def test_retrieve_newer_bucket_info(self): | ||
| # https://github.com/ROCm/TheRock/actions/runs/19680190301 | ||
| external_repo, bucket = retrieve_bucket_info("ROCm/TheRock", "19680190301") | ||
| self.assertEqual(external_repo, "") | ||
| self.assertEqual(bucket, "therock-ci-artifacts") | ||
|
|
||
| @unittest.skipUnless( | ||
|
|
@@ -59,7 +70,7 @@ def test_retrieve_bucket_info_from_fork(self): | |
| # https://github.com/ROCm/TheRock/actions/runs/18023442478?pr=1596 | ||
|
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. If we can remove this commented lines and add some docs as comments for This function will be helpful to understand.
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. there are docs in
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. Can you add comments where is the
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. Since this is a unit test suite for although if still confusing, i can add a comment if needed |
||
| 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") | ||
|
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. Can we add this bucket dynamically by using other variables instead of hardcode the bucket name.
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. the "dynamic retrieval" is actually the bucket variable. the "therock-artifacts-external" string is what the variable is comparing too for unit tests correctness! |
||
|
|
||
| @unittest.skipUnless( | ||
| os.getenv("GITHUB_TOKEN"), | ||
|
|
@@ -71,6 +82,18 @@ def test_retrieve_bucket_info_from_rocm_libraries(self): | |
| "ROCm/rocm-libraries", "18020401326" | ||
| ) | ||
| self.assertEqual(external_repo, "ROCm-rocm-libraries/") | ||
| self.assertEqual(bucket, "therock-artifacts-external") | ||
|
|
||
| @unittest.skipUnless( | ||
| 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): | ||
|
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. Same as above can you add some docs in comments explaining the function.
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. there are docs in |
||
| # https://github.com/ROCm/rocm-libraries/actions/runs/19784318631 | ||
| external_repo, bucket = retrieve_bucket_info( | ||
| "ROCm/rocm-libraries", "19784318631" | ||
| ) | ||
| self.assertEqual(external_repo, "ROCm-rocm-libraries/") | ||
| self.assertEqual(bucket, "therock-ci-artifacts-external") | ||
|
|
||
| @unittest.skipUnless( | ||
|
|
||
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.