From 0085530ac25a42098fcefe1e3aa13d702704d40c Mon Sep 17 00:00:00 2001 From: Sean Talts Date: Wed, 16 Jan 2019 16:18:40 -0500 Subject: [PATCH 1/7] Try using Docker --- Dockerfile | 6 ++++++ Jenkinsfile | 19 ++++--------------- 2 files changed, 10 insertions(+), 15 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..dddc1895a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM rocker/r-base + +RUN R -e 'install.packages("devtools", repos = "https://cran.r-project.org")' +RUN R -e 'update(devtools::package_deps("rstan"), repos = "https://cran.r-project.org")' +RUN R -e 'install.packages("RInside", repos = "https://cran.r-project.org")' + diff --git a/Jenkinsfile b/Jenkinsfile index dbe55f0d5..f37b0fa47 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,20 +1,12 @@ pipeline { - agent any + agent { dockerfile true } + environment { + MAKEFLAGS="-j${env.PARALLEL}" + } stages { - stage('Install dependencies') { - steps { - sh """ - export MAKEFLAGS=-j${env.PARALLEL} - R -e 'install.packages("devtools", repos = "https://cran.r-project.org")' - R -e 'update(devtools::package_deps("rstan"), repos = "https://cran.r-project.org")' - R -e 'install.packages("RInside", repos = "https://cran.r-project.org")' - """ - } - } stage('Build') { steps { sh """ - export MAKEFLAGS=-j${env.PARALLEL} cd StanHeaders git submodule update --init --recursive --remote cd .. @@ -26,7 +18,6 @@ pipeline { stage("Check timings and output") { steps { sh """ - export MAKEFLAGS=-j${env.PARALLEL} R CMD check --as-cran --timings StanHeaders_*.tar.gz || \ cat StanHeaders.Rcheck/00check.log R CMD INSTALL StanHeaders_*.tar.gz @@ -38,7 +29,6 @@ pipeline { stage("Check additional unit tests") { steps { sh """ - export MAKEFLAGS=-j${env.PARALLEL} R CMD INSTALL rstan_*.tar.gz cd rstan make test-R || echo "extra unit tests failed" @@ -49,7 +39,6 @@ pipeline { stage("Check rstanarm") { steps { sh """ - export MAKEFLAGS=-j${env.PARALLEL} R -e 'update(devtools::package_deps("rstanarm"), repos = "https://cran.r-project.org")' wget -Nc https://cran.r-project.org/src/contrib/rstanarm_2.17.4.tar.gz R CMD check --as-cran --timings --run-donttest --run-dontrun rstanarm_*.tar.gz || \ From e778c7131784d56043aa5000b57df5a15f258a0b Mon Sep 17 00:00:00 2001 From: Sean Talts Date: Wed, 16 Jan 2019 16:25:55 -0500 Subject: [PATCH 2/7] Docker agents can't access environment variables, for some reason --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f37b0fa47..107c465a6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,10 @@ pipeline { agent { dockerfile true } - environment { - MAKEFLAGS="-j${env.PARALLEL}" - } stages { stage('Build') { steps { sh """ + export MAKEFLAGS=-j${env.PARALLEL} cd StanHeaders git submodule update --init --recursive --remote cd .. @@ -18,6 +16,7 @@ pipeline { stage("Check timings and output") { steps { sh """ + export MAKEFLAGS=-j${env.PARALLEL} R CMD check --as-cran --timings StanHeaders_*.tar.gz || \ cat StanHeaders.Rcheck/00check.log R CMD INSTALL StanHeaders_*.tar.gz @@ -29,6 +28,7 @@ pipeline { stage("Check additional unit tests") { steps { sh """ + export MAKEFLAGS=-j${env.PARALLEL} R CMD INSTALL rstan_*.tar.gz cd rstan make test-R || echo "extra unit tests failed" @@ -39,6 +39,7 @@ pipeline { stage("Check rstanarm") { steps { sh """ + export MAKEFLAGS=-j${env.PARALLEL} R -e 'update(devtools::package_deps("rstanarm"), repos = "https://cran.r-project.org")' wget -Nc https://cran.r-project.org/src/contrib/rstanarm_2.17.4.tar.gz R CMD check --as-cran --timings --run-donttest --run-dontrun rstanarm_*.tar.gz || \ From 79679402f93e307a984b81a8f02e3c26fab8aa0f Mon Sep 17 00:00:00 2001 From: Sean Talts Date: Wed, 16 Jan 2019 16:28:04 -0500 Subject: [PATCH 3/7] Docker image needs openssl to install devtools --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dddc1895a..090f6345a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM rocker/r-base +RUN apt-get install libssl-dev RUN R -e 'install.packages("devtools", repos = "https://cran.r-project.org")' RUN R -e 'update(devtools::package_deps("rstan"), repos = "https://cran.r-project.org")' RUN R -e 'install.packages("RInside", repos = "https://cran.r-project.org")' - From b2b671f29721f59b88eebb0ddebf0e558bb5064c Mon Sep 17 00:00:00 2001 From: Sean Talts Date: Wed, 16 Jan 2019 16:30:49 -0500 Subject: [PATCH 4/7] Try updating first? --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 090f6345a..58d16a7f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ -FROM rocker/r-base +FROM r-base -RUN apt-get install libssl-dev +RUN apt-get update \ + && apt-get install -y --no-install-recommends libssl-dev RUN R -e 'install.packages("devtools", repos = "https://cran.r-project.org")' RUN R -e 'update(devtools::package_deps("rstan"), repos = "https://cran.r-project.org")' RUN R -e 'install.packages("RInside", repos = "https://cran.r-project.org")' From 00e98e4e0d2f08438a1d43ef63c2ffe94ae7ca7d Mon Sep 17 00:00:00 2001 From: Sean Talts Date: Wed, 16 Jan 2019 16:39:32 -0500 Subject: [PATCH 5/7] Also needs libcurl dev --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 58d16a7f5..80edfa192 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ FROM r-base RUN apt-get update \ - && apt-get install -y --no-install-recommends libssl-dev + && apt-get install -y --no-install-recommends \ + libssl-dev \ + libcurl4-openssl-dev RUN R -e 'install.packages("devtools", repos = "https://cran.r-project.org")' RUN R -e 'update(devtools::package_deps("rstan"), repos = "https://cran.r-project.org")' RUN R -e 'install.packages("RInside", repos = "https://cran.r-project.org")' From c69b9d0d9bcceb40523c4c915a9a410a597f2e30 Mon Sep 17 00:00:00 2001 From: Sean Talts Date: Wed, 16 Jan 2019 16:59:01 -0500 Subject: [PATCH 6/7] Try using devtools to install rstan dependencies --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 80edfa192..0aa28fb42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,5 @@ RUN apt-get update \ libssl-dev \ libcurl4-openssl-dev RUN R -e 'install.packages("devtools", repos = "https://cran.r-project.org")' -RUN R -e 'update(devtools::package_deps("rstan"), repos = "https://cran.r-project.org")' +RUN R -e 'devtools::install_dev_deps("rstan", repos = "https://cran.r-project.org")' RUN R -e 'install.packages("RInside", repos = "https://cran.r-project.org")' From e000eedd2e1c4efb44ad278f180915c1e0d25460 Mon Sep 17 00:00:00 2001 From: Sean Talts Date: Wed, 16 Jan 2019 17:17:08 -0500 Subject: [PATCH 7/7] an rstan dependency needs more ubuntu packages --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0aa28fb42..1f6a35c86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,8 @@ RUN apt-get update \ libssl-dev \ libcurl4-openssl-dev RUN R -e 'install.packages("devtools", repos = "https://cran.r-project.org")' +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libxml2-dev RUN R -e 'devtools::install_dev_deps("rstan", repos = "https://cran.r-project.org")' RUN R -e 'install.packages("RInside", repos = "https://cran.r-project.org")'