Skip to content
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

xtask: Use reqwest to fetch gen_init_cpio.c #1208

Closed
wants to merge 1 commit into from

Conversation

heiher
Copy link
Contributor

@heiher heiher commented Mar 6, 2025

Since octorust depends on an old version of ring, some newer Rust targets cannot compile with it. This patch switches to using reqwest to fetch gen_init_cpio.c to make it work on more targets.


This change is Reviewable

Copy link

netlify bot commented Mar 6, 2025

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4f1cea3
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/67c93530b8b99d000870e62c
😎 Deploy Preview https://deploy-preview-1208--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mergify mergify bot added the test A PR that improves test cases or CI label Mar 6, 2025
Copy link
Member

@dave-tucker dave-tucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the motivation that's driving this change, however, I'd rather keep functionality the same as the existing solution with octorust. See comments on how I feel this can be accomplished.

headers: _,
body: octorust::types::ContentFile { mut content, .. },
} = tokio::runtime::Builder::new_current_thread()
let content = tokio::runtime::Builder::new_current_thread()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

///
/// This may be required if Github rate limits are exceeded.
#[clap(long)]
github_api_token: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This served a purpose. We frequently were getting rate limited in CI. Please reinstate it.

"master",
))
.block_on(async {
reqwest::get("https://github.com/torvalds/linux/raw/refs/heads/master/usr/gen_init_cpio.c")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to use https://docs.rs/reqwest/latest/reqwest/blocking/struct.Client.html
so we can set headers.

This doc suggests it would be wise to:

  1. Set the header for the expect API version
  2. Set the auth header if --github-api-token was provided

Furthermore, I would suggest using the same API endpoint as octorust was using due to the aforementioned issues with rate limiting.

https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28

You'll then want to parse the reponse with serde_json

@tamird
Copy link
Member

tamird commented Mar 6, 2025

Alternatively we could wait for oxidecomputer/third-party-api-clients#99.

@heiher
Copy link
Contributor Author

heiher commented Mar 7, 2025

Thanks for your review and comments. It looks like octorust may upgrade its dependencies next week, so we can still use the current implementation.

@heiher heiher closed this Mar 7, 2025
@heiher heiher deleted the reqwest branch March 7, 2025 04:17
@heiher heiher mentioned this pull request Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test A PR that improves test cases or CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants