Projet

Général

Profil

0001-create-jenkins-pipeline-job-23431.patch

Emmanuel Cazenave, 26 avril 2018 19:11

Télécharger (3,51 ko)

Voir les différences:

Subject: [PATCH] create jenkins pipeline job (#23431)

 Jenkinsfile | 34 ++++++++++++++++++++++++++++++++++
 get_wcs.sh  |  4 ++++
 jenkins.sh  | 13 -------------
 pylint.sh   |  3 ---
 tox.ini     | 11 ++++++-----
 5 files changed, 44 insertions(+), 21 deletions(-)
 create mode 100644 Jenkinsfile
 create mode 100755 get_wcs.sh
 delete mode 100755 jenkins.sh
Jenkinsfile
1
@Library('eo-jenkins-lib@master') import eo.Utils
2

  
3
pipeline {
4
    agent any
5
    stages {
6
        stage('Unit Tests') {
7
            steps {
8
                sh 'tox -rv'
9
            }
10
        }
11
        stage('Packaging') {
12
            steps {
13
                script {
14
                    if (env.BRANCH_NAME == 'master') {
15
                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d jessie,stretch combo'
16
                    }
17
                }
18
            }
19
        }
20
    }
21
    post {
22
        always {
23
            junit '*_results.xml'
24
            script {
25
                utils = new Utils()
26
                utils.publish_coverage('coverage.xml')
27
                utils.publish_coverage_native('index.html')
28
                utils.publish_pylint('pylint.out')
29
                utils.mail_notify(currentBuild, env, 'admin+jenkins-combo@entrouvert.com')
30
            }
31
            cleanWs()
32
        }
33
    }
34
}
get_wcs.sh
1
#!/bin/sh -xue
2

  
3
test -d wcs || git clone http://git.entrouvert.org/wcs.git
4
(cd wcs && git pull)
jenkins.sh
1
#!/bin/sh
2

  
3
set -e
4

  
5
rm -f pylint.out
6
rm -f coverage.xml
7
rm -f test_results.xml
8

  
9
test -d wcs || git clone http://git.entrouvert.org/wcs.git
10
(cd wcs && git pull)
11

  
12
pip install --upgrade tox
13
tox -rv
pylint.sh
10 10
	echo No pylint RC found
11 11
	exit 0
12 12
fi
13

  
14
test -f pylint.out && cp pylint.out pylint.out.prev
15 13
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
16
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
tox.ini
1 1
[tox]
2
envlist = coverage-{django18,django111}-pylint
3
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/
2
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/{env:BRANCH_NAME:}
3
envlist = django{18,111}
4 4

  
5 5
[testenv]
6 6
usedevelop = True
......
8 8
  WCSCTL=wcs/wcsctl.py
9 9
  DJANGO_SETTINGS_MODULE=combo.settings
10 10
  COMBO_SETTINGS_FILE=tests/settings.py
11
  coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=combo/
12 11
deps =
13 12
  django18: django>=1.8,<1.9
14 13
  django111: django>=1.11,<1.12
......
24 23
  quixote<3.0
25 24
  vobject
26 25
commands =
27
  py.test {env:COVERAGE:} {posargs:tests/}
28
  pylint: ./pylint.sh combo/
26
  ./get_wcs.sh
27
  django18: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=combo/ tests/}
28
  django18: ./pylint.sh combo/
29
  django111: py.test {posargs: --junitxml=test_{envname}_results.xml tests/}
29
-