Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
centreon
centreon-widget-global-health
Commits
edca3374
Commit
edca3374
authored
Jun 16, 2020
by
Matthieu Kermagoret
Browse files
feat(build): add Jenkinsfile.
parent
fdb7ad8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Jenkinsfile
0 → 100644
View file @
edca3374
/*
** Variables.
*/
properties
([
buildDiscarder
(
logRotator
(
numToKeepStr:
'50'
))])
def
serie
=
'20.10'
def
maintenanceBranch
=
"${serie}.x"
if
(
env
.
BRANCH_NAME
.
startsWith
(
'release-'
))
{
env
.
BUILD
=
'RELEASE'
}
else
if
((
env
.
BRANCH_NAME
==
'master'
)
||
(
env
.
BRANCH_NAME
==
maintenanceBranch
))
{
env
.
BUILD
=
'REFERENCE'
}
else
{
env
.
BUILD
=
'CI'
}
def
featureFiles
=
[]
/*
** Pipeline code.
*/
stage
(
'Source'
)
{
node
{
sh
'setup_centreon_build.sh'
env
.
WIDGET
=
'global-health'
dir
(
"centreon-widget-${env.WIDGET}"
)
{
checkout
scm
}
sh
"./centreon-build/jobs/widgets/${serie}/widget-source.sh"
source
=
readProperties
file:
'source.properties'
env
.
PROJECT
=
"${source.PROJECT}"
env
.
VERSION
=
"${source.VERSION}"
env
.
RELEASE
=
"${source.RELEASE}"
env
.
SUMMARY
=
"${source.SUMMARY}"
publishHTML
([
allowMissing:
false
,
keepAll:
true
,
reportDir:
'summary'
,
reportFiles:
'index.html'
,
reportName:
'Centreon Build Artifacts'
,
reportTitles:
''
])
}
}
try
{
stage
(
'Package'
)
{
parallel
'centos7'
:
{
node
{
sh
'setup_centreon_build.sh'
sh
"./centreon-build/jobs/widgets/${serie}/widget-package.sh centos7"
}
},
'centos8'
:
{
node
{
sh
'setup_centreon_build.sh'
sh
"./centreon-build/jobs/widgets/${serie}/widget-package.sh centos8"
}
}
if
((
currentBuild
.
result
?:
'SUCCESS'
)
!=
'SUCCESS'
)
{
error
(
'Package stage failure.'
);
}
}
if
((
env
.
BUILD
==
'RELEASE'
)
||
(
env
.
BUILD
==
'REFERENCE'
))
{
stage
(
'Delivery'
)
{
node
{
sh
'setup_centreon_build.sh'
sh
"./centreon-build/jobs/widgets/${serie}/widget-delivery.sh"
}
if
((
currentBuild
.
result
?:
'SUCCESS'
)
!=
'SUCCESS'
)
{
error
(
'Delivery stage failure.'
);
}
}
}
}
catch
(
e
)
{
if
((
env
.
BUILD
==
'RELEASE'
)
||
(
env
.
BUILD
==
'REFERENCE'
))
{
slackSend
channel:
"#monitoring-metrology"
,
color:
"#F30031"
,
message:
"*FAILURE*: `CENTREON WIDGET GLOBAL HEALTH` <${env.BUILD_URL}|build #${env.BUILD_NUMBER}> on branch ${env.BRANCH_NAME}\n"
+
"*COMMIT*: <https://github.com/centreon/centreon-widget-global-health/commit/${source.COMMIT}|here> by ${source.COMMITTER}\n"
+
"*INFO*: ${e}"
}
currentBuild
.
result
=
'FAILURE'
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment