Reference Internal R Package in DESCRIPTION That is Hosted on Azure DevOps via Remotes

Hello RStudio Community!

We have our internal R Packages hosted on Azure DevOps. This package has utility functions that we commonly use across projects. Naturally, we want to add our package to Imports in the DESCRIPTION file.

We have Azure Pipelines set up that will check the package, run testthat, and run code coverage. The pipeline (this is using Jim Hester's azure-pipelines btw) builds a fresh R environment and installs all the dependencies. Since our internal package is not on CRAN this step will throw an error.

I tried to explore how to use the Remotes field in the DESCRIPTION file but have not been very successful. I see many great examples for GitLab, Bitbucket, etc. I was wondering if anyone knows of a way to reference our repo on Azure DevOps using this method.

Or if there is another way to get around the install dependency error that would be great to! :slight_smile:

I forgot to add the page I have been referencing!

https://cran.r-project.org/web/packages/devtools/vignettes/dependencies.html

Either of these should work, assuming your ADO repo uses git; just substitute your repo's URL. If your repo is private, you'll need to add authentication details: see this link for more info.

# Git
Remotes: git::git@bitbucket.org:djnavarro/lsr.git

# URL
Remotes: url::https://github.com/hadley/stringr/archive/master.zip
1 Like

I have tried a few different things with the exampels you provided but I am still not understanding something. Here is what i have in my DESCRIPTION file:

Remotes: git::https://myCompany@dev.azure.com/myCompany/myPackage/_git/myPackage

This is a private repo, however, this is strictly for Azure Pipelines where it is all contained in my companies ADO/organization. When I check the logs of the pipeline it fails on this line of code and shows the following output in the log.

pkg-install_dependencies.yml:

steps:
  - bash: |
      Rscript -e "install.packages(c('remotes', 'devtools', 'rcmdcheck', 'testthat'))"
      Rscript -e "remotes::install_deps(dependencies = TRUE)"
    displayName: 'Install package dependencies'

ADO log:

The downloaded source packages are in
	‘/tmp/RtmprbktV8/downloaded_packages’
NA         (NA -> NA    ) [Git]
dplyr      (NA -> 1.0.0 ) [CRAN]
furrr      (NA -> 0.1.0 ) [CRAN]
future     (NA -> 1.17.0) [CRAN]
lubridate  (NA -> 1.7.9 ) [CRAN]
tictoc     (NA -> 1.0   ) [CRAN]
tidyr      (NA -> 1.1.0 ) [CRAN]
globals    (NA -> 0.12.5) [CRAN]
listenv    (NA -> 0.8.0 ) [CRAN]
generics   (NA -> 0.0.2 ) [CRAN]
tidyselect (NA -> 1.1.0 ) [CRAN]
Skipping 1 packages not available: myPackage
Error: Failed to install 'unknown package' from Git:
  Error in 'git2r_remote_ls'
In addition: Warning message:
In git2r::remote_ls(remote$url, credentials = remote$credentials) :
  Error in 'git2r_remote_ls'

Execution halted

##[error]Bash exited with code '1'.
Finishing: Install package dependencies

Note; I changed the actual package name to myPackage above

I see that it does not understand that I want to install my internal package from my companies organization. Does it need credentials while it's still within my companies organization? Am I declaring the URL in the DESCRIPTION file correctly?

I appreciate the help, working with ADO has been an uphill battle :grimacing: