Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
demo-infra-jenkins-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
demo
demo-infra-jenkins-test
Commits
29875801
Commit
29875801
authored
Apr 21, 2020
by
João Lino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial Jenkins file to build pom projects.
parent
b3b9e215
Pipeline
#2
failed with stages
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
984 additions
and
6 deletions
+984
-6
Jenkinsfile
Jenkinsfile
+104
-6
pom.xml
pom.xml
+880
-0
No files found.
Jenkinsfile
View file @
29875801
pipeline
{
environment
{
BRANCH_TO_DEPLOY
=
"master"
}
agent
none
parameters
{
booleanParam
(
name:
'SNYK_TEST'
,
defaultValue:
true
,
description:
'Do you want to run Snyk tests?'
)
booleanParam
(
name:
'RELEASE_INPUT'
,
defaultValue:
false
,
description:
'Do you want to release this version? (Only relevant if branch is master or release/*)'
)
}
options
{
timeout
(
time:
1
,
unit:
'HOURS'
)
buildDiscarder
(
logRotator
(
numToKeepStr:
'10'
,
artifactNumToKeepStr:
'3'
)
)
ansiColor
(
'xterm'
)
}
triggers
{
cron
(
'@weekly'
)
}
stages
{
stage
(
'Checkout'
)
{
agent
{
label
'docker'
}
steps
{
checkout
scm
sh
'git fetch --prune --tags'
}
}
stage
(
'Verify'
)
{
agent
{
label
'docker'
}
steps
{
sh
'mvn clean verify'
}
}
stage
(
'Snyk test'
)
{
agent
{
label
'docker'
}
when
{
expression
{
return
params
.
SNYK_TEST
}
}
steps
{
sh
'mvn snyk:test'
}
}
stage
(
'Deploy'
)
{
agent
{
label
'docker'
}
when
{
branch
"${BRANCH_TO_DEPLOY}"
anyOf
{
branch
'master'
branch
pattern:
'release/*'
}
not
{
expression
{
return
params
.
RELEASE_INPUT
}
}
}
steps
{
sh
'mvn deploy'
}
}
stage
(
'Snyk monitor'
)
{
agent
{
label
'docker'
}
when
{
anyOf
{
branch
'master'
branch
pattern:
'release/*'
}
expression
{
return
params
.
SNYK_TEST
}
}
steps
{
sh
'mvn snyk:monitor'
}
}
stage
(
'Release'
)
{
agent
{
label
'docker'
}
when
{
allOf
{
anyOf
{
branch
'master'
branch
pattern:
'release/*'
}
expression
{
return
params
.
RELEASE_INPUT
}
}
}
environment
{
RELEASE_VERSION
=
sh
(
returnStdout:
true
,
script:
'mvn help:evaluate -Dexpression=project.version -q -DforceStdout'
).
trim
().
replace
(
'-SNAPSHOT'
,
''
)
}
steps
{
// Just get helm3 for testing
sh
'wget https://get.helm.sh/helm-v3.0.3-linux-amd64.tar.gz https://get.helm.sh/helm-v3.0.3-linux-amd64.tar.gz.sha256'
sh
"git checkout ${BRANCH_NAME}"
sh
'mvn release:prepare release:perform -V'
script
{
currentBuild
.
description
=
"Release ${RELEASE_VERSION}"
currentBuild
.
keepLog
=
true
}
}
}
}
...
...
pom.xml
0 → 100644
View file @
29875801
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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