-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
41 lines (37 loc) · 1.35 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Template Jenkinsfile for R CI/CD Tasks
// Author: Sebastian Warnholz
pipeline {
agent none
options { disableConcurrentBuilds() }
environment {
CUR_PROJ = 'ggcorpident' // github repo name
CUR_PKG = 'ggCorpIdent' // r-package name
CUR_PKG_FOLDER = '.' // defaults to root
}
stages {
stage('Testing with R-3.5.1') {
agent { label 'test' }
when { not { branch 'depl' } }
steps {
sh '''
docker build --pull -t tmp-$CUR_PROJ .
docker run --rm --network host tmp-$CUR_PROJ check
docker rmi tmp-$CUR_PROJ
'''
}
}
stage('Deploy R-package') {
agent { label 'eh2' }
when { branch 'master' }
steps {
sh '''
rm -vf *.tar.gz
docker build --pull -t tmp-$CUR_PROJ .
docker run --rm --network host -v $PWD:/app --user `id -u`:`id -g` tmp-$CUR_PROJ R CMD build .
docker rmi tmp-$CUR_PROJ
R -e "drat::insertPackage('`echo $CUR_PKG`_`grep -E '^Version:[ \t]*[0-9.]{3,10}' $CUR_PKG_FOLDER/DESCRIPTION | awk '{print $2}'`.tar.gz', '/var/www/html/r-repo'); drat::archivePackages(repopath = '/var/www/html/r-repo')"
'''
}
}
}
}