-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoodleJenkins
61 lines (59 loc) · 1.67 KB
/
moodleJenkins
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
job('Moodle-new-version') {
parameters {
stringParam('COMMITMSG', 'Commit de test', 'Message pour commit.')
stringParam('BRANCH', 'UQAM_DEV_TEMP', 'Nom de la branche a creer.')
}
wrappers {
credentialsBinding {
usernamePassword('BB_USER', 'BB_PASS', 'uqamena-BB')
}
}
multiscm {
git {
remote {
url('https://bitbucket.org/uqam/auth_saml2.git')
credentials('uqamena-BB')
branch('UQAM_30_DEV')
}
extensions {
cloneOptions {
shallow()
}
cleanAfterCheckout()
relativeTargetDirectory('component/auth/saml2')
}
}
}
steps {
shell('''
# Commencer clean
if [ -d \$WORKSPACE/moodle ]
then
rm -rf \$WORKSPACE/moodle
fi
# Verifier si la branche existe
CLONE_BRANCH=${BRANCH}
FIRST=`git ls-remote --heads https://\$BB_USER:\[email protected]/uqam/moodle.git ${BRANCH} | wc -l `
# Si la branche n'existe pas encore prendre autre
if [ "${FIRST}" -eq 0 ]
then
CLONE_BRANCH='UQAM_30_INT'
fi
git clone --depth 1 --branch ${CLONE_BRANCH} --single-branch [email protected]:uqam/moodle.git \$WORKSPACE/moodle
# auth_saml2
rm -rf \$WORKSPACE/component/auth/saml2/.git
if [ -d \$WORKSPACE/moodle/auth/saml2 ]
rm -rf \$WORKSPACE/moodle/auth/saml2
fi
cp -r \$WORKSPACE/component/auth/saml2 \$WORKSPACE/moodle/auth/saml2
rm -rf \$WORKSPACE/component/auth/saml2
git commit -m "${COMMITMSG}"
git remote add bb https://\$BB_USER:\[email protected]/uqam/moodle.git
if [ "${CLONE_BRANCH}" != "${BRANCH}" ]
then
git checkout -b ${BRANCH}
fi
git push bb ${BRANCH}:${BRANCH}
''')
}
}