appsody / stacks

Appsody application stacks. This repo will be archived soon.
https://appsody.dev
Apache License 2.0
89 stars 121 forks source link

rust: Add tide stack #814

Closed No9 closed 4 years ago

No9 commented 4 years ago

Checklist:

Modifying an existing stack:

Contributing a new stack:

Related Issues:

https://github.com/appsody/stacks/issues/769

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

neeraj-laad commented 4 years ago

@No9 Thanks for contributing this new stack. Can you please take a look at the Travis build failures?

@Kamran64 please can you review this PR?

No9 commented 4 years ago

Hi @Kamran64 Thanks for all the feedback I have applied the changes requested - However I am really struggling with the build issue as I can't reproduce it on my local machine.

Looking at the CI logs

**************************************************************************
Running appsody build against stack:dev.local/rust-tide template:default
**************************************************************************
[/usr/bin/appsody build --tag dev.local/appsodyvalidating-rust-tide]
Extracting project from development environment
Using local cache for image docker.io/appsody/rust-tide:0.1
Running command: docker create --name validating-rust-tide-extract -v /home/travis/.appsody/stacks/validating-rust-tide/:/project/user-app docker.io/appsody/rust-tide:0.1
Running command: docker cp validating-rust-tide-extract:/project /home/travis/.appsody/extract/validating-rust-tide
Running command: docker rm validating-rust-tide-extract -f
[Error] docker cp command failed: exit status 1

The error seems to be thrown here https://github.com/appsody/appsody/blob/3723275048b340db2889de10667e096fa06ce6e4/cmd/extract.go#L302

I am running Fedora 32 the validation works expected and the Project extracted message is present

**************************************************************************
Running appsody build against stack:dev.local/rust-tide template:default
**************************************************************************
[/usr/bin/appsody build --tag dev.local/appsodyvalidating-rust-tide]
Extracting project from development environment
Using local cache for image dev.local/appsody/rust-tide:0.1
Running command: docker create --name validating-rust-tide-extract -v /home/anton/.appsody/stacks/validating-rust-tide/:/project/user-app dev.local/appsody/rust-tide:0.1
Running command: docker cp validating-rust-tide-extract:/project /home/anton/.appsody/extract/validating-rust-tide
Project extracted to /home/anton/.appsody/extract/validating-rust-tide
Running command: docker rm validating-rust-tide-extract -f

I tested out some scenarios on local and docker cp usually gives detailed errors but it looks like the console output is getting lost in utils as only the error is returned not the console output. https://github.com/appsody/appsody/blob/3723275048b340db2889de10667e096fa06ce6e4/cmd/utils.go#L2117

Would it be possible to write the output of the cp command to the log as well as returning the error or is it possible to get access to the travis environment to run the commands on a failed instance?

Kamran64 commented 4 years ago

@No9 - I'll see if I can replicate locally too. Yeah, non useful logs are something we've struggled with quite a bit especially on extract/build phases. I'll see if we can improve on that in the function it's failing on to give a clearer direction.

No9 commented 4 years ago

Hey @Kamran64 Just to check I spun up an ubuntu 18.04 on IBM Cloud As root Installed Docker - https://docs.docker.com/engine/install/ubuntu/ Download and install appsody 0.6.1 - https://appsody.dev/docs/installing/ubuntu/ Clone checkout then validate the stack.

# git clone https://github.com/No9/stacks
# cd stacks/
# git checkout --track origin/rust-tide
# git fetch
# cd experimental/rust-tide/
# appsody stack validate
@@@@@@@@@@@@@@@ Validate Summary Start @@@@@@@@@@@@@@@@
PASSED: Lint for stack:rust-tide
PASSED: Package for stack:rust-tide
PASSED: Init for stack:rust-tide template:default
PASSED: Run for stack:rust-tide template:default
PASSED: Test for stack:rust-tide template:default
PASSED: Build for stack:rust-tide template:default
Total PASSED: 6
Total FAILED: 0
@@@@@@@@@@@@@@@  Validate Summary End  @@@@@@@@@@@@@@@@

Validated Properly :/ Not much use but good to know I guess

No9 commented 4 years ago

@Kamran64 Quick update I can recreate the problem on my machine using the ./ci/build.sh But when I run the problematic docker create command outside of the script it works fine. I'll keep looking

Kamran64 commented 4 years ago

Thanks for the updates @No9 - I'll try and get to this soon!

No9 commented 4 years ago

So this is getting stranger - The test randomly passed with no change but micro-profile failed with the same error.

calling docker image ls to check for the image
docker image dev.local/appsodyvalidating-java-microprofile was found
@@@@@@@@@@@@@@@ Validate Summary Start @@@@@@@@@@@@@@@@
PASSED: Init for stack:java-microprofile template:default
PASSED: Run for stack:java-microprofile template:default
FAILED: Test for stack:java-microprofile template:default
PASSED: Build for stack:java-microprofile template:default
Total PASSED: 3
Total FAILED: 1
@@@@@@@@@@@@@@@  Validate Summary End  @@@@@@@@@@@@@@@@
[Error] 1 validation check(s) failed.

I have downgraded to 0.6.0 and haven't been able to reproduce it so it looks like it could have been introduced in 0.6.1.

No9 commented 4 years ago

Hey @Kamran64 I updated to 0.6.2 and the issue became apparent. The project Dockerfile was using the dev.local/experimental/rust-tide image to copy over the server code and that images wasn't available to the CI Server. I have created an external image to containing the server code and the build now passes.

This feels like a work-around. It would be better if I could build and reference the server image as part of the build process. I looked at the other rust projects but couldn't see how this would be possible.