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

Stop using a diesel_cli docker image, use cargo-install in woodpecker. #4723

Merged
merged 27 commits into from
May 16, 2024

Conversation

dessalines
Copy link
Member

  • The diesel_cli image is 500MB, and rebuilt daily. Much easier to use binstall to install it.

- The diesel_cli image is 500MB, and rebuilt daily. Much easier to use
  binstall to install it.
.woodpecker.yml Outdated
@@ -79,9 +79,11 @@ steps:
cargo_machete:
image: rustlang/rust:nightly
commands:
# Install cargo binstall
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if there's a way to extract and run multiple lines in yaml... if anyone knows how to do this that'd be appreciated.

.woodpecker.yml Outdated
# Install cargo binstall
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
- cp cargo-binstall /usr/local/cargo/bin
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wget and tar should not need to be run again. It might be possible to also remove cp and replace cargo binstall with ./cargo-binstall.

@dessalines dessalines marked this pull request as draft May 16, 2024 15:06
@dessalines
Copy link
Member Author

dessalines commented May 16, 2024

Alright I wasted a shameful amount of time on this:

  • cargo binstall can't install with feature flags
  • cargo binstall for diesel_cli works fine, but it requires mysql to be install on the system.
  • I tried a ton of variants of mysql and mariadb clients, and couldn't get any of them to work with the rust image.
  • I went back to just using cargo install diesel_cli --no-default-features --features=postgres
  • I also abstracted some repeated commands into what are called sequence merges.

@dessalines dessalines marked this pull request as ready for review May 16, 2024 19:02
@dessalines dessalines changed the title Stop using a diesel_cli docker image, use cargo-binstall in woodpecker. Stop using a diesel_cli docker image, use cargo-install in woodpecker. May 16, 2024
environment:
CARGO_HOME: .cargo_home
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
commands:
- <<: *install_diesel_cli
- diesel migration run
- diesel print-schema --config-file=diesel.toml > tmp.schema
Copy link
Collaborator

Choose a reason for hiding this comment

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

After #4673 is finished, this will be the only place where diesel cli is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice.

@dessalines dessalines merged commit 1a4aa3e into main May 16, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants