diff --git a/R/tasks/r-installation.yml b/R/tasks/r-installation.yml index f7fef96..1340978 100644 --- a/R/tasks/r-installation.yml +++ b/R/tasks/r-installation.yml @@ -48,9 +48,9 @@ when: r_plugins_from_sources is defined tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] -- name: Install R packages from the cran sources repo, latest available version. First try +- name: Install R packages from the cran sources repo or from an alternative repository, latest available version. First try command: > - Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item }}', repos=c('{{ r_cran_mirror_site }}/')); print('Added'); } else { print('Already installed'); }" + Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item.name }}', repos=c('{{ item.repo | default ('https://cloud.r-project.org') }}/')); print('Added'); } else { print('Already installed'); }" register: install_plugins_result failed_when: "install_plugins_result.rc != 0 or 'had non-zero exit status' in install_plugins_result.stderr" changed_when: "'Added' in install_plugins_result.stdout" @@ -86,9 +86,9 @@ when: r_plugins_install_specific_source tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] -- name: Install R packages from the cran sources repo, latest available version. Second try +- name: Install R packages from the cran sources repo or from an alternative repository, latest available version. Second try command: > - Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item }}', repos=c('{{ r_cran_mirror_site }}/')); print('Added'); } else { print('Already installed'); }" + Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item.name }}', repos=c('{{ item.repo | default ('https://cloud.r-project.org') }}/')); print('Added'); } else { print('Already installed'); }" register: install_plugins_result failed_when: "install_plugins_result.rc != 0 or 'had non-zero exit status' in install_plugins_result.stderr" changed_when: "'Added' in install_plugins_result.stdout"