3 # Copyright (C) 2016 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 PYTHON_2_ENV
=$WORKSPACE"/.python2_venv"
19 PYTHON_3_ENV
=$WORKSPACE"/.python3_venv"
21 # Prepare JJB python 2 environment
23 if [ ! -d "$PYTHON_2_ENV" ]; then
24 virtualenv
-p python2
$PYTHON_2_ENV
28 .
$PYTHON_2_ENV/bin
/activate
29 pip
install --force-reinstall git
+git
://github.com
/mjeanson
/jenkins-job-builder@ci
32 # Prepare python 3 env
33 if [ ! -d "$PYTHON_3_ENV" ]; then
34 virtualenv
-p python3
$PYTHON_3_ENV
37 .
$PYTHON_3_ENV/bin
/activate
38 pip
install --upgrade gitpython pyyaml
41 # Prepare the configuration file for jjb
42 cp $WORKSPACE/etc
/jenkins_jobs.ini-sample
$WORKSPACE/etc
/jenkins_jobs.ini
44 # Set +x: hide information from the jenkins console log since we use injected
47 sed -i -e "s/user=jenkins/user=$JJB_JENKINS_USER/g" $WORKSPACE/etc
/jenkins_jobs.ini
48 sed -i -e "s/password=1234567890abcdef1234567890abcdef/password=$JJB_JENKINS_TOKEN/g" $WORKSPACE/etc
/jenkins_jobs.ini
52 if [ ! -d "$WORKSPACE/kernel" ]; then
53 git clone git
://artifacts.internal.efficios.com
/git
/linux-stable.git
$WORKSPACE/kernel
55 pushd $WORKSPACE/kernel
56 git fetch
--tags origin
60 # Clean the previous rc
61 # Note: this step is stateful since it use the last generated version.
62 .
$PYTHON_2_ENV/bin
/activate
63 jenkins-jobs
--conf $WORKSPACE/etc
/jenkins_jobs.ini delete
--path $WORKSPACE/jobs
/lttng-modules.yaml
:$WORKSPACE/jobs
/kernel.yaml \
*rc\
*_build
66 # Run the kernel seed generator
67 .
$PYTHON_3_ENV/bin
/activate
68 python
$WORKSPACE/automation
/kernel-seed.py
--kernel-path $WORKSPACE/kernel
--kernel-cutoff 2.6.36 > $WORKSPACE/jobs
/inc
/kernel-versions.yaml.inc
71 .
$PYTHON_2_ENV/bin
/activate
72 jenkins-jobs
--conf $WORKSPACE/etc
/jenkins_jobs.ini update
$WORKSPACE/jobs
/lttng-modules.yaml
:$WORKSPACE/jobs
/kernel.yaml
75 # Flush the configuration file so no one can access it
76 rm -f $WORKSPACE/etc
/jenkins_jobs.ini