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

[Feature] Add custom build commands #647

Open
1 task done
joshka opened this issue Oct 1, 2024 · 3 comments
Open
1 task done

[Feature] Add custom build commands #647

joshka opened this issue Oct 1, 2024 · 3 comments

Comments

@joshka
Copy link

joshka commented Oct 1, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description

Custom build commands to support building on cloudflare should be something like:

build = { command = """\
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
    | sh -s -- -y \
        && . $HOME/.cargo/env \
        && rustup target add wasm32-unknown-unknown \
        && cargo install -q worker-build \
        && worker-build --release\
""" }

Note, this causes the same command to be run when using wrangler dev locally, which is a bit of a pain because you usually don't want to reinstall rustup etc. These are noops (at least in my own environment), but maybe not noops everywhere.

What I've actually done is added these to a prod environment and used that, but I'm not certain this is the right way to handle this either.

@kflansburg
Copy link
Contributor

I'm not sure what this is asking for, we do support custom builds with exactly this syntax (not sure about multi-line, but that is a TOML thing). Are you saying that Workers CI should respect this configuration and doesn't today?

@joshka
Copy link
Author

joshka commented Oct 1, 2024

Sorry, I was a little ambiguous in my ask.
I meant that these build commands should be documented, vetted for correctness, and added to the templates so that users don't have to search to work out how to make the applications generated from templates work with the cloudflare build. It was surprising to see a failure immediately when hooking up my github repo for the first time, and to have no documentation about what was necessary to make it work. After searching github issues, docs, etc. I eventually found guidance in a discord comment on how to get this working. I don't yet know what's the right way to only run this when building on cloudflare and not when building locally.

So to be more clear:

  1. Document the integration with rust apps and workers build (perhaps this is available, but my search didn't turn up anything relevant in the docs site).
  2. Include this by default in the templates (or include a link to how to configure this)
  3. Document the errors better in cloudflare build when this fails
  4. Consider adding rust to the build server setup so this isn't a problem generally

@kflansburg
Copy link
Contributor

I was planning to have Rust and worker-build added to the default build image which will hopefully eliminate this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants