-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Companion: move check-polkadot-companion-build to polkadot #1426
Conversation
Forked at: d390eb5 Parent branch: origin/master
@gabreal I got this (maybe) excellent idea to reduce the build time and improve the current workflow. We don't need to run the polkadot build step on substrate, we can only check the status of the polkadot companion PR and let the polkadot build does its job. To do that I have inverted the way things are done: instead of pulling polkadot and testing in the substrate build, I pull substrate and I do the normal check in the polkadot build. The substrate companion PR must be in description. Someone who works on a substrate PR would still need to provide a companion PR but when the polkadot branch is failing they only need to make the polkadot pr work pass. (They will also need to restart the status check build in substrate but that step is fast.) VS now: When someone works on a substrate PR, they need to make the polkadot build pass in polkadot and in substrate. I believe this is also more complete because I can share the code with the other steps in polkadot (check-web-wasm, etc...). If you agree with this change I will make a common bash "functions" file and tweek the other build steps of polkadot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, the idea sounds really good!
I didn't get what paritytech/substrate#6654 has to do with this change.
Does this PR mean that a companion check should move from Substrate CI to here?
And regarding the test_linux_stable
CI job itself: it used to test polkadot, now it tests substrate, where do we test polkadot then?
scripts/gitlab/test_linux_stable.sh
Outdated
# patching the git path as described in the link below did not test correctly | ||
# https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html | ||
mkdir .cargo | ||
echo "paths = [ \"$SUBSTRATE_PATH\" ]" > .cargo/config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are lots of warnings in the build log:
warning: path override for crate **** has altered the original list of
dependencies; the dependency on `sp-core` was either added or
modified to not match the previously resolved version
This is currently allowed but is known to produce buggy behavior with spurious
recompiles and changes to the crate graph. Path overrides unfortunately were
never intended to support this feature, so for now this message is just a
warning. In the future, however, this message will become a hard error.
To change the dependency graph via an override it's recommended to use the
`[replace]` feature of Cargo instead of the path override feature. This is
documented online at the url below for more information.
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html
does it make sense to follow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to some of our colleagues, yes. @tomaka talked about it I think. But this is what we currently use right now in substrate so there are also a lot of warnings there but it works.
Right now it is not a big deal but I suppose at some point we will need to change the mechanism we use to override substrate.
I could provide a change that would use the [replace]
but that change will be very intensive. I don't mind working on it but I'm currently booked with cumulus. I can provide my ideas and the code I already have for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind either. It just produces that much of logs so GitLab log output says it's a bit too much. No big deal though.
scripts/gitlab/test_linux_stable.sh
Outdated
|
||
# Merge master into our branch before building Polkadot to make sure we don't miss | ||
# any commits that are required by Polkadot. | ||
git merge origin/master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is prone to fail when the commit is not a final one in the PR. I.e. if I was renaming the function name and someone merged the use of an old function name in a new place, then it will fail in a not obvious manner.
But besides that, this makes a very good "Pre-merge test".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I don't like these git merge
either. My reason is not because it's fallible but because it is testing something different than the actual code in the branch. But again, I just copied that from the original script, I did not intend to put that in question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, should be resolved elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabreal do you know if those merge are absolutely required? They can make a PR fails for no good reason: https://gitlab.parity.io/parity/polkadot/-/jobs/596036
Nothing at all! I needed a substrate PR for testing and I didn't want to create one explicitly for that. Sorry, I've done a mess with github 😅
Yes that's the whole point. We could remove the companion-check-build and keep only the companion-check-status (in substrate)
No no it's testing polkadot XD I copied the code of companion-check-build and I inverted the repositories so it's cloning substrate but it's actually testing polkadot. The path is changing back to polkadot here: https://github.com/paritytech/polkadot/pull/1426/files#diff-bd5a097042de94b88468bfb88d6257f4R38 (line 38) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good to go. Where are the corresponding changes to substrate CI?
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
@TriplEight I haven't done a PR in substrate to remove the polkadot build yet. I'm off today and tomorrow, I will finish it on Thursday. |
Ok I think I need to work on this fast. This change would also solve issues like this one: #1080 The substrate branch has been merged but the polkadot companion is stalling. Meaning that the substrate branch is doing okay but potentially the polkadot master is not working with substrate master anymore. @gabreal can I also have your feedback on my PR here? My intention is:
Improvements with that:
|
17e10fa
to
38cf177
Compare
Parent branch: origin/master Forked at: d390eb5
scripts/gitlab/check_runtime.sh
Outdated
failed_runtime_checks+=($RUNTIME) | ||
fi | ||
done | ||
|
||
source file directories: | ||
- runtime | ||
if [ ${#failed_runtime_checks} -gt 0 ]; then | ||
boldcat <<EOT | ||
wasm source files changed or the spec version in the substrate reference in | ||
the Cargo.lock but not the spec/impl version. If changes made do not alter | ||
logic, just bump 'impl_version'. If they do change logic, bump | ||
'spec_version'. | ||
|
||
versions file: ${VERSIONS_FILE} | ||
source file directories: | ||
- runtime | ||
|
||
EOT | ||
version files: ${failed_runtime_checks[@]} | ||
EOT | ||
|
||
exit 1 | ||
fi | ||
done | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this change to this PR. It's not really related, I just wanted to fix it.
Instead of failing at the first runtime check, it now collects all the runtime check that fails and print them in a single build.
I also converted the file from tabs to spaces because all other bash scripts in this repo are using spaces.
Parent branch: origin/master Forked at: d390eb5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the indentation in check_runtime.sh
, I'll blame my editor for that...
Also big thanks for taking the time to split these jobs off into their own shell scripts. And for making use of lib.sh!
All but one of my suggestions were just to get rid of Shellcheck nags - I try to keep the scripts I work on compliant with that where possible - even in cases where (for example with it complaining about shell globbing), the input we provide will never actually cause a problem.
I'll just leave this as a comment for now, due to ongoing discussion on Matrix.
@@ -96,3 +96,79 @@ curl -XPOST -d "$1" "https://matrix.parity.io/_matrix/client/r0/rooms/$2/send/m. | |||
# Pretty-printing functions | |||
boldprint () { printf "|\n| \033[1m%s\033[0m\n|\n" "${@}"; } | |||
boldcat () { printf "|\n"; while read -r l; do printf "| \033[1m%s\033[0m\n" "${l}"; done; printf "|\n" ; } | |||
|
|||
prepare_git() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BIG fan of more people starting to use lib.sh
🎉
Co-authored-by: s3krit <pugh@s3kr.it>
I'm closing this PR because after discussion (and checking history) I realized that this solution won't solve the issue I currently have with the companion pr process. I still want to solve the problem. I believe the first solution I implemented has minimal cost and would actually have an impact: 36802ad But I'm still closing this PR to keep track of the proposal and all the code and ideas. cc @gavofyork @bkchr |
substrate companion: paritytech/substrate#6706