Skip to content

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

@netlify
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