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

Run E2E shielder tests in the CI. #25

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Run E2E shielder tests in the CI. #25

wants to merge 8 commits into from

Conversation

deuszx
Copy link
Contributor

@deuszx deuszx commented Mar 22, 2023

No description provided.

@deuszx deuszx marked this pull request as ready for review March 27, 2023 10:25
@@ -145,6 +153,15 @@ docker_cargo() {
-c "cargo ${1}"
}

ci_docker_cargo() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need a different version of the method when running in CI due to issues w/ permissions when running as a docker process - we can't create directories in cargo cache (and we try to do that when compiling contracts). Hence mounting of these dirs is removed.

Copy link
Contributor

@fbielejec fbielejec Mar 27, 2023

Choose a reason for hiding this comment

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

I find that hard to believe - since it works just fine for compiling here. Take a good look at mapping users and user groups when running these containers, that's usually what is responsible for no read/write privileges.

Copy link
Contributor Author

@deuszx deuszx Mar 27, 2023

Choose a reason for hiding this comment

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

In TheButton you're copying everything and running Makefile inside docker. It makes "some" sense there as there are many contracts to be built and Yapee didn't want to spin up the same docker container multiple times (and couldn't mount cargo dirs directly for the exact same reason I can't here), but it's not the case here.

tl;dr; in TheButton you don't write to underlying file system but the dir owned by the docker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Take a good look at mapping users and user groups when running these containers, that's usually what is responsible for no read/write privileges.

I had tried that, asked on Slack last week as well, but it doesn't work. Docker user is probably not a part of the required group on these machines and is not allowed to write to ~/.cargo/* dirs.

Copy link
Contributor

@fbielejec fbielejec Mar 29, 2023

Choose a reason for hiding this comment

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

Then I don't understand why is the deployment script set up differently than in TheButton? It runs CI on exactly the same self-hosted instance. It mounts and writes to the contract directories, same.

Either you don't have to mount .cargo, or just ask devops guys to make it writable for the usergroup that the docker is part of. Or launch docker as a user in one of those groups. We control that instance.

Having two methods to launch will come back and bite, and will make any problems on CI irreproducible locally, making it even harder to debug potential problems.

Copy link
Contributor Author

@deuszx deuszx Mar 29, 2023

Choose a reason for hiding this comment

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

In TheButton you don't have the self-contained Makefile and CI is set up differently from the local development. Here I'm re-using the same scripts, commands, etc except for these 3 lines in cargo-docker.

Either you don't have to mount .cargo,

Well, you don't have to - it's just speeding up the build time.

Having two methods to launch will come back and bite, and will make any problems on CI irreproducible locally, making it even harder to debug potential problems.

This setup is IMO actually going to help w/ that - the local vs CI setup is basically identical (again, except for the part whether you use cached dependencies to download them every time). It's much better than the situation TheButton in that case.

uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
Copy link
Contributor

Choose a reason for hiding this comment

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

needed?

Copy link
Member

Choose a reason for hiding this comment

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

shouldn't be...

Copy link
Contributor Author

@deuszx deuszx Mar 27, 2023

Choose a reason for hiding this comment

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

No, wait. This is needed. Just look at one of the recent, failed jobs. All self-hosted workflows require that https://github.com/Cardinal-Cryptography/aleph-node/blob/main/.github/workflows/_build-liminal-node.yml

Copy link
Contributor

Choose a reason for hiding this comment

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

See if toolchain.yaml with a version won't solve this (next comment)

uses: actions-rs/toolchain@v1

- name: Install WASM target
run: rustup target add wasm32-unknown-unknown
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't the target be baked into in the docker image already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Target backed to docker image can be overriden by toolchain in the contract itself. If they don't match it will fail when building.

Copy link
Contributor

@fbielejec fbielejec Apr 17, 2023

Choose a reason for hiding this comment

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

For solution try:

[toolchain]
channel = "nightly-2022-10-30"
targets = [ "wasm32-unknown-unknown" ]
components = [ "rust-src" ]

then imho it should pull the required toolchain, target and components

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this will work. It's just an alternative way of doing the same thing.

Copy link
Contributor

@fbielejec fbielejec left a comment

Choose a reason for hiding this comment

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

please try and dedupe how the containers are run

Copy link
Member

@pmikolajczyk41 pmikolajczyk41 left a comment

Choose a reason for hiding this comment

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

approval for me, but I have similar thoughts as Filip for two different cargo dockers

.github/workflows/integration_tests.yml Show resolved Hide resolved
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't be...

shielder/cli/tests/setup_local.sh Show resolved Hide resolved
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.

4 participants