At work, I’ve been attempting to setup a CI build for a R project. We have private packages and run a company private CRAN repository, backed by JFrog Artifactory. In order to pull from the private CRAN repository, the repo uses HTTP basic authentication, so the URL looks like this:
https://${repo_user}:${repo_password}@mycran.example.com/additional/paths
According to the Travis-CI docs, I’ve added it to the repo
section in the .travis.yml
file:
repo:
mycran: https://${repo_user}:${repo_password}@mycran.example.com/additional/paths
I’ve set the repo_user
and repo_password
as Environment Variables (password is secured). When a build runs, I get the following error (real repo url redacted):
$ Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages()), collapse=", ")); q(status = 1, save = "no")}'
R6 (2.4.1 -> 2.5.0 ) [CRAN]
digest (0.6.26 -> 0.6.27) [CRAN]
Installing 2 packages: R6, digest
Installing packages into ‘/home/travis/R/Library’
(as ‘lib’ is unspecified)
Error: (converted from warning) unable to access index for repository https://${repo_user}:${repo_password}@mycran.example.com/additional/paths/src/contrib:
cannot open URL 'https://${repo_user}:${repo_password}@mycran.example.com/additional/paths/src/contrib/PACKAGES'
Execution halted
Using debug mode and examining .Rprofile.site
, I see:
cat ~/.Rprofile.site
options(repos = c(CRAN = "https://cloud.r-project.org", mycran = "https://${repo_user}:${repo_password}@mycran.example.com/additional/paths"))
Whereas I think the Environment Variables should’ve been substituted when converting from .travis.yml
to ~/.Rprofile.site
, or perhaps .Rprofile.site
needs to read in all the Environment Variables.
I have a simple work around, but wanted to see if this was a bug or the currently expected behavior. IMHO, for the travis.yml writer, it makes more sense to do the substitution.
Thanks ahead for your time!