fix CI #989
No reviewers
Labels
No labels
Android
CS::needs customer feedback
CS::needs follow up
CS::needs on prem installation
CS::waiting
Chrome
Design:: Ready
Design:: in progress
Design::UX
E2EE
Edge
Firefox
GDPR
Iteration 13 IM
Linux
MacOS
Need::Discussion
Need::Steps to reproduce
Need::Upstream fix
Needs:: Planning
Needs::Dev-Team
Needs::More information
Needs::Priority
Needs::Product
Needs::Refinement
Needs::Severity
Priority::1-Critical
Priority::2-Max
Priority::3-Impending
Priority::4-High
Priority::5-Medium
Priority::6-Low
Priority::7-None
Progress::Backlog
Progress::Review
Progress::Started
Progress::Testing
Progress::Triage
Progress::Waiting
Reporter::Sentry
Safari
Target::Community
Target::Customer
Target::Internal
Target::PoC
Target::Security
Team:Customer-Success
Team:Design
Team:Infrastructure
Team:Instant-Messaging
Team:Product
Team:Workflows
Type::Bug
Type::Design
Type::Documentation
Type::Feature
Type::Improvement
Type::Support
Type::Tests
Windows
blocked
blocked-by-spec
cla-signed
conduit
contribution::advanced
contribution::easy
contribution::help needed
from::review
iOS
p::ti-tenant
performance
product::triage
proposal
refactor
release-blocker
s: dart_openapi_codegen
s::Famedly-Patient
s::Org-Directory
s::Passport-Generator
s::Requeuest
s:CRM
s:Famedly-App
s:Famedly-Web
s:Fhiroxide
s:Fhiroxide-cli
s:Fhiroxide-client
s:Fhirs
s:Hedwig
s:LISA
s:Matrix-Dart-SDK
s:Role-Manager
s:Synapse
s:User-Directory
s:WFS-Matrix
s:Workflow Engine
s:dtls
s:famedly-error
s:fcm-shared-isolate
s:matrix-api-lite
s:multiple-tab-detector
s:native-imaging
severity::1
severity::2
severity::3
severity::4
technical-debt
voip
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Matthias/conduit#989
Loading…
Reference in a new issue
No description provided.
Delete branch "lints"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
added 5 commits
Compare with previous version
Can you revert this to the explicit version, I prefer that one.
Can we allow that by default, in a file like clippy.toml? I want to keep clippy out of the main codebase if that is possible.
I wonder if it's possible to write
filter_map(|r| r.ok()?)
or something like that to avoid the flatten. But this is fine.Maybe it's easier to read by matching the len with 0, 1, and 2..
Weird hack, but okay
I think == Ok(true) is easier to read.
Thanks a lot for your work, here are some small ideas for improvements
Couldn't we do something like
matches!(services()..., Ok(true))
? The original statement might be more readable, though.If I understand this correctly, the
Ok
is there to tellrustc
that the return type of the closure isResult
, to allow for?
, right? Personally, I find it a bit ugly, but I can't figure out a cleaner way.The explicit version triggers a deprecation warning though?
I think it would be best to keep this lint enabled, it's just that I didn't feel comfortable refactoring all the existing violations.
Why?
Yeah...
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in version 3 of the diff
changed this line in version 3 of the diff
added 9 commits
famedly:next
Compare with previous version
If we want to return a
Result
from the closure (e.g. via?
) then all returned values must be of typeResult
(e.g. inOk(...)
). The alternative to wrapping the whole expression inOk(...)
is to bind an intermediate variable and then wrap that at the end instead.I applied @timokoesters's suggestion
I replaced this whole thing with slice patterns, which also avoids re-slicing the slice again (even though LLVM could most likely have eliminated those redundant bounds checks anyway).
Note that this change affects the ordering in the resulting
name
so thatlast
is actually the last instead of the first. Not sure if that's going to break anything, which is why I'm highlighting this particular change.Hmm that deprecation warning is only there to warn clients. Servers still need to provide the info I think?
Okay I thought about it and agree, so we would replace them with structs containing the parameters when we get the chance, correct?
https://spec.matrix.org/v1.9/client-server-api/#post_matrixclientv3login says
home_server
shouldn't be sent by servers and the client should extract the server name from theuser_id
themselves to figure out where they belong.Conduit simply shouldn't be sending it as it's redundant now and clients will extract the server from
user_id
themselves, so the warning is correct. I haven't had any authentication issues with FluffyChat, Element Web, or Element X with this.Thanks for considering this! As for dealing with the lint when it triggers, it depends I think. I imagine sometimes a good argument could be made as to why a function needs a bunch of arguments and a struct would be pointless overhead, but in general, yeah, making a struct is a good way to avoid this.
Actually that doesn't compile lol so I'm just converting it back to how it was before. Honestly not totally sure why I bothered to change this in the first place
added 14 commits
famedly:next
Compare with previous version
added 1 commit
Compare with previous version
changed title from fix {-lints-} to fix {+CI+}
added 3 commits
Compare with previous version
I figured I should just take this to the finish line and enforce that the checks I just fixed don't immediately get violated again. I left relatively detailed commit messages about why I did certain things, so make sure to look at those too when reviewing.
Some things that were broken before are now just gone; for example, there is currently no automated Docker image building. I would be willing to fix this in a future MR though (this one is pretty big as it is).
(Side note: holy crap I just realized that it was me who pointed out this redundancy (and the misspelling of "homeserver") in the API nearly 7 years ago in https://github.com/matrix-org/matrix-spec-proposals/pull/1097 (they opened this PR on my behalf but I brought it up in one of the Matrix rooms first))
Following the trail from that PR, it looks like
well_known
is supposed to be the better-documented non-deprecated replacement forhome_server
: https://github.com/matrix-org/matrix-spec-proposals/pull/1730requested review from @jfowl
I can't really say anything about the Rust changes, but if we could somehow leave docker image building in (be it by using the existing CI step or nix-native), this looks good to me.
Note that the current docker step is also responsible for outputting the normal binaries and the
.deb
files along the wayI love how this basically makes the ci setup portable, it looks very easy to migrate to GitHub Actions for example
Yep! And you can use Engage locally to tighten your feedback loop. When combined with using Nix locally too, you can be sure you have the exact same environment and checks that CI does, so if it works on your machine, it will work in CI too.
I was mainly trying to ship an MVP CI system that just does tests and code quality checks in this MR. The plan was to handle that stuff in a follow-up MR, since this one is already quite large and I didn't want to make it too unwieldy to review. I figured we wouldn't be missing much in the time between merging this one and then the follow-up since that stuff was broken before anyway, and I have code for building the Docker images already so hopefully it shouldn't take me too long to do the rest. I could just do it in this MR though if that's what you want.
added 3 commits
Compare with previous version
added 9 commits
Compare with previous version
Okay, I've done a little rebasing and added two commits. One for building a Docker image and exposing it as an artifact in CI, and another for doing the same for a Debian package. These are both for x86_64 only, I haven't attempted cross compilation.
added 2 commits
Compare with previous version
Just going to get ahead of comments asking why I didn't use GitLab CI features instead of wrapping a bunch of stuff in
if command -v nix > /dev/null; then ...; fi
like this.It's because YAML anchors didn't work and
extends
doesn't merge values. I don't like it either but this is the best we can do without duplicating code.requested review from @jfowl
added 2 commits
Compare with previous version
added 2 commits
Compare with previous version
mentioned in merge request !567
added 1 commit
Compare with previous version
I definitely kept trying to improve stuff over the last few hours but I think it's finally in a decent spot. I'll stop touching it for now so it can be reviewed. (And maybe merged? 👉 👈)
The debian and docker builds should probably only run on protected branches, you can do this by adding the following to the jobs:
I'm new to nix so I'm not sure how one would go about implementing multi arch builds. Not having arm64 images is a problem and definetely needs to be added in the future.
I can't comment on the rust changes but the CI part looks good.
Publishing of the built binaries and docker images to the GitLab Registry is still missing. I'd be happy to open a MR for that once this is merged.
On the other hand, I think it would be really useful to, for example, produce builds for MRs so that other users (at least, other Docker/Debian users) can easily test the changes themselves before merge if they want.
Theoretically, running
nix build .#oci-image
on aarch64 should produce an aarch64 image without having to make any changes. Cross compilation is probably possible, but also probably high effort. I'm willing to look into this, but I don't have any aarch64 hardware to test on. I guess I could just use QEMU though.GitLab does not provide any arm runners so someone would need to host one. Can a maintainer please check if there's already any self hosted runners registered in the project settings?
For reference, this is how we can create a multi-arch manifest:
see: https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
I'm saying aarch64 users can still build docker images on their own if they want right now. As for doing builds in CI, I think I'd rather get cross-compilation working.
Currently, there are only amd64 runners available, but it would be possible to get access to an arm64 one.
Indirectly, it is possible to SSH to a 4CPU-ARM64 server in the Oracle Cloud, which was used to build the docker image natively on there.
I would favor cross-compilation too though, as it appears to work (for dynamically linked builds) reliably via cargo-zigbuild.
I don't know NIX, so this is a bit hard for me to review, but it looks ok.
@eisfunke 👉 👈 ?
I'm fine with breaking docker image publishing for
next
for the moment, as long as we can get it working again for a real release.Breaking artifact links would need an update to
DEPLOY.md
though.Overall: Looks good
There's no need to ssh into the server, you can just install GitLab runner on there and run the ci job natively.
https://docs.gitlab.com/runner/
Just an update about cross compilation, I got cross to
x86_64-unknown-linux-musl
fully working here last night. I haven't tried aarch64 yet, but I think getting static builds is the harder part anyway.Okay so for
aarch64-unknown-linux-musl
, I made the obvious changes and immediately hit this rust issue but this nixpkgs PR tells me that switching to thelld
linker specifically for this platform should fix it?Update: I have cross to
aarch64-unknown-linux-musl
working! Code here. The caveat is that I disabled all of therocksdb
crate's features in order to do this, and Conduit uses a few of them, so I'll need to figure that out next.I tried
armv7l-unknown-linux-musleabihf
for fun and it actually failed to build RocksDB's C library, I think upstream doesn't support that target: https://github.com/facebook/rocksdb/issues/8609. I won't pursue this target any further for now.The previous cross compilation stuff I was doing were just tests using
buildRustPackage
from nixpkgs and a dummy project that depended onrocksdb
. After more fiddling, I have cross compilation of Conduit itself tox86_64-unknown-linux-musl
fully working here, but I wasn't so lucky withaarch64-unknown-linux-musl
, for which I've opened an issue on Crane since I suspect it's a bug there: https://github.com/ipetkov/crane/issues/497.Update: I have cross to
x86_64-unknown-linux-musl
andaarch64-unknown-linux-musl
here!The next problem is making doing these builds in CI efficient.
I agree that builds should only be made after the changes have been reviewed and merged.
I can approve the Rust part of this MR.
approved this merge request
Nico in #spec said the server must still send the field
I'm curious why not?
Another point to consider here is that an MR might break cross compilation but if we aren't doing builds for MRs then we won't notice until it's too late.
changed this line in version 13 of the diff
changed this line in version 13 of the diff
added 13 commits
e8ac881b
- add an engage file6f052fff
- improve nix flake25ceb5eb
- remove commented out ci step9d592d60
- remove dockerlint step because it does nothingffd03a25
- remove workflow rules7e66d2e2
- use nix and engage to manage cif8bdfd82
- update flake.lock02781e4f
- use nix-filter to filter sources4de54db3
- redo docker image and build it in ci0b7ed5ad
- add debian package building in ciCompare with previous version
Okay, I put this back to normal and added an
#[allow(deprecated)]
with a comment explaining why.The plan is to add this stuff in a follow-up MR today.
mentioned in commit
5cf9f3df48
mentioned in merge request !569
mentioned in merge request !570
mentioned in issue #385
mentioned in commit girlbossceo/conduwuit@1460a82f54
mentioned in commit girlbossceo/conduwuit@973c4fe31d