viash-io / viash

script + metadata = standalone component
https://viash.io
GNU General Public License v3.0
39 stars 2 forks source link

[BUG] Docker setup is not failing when a package can not be found #770

Open DriesSchaumont opened 4 days ago

DriesSchaumont commented 4 days ago

What happened?

During installation R package that does not exist, I encountered an issue where this error was not reported during build.

Steps to reproduce

mkdir -p /tmp/test_bug
cd /tmp/test_bug
cat > _viash.yaml << 'HERE'
viash_version: 0.9.0

source: src
target: target
HERE

mkdir -p src/dummycomponent

cat > src/dummycomponent/config.vsh.yaml << 'HERE'

name: myscript
namespace: "dummycomponent"
resources:
  - type: r_script
    path: script.r
    text: |
      print("OK!")
engines:
  - type: docker
    image: bioconductor/bioconductor_docker:latest
    setup:
      - type: r
        cran:
          - thisisarandompackagethatdoesnotexist
runners:
  - type: executable
HERE

viash ns build --setup cb
./target/executable/dummycomponent/myscript/myscript ---setup build ---verbose

Expected behavior

Because thisisarandompackagethatdoesnotexist is not a cran package, the installation should report a failure.

Relevant log output

viash ns build --setup cb
./target/executable/dummycomponent/myscript/myscript ---setup build ---verbose
Exporting myscript (dummycomponent) =executable=> /tmp/test_bug/target/executable/dummycomponent/myscript
[notice] Building container 'dummycomponent/myscript:latest' with Dockerfile
All 1 configs built successfully
[notice] Building container 'dummycomponent/myscript:latest' with Dockerfile
[info] docker build -t 'dummycomponent/myscript:latest' --no-cache '/tmp/test_bug/target/executable/dummycomponent/myscript' -f '/tmp/dockerbuild-myscript-t8y0CU/Dockerfile'
[+] Building 1.2s (6/6) FINISHED                                                                                                                                                                                 docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                       0.0s
 => => transferring dockerfile: 489B                                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/bioconductor/bioconductor_docker:latest                                                                                                                                         0.2s
 => [internal] load .dockerignore                                                                                                                                                                                          0.0s
 => => transferring context: 2B                                                                                                                                                                                            0.0s
 => CACHED [1/2] FROM docker.io/bioconductor/bioconductor_docker:latest@sha256:ad30b4df65b18a98dc04a234e270ac0f55c1c72a8feac6f2d8e72973a44b5bd6                                                                            0.0s
 => [2/2] RUN Rscript -e 'if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")' &&   Rscript -e 'remotes::install_cran(c("thisisarandompackagethatdoesnotexist"), repos = "https://cran.rstudio.  0.8s
 => exporting to image                                                                                                                                                                                                     0.1s
 => => exporting layers                                                                                                                                                                                                    0.0s
 => => writing image sha256:127ba9e52bae6895ff3d4a98df7de95c669cadf1e436d874e638d122f4f51782                                                                                                                               0.0s
 => => naming to docker.io/dummycomponent/myscript:latest

Version

Possible solution

I think the exit code from the build is not propagated.

Confirmation

Additional context

No response

Grifs commented 4 days ago

Seems like a duplicate of #629

DriesSchaumont commented 4 days ago

Seems like a duplicate of #629

It is I think! I looked through the items listed as bugs, but #629 seems to be labeled as a feature