Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bonita
bonita-continuous-delivery-doc
Commits
58d82e76
Unverified
Commit
58d82e76
authored
Dec 07, 2017
by
Truc Nguyen
Committed by
GitHub
Dec 07, 2017
Browse files
feat(build): add Jenkinsfile (#13)
parent
a10a97f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Jenkinsfile
0 → 100644
View file @
58d82e76
#
!
/usr/
bin
/
env
groovy
boolean
isVersionSupported
(
version
,
supportedVersions
)
{
def
result
=
false
for
(
supported
in
supportedVersions
.
tokenize
(
','
))
{
if
(
supported
==
version
)
{
result
=
true
break
}
}
def
status
=
result
?
'supported'
:
'NOT supported'
println
"Version <$version> is $status on this environment."
return
result
}
node
{
stage
'Checkout'
def
branch_name
=
env
.
BRANCH_NAME
println
"Checking out branch $branch_name"
checkout
scm
stage
'Build'
def
nodejsHome
=
tool
name:
'NodeJS_424'
,
type:
'com.cloudbees.jenkins.plugins.customtools.CustomTool'
sh
"""#!/bin/bash
set -e
env | sort -u
echo "### Cleaning previous build (except index.html)"
shopt -s extglob
rm -rf build
echo ""
echo "### Converting .md to .html"
PATH=\$PATH:${nodejsHome}/bin
npm install
scripts/convertMdToHtml.js bcd
scripts/taxonomy.js
echo ""
echo "### Creating doc html archive"
archive_name=doc-bcd-html-\$BRANCH_NAME-`date +"%Y%m%d_%H%M%S"`.tar.gz
rm -rf doc-bcd-html*.tar.gz doc-bcd-html
mkdir doc-bcd-html && ln -s ../build/html doc-bcd-html/html && ln -s ../md/images doc-bcd-html/images
tar czf \$archive_name --dereference doc-bcd-html
echo ". Generated archive: \$archive_name"
echo ""
echo "Done."
"""
stage
'Archive'
archive
'**/doc-bcd-html*.tar.gz'
stage
'Deploy'
parallel
preprod:
{
if
(
isVersionSupported
(
branch_name
,
env
.
GLOBAL_PREPROD_BCD_VERSIONS
))
{
build
job:
'push-content-preprod'
,
parameters:
[[
$class
:
'StringParameterValue'
,
name:
'ARE_YOU_SURE'
,
value:
'Yes'
]]
}
},
prod:
{
if
(
isVersionSupported
(
branch_name
,
env
.
GLOBAL_PROD_BCD_VERSIONS
))
{
build
job:
'push-content-prod'
,
parameters:
[[
$class
:
'StringParameterValue'
,
name:
'ARE_YOU_SURE'
,
value:
'Yes'
]]
}
},
failFast:
false
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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