exasol / script-languages-release

Release Repository for Script Language Container for user defined functions (UDF's) that can be used in the EXASOL database.
https://docs.exasol.com/database_concepts/udf_scripts.htm
GNU General Public License v3.0
9 stars 5 forks source link

exaslct does not throw an error when it fails to install an R package #772

Open tomuben opened 1 year ago

tomuben commented 1 year ago

Steps to reproduce

  1. Use a flavor with R3.4.4 (standard 7.x flavor)
  2. Add Hmisc R pkg to flavor_customization/packages/r_cran_packages
  3. Run build command: exaslct build --flavor-path ./flavors/standard-EXASOL-7.1.0 -> builds the image without errors
  4. Login to the built docker image and execute R, then library(Hmisc) -> Observe
tkilias commented 1 year ago

The reason for this bug is that the package installation of R doesn't fail when packages can't be installed. It only shows it in the logs, which can't be easily searched. There are potentially a few options to solve this issue.

Some discussion regarding this issue: https://stackoverflow.com/questions/26244530/how-do-i-make-install-packages-return-an-error-if-an-r-package-cannot-be-install

  1. We could try to catch warnings thrown by R.
  2. We could check if all packages were installed with available.packages() after the install.package() function returned
  3. We check if we can load the package with library(package)
  4. We could write integration tests for the packages.

The first solution doesn't guarantee to find all issues during installation, but would fail fast. The second one only guarantees that the package was installed, but not that it is loadable. The third one guarantees that a package is loadable, but not that it works.

I suggest implementing 1. and 2. as part of the installation script and 3. and 4. for important packages.

tkilias commented 1 year ago

Maybe option 3 can also be automated, but we probably should use the list of installed.packages() instead our list, in case packages get installed from a Github repository

tkilias commented 1 year ago

Acceptance Criteria