-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
38 lines (37 loc) · 1.33 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
// Template Jenkinsfile for R CI/CD Tasks
// url: https://github.com/INWT/inwt-templates/blob/master/jenkins/r-ci.Jenkinsfile
// Author: Sebastian Warnholz
pipeline {
agent any
options { disableConcurrentBuilds() }
environment {
CUR_PROJ = 'plotr' // github repo name
CUR_PKG_FOLDER = '.' // defaults to root
TMP_SUFFIX = """${sh(returnStdout: true, script: 'echo `cat /dev/urandom | tr -dc \'a-z\' | fold -w 6 | head -n 1`')}"""
GH_TOKEN = credentials("github-isomemo")
}
stages {
stage('Testing') {
steps {
sh '''
docker build --pull -t tmp-$CUR_PROJ-$TMP_SUFFIX $CUR_PKG_FOLDER
docker run --rm --network host tmp-$CUR_PROJ-$TMP_SUFFIX check
docker rmi tmp-$CUR_PROJ-$TMP_SUFFIX
'''
}
}
stage('Deploy R-package') {
when { branch 'main' }
steps {
sh '''
curl https://raw.githubusercontent.com/Pandora-IsoMemo/drat/main/deploy.sh > deploy.sh
# Expects environment variables:
# CUR_PROJ
# TMP_SUFFIX
# GH_TOKEN_PSW -- a GitHub personal access token with write access to the drat repo
bash deploy.sh
'''
}
}
}
}