Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
user-service
Commits
64886356
Unverified
Commit
64886356
authored
2 years ago
by
Tushar
Committed by
GitHub
2 years ago
Browse files
Options
Download
Patches
Plain Diff
Update Jenkinsfile
parent
6022dcb9
master
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
build/Jenkinsfile
+23
-17
build/Jenkinsfile
with
23 additions
and
17 deletions
+23
-17
build/Jenkinsfile
+
23
−
17
View file @
64886356
node
()
{
node
()
{
properties
([
withCredentials
([
string
(
credentialsId:
'docker_server'
,
variable:
'docker_server'
)])
{
parameters
([
properties
([
string
(
name:
'docker_repo'
,
defaultValue:
'user-service'
,
description:
'Docker Image Name'
),
parameters
([
string
(
name:
'docker_server'
,
defaultValue:
'localhost:5000'
,
description:
'Docker Registry URL'
),
string
(
name:
'docker_repo'
,
defaultValue:
'samagragovernance/esamwad-user-service'
,
description:
'Docker Image Name'
),
string
(
name:
'docker_server'
,
defaultValue:
"$docker_server"
,
description:
'Docker Registry URL'
),
])
])
])
])
}
stage
(
'Checkout'
)
{
stage
(
'Checkout'
)
{
cleanWs
()
cleanWs
()
checkout
scm
checkout
scm
commit_hash
=
sh
(
script:
'git rev-parse --short HEAD'
,
returnStdout:
true
).
trim
()
env
.
commit_id
=
env
.
BRANCH_NAME
env
.
commit_id
=
sh
(
script:
'echo '
+
env
.
docker_repo
+
'_'
+
commit_hash
+
'_'
+
env
.
BRANCH_NAME
,
returnStdout:
true
).
trim
()
echo
"${env.commit_id}"
echo
"${env.commit_id}"
}
}
stage
(
'docker-build'
)
{
stage
(
'docker-build'
)
{
sh
'''
docker build -f build/Dockerfile -t $docker_server/$docker_repo:$commit_id .
'''
if
(
env
.
BRANCH_NAME
==
'main'
||
env
.
BRANCH_NAME
==
'master'
)
{
sh
'''
sh
'''
docker build -f build/Dockerfile -t $docker_server/$docker_repo:$commit_id .
docker build -f build/Dockerfile -t $docker_server/$docker_repo:$commit_id .
'''
'''
}
}
}
stage
(
'docker-push'
)
{
stage
(
'docker-push'
)
{
sh
'''
sh
'''
docker push $docker_server/$docker_repo:$commit_id
docker push $docker_server/$docker_repo:$commit_id
'''
'''
}
if
(
env
.
BRANCH_NAME
==
'main'
||
env
.
BRANCH_NAME
==
'master'
)
{
stage
(
'ArchiveArtifacts'
)
{
sh
'''
sh
(
"echo ${commit_id} > commit_id.txt"
)
docker push $docker_server/$docker_repo:latest
archiveArtifacts
'commit_id.txt
'
''
'
currentBuild
.
description
=
"${commit_id}"
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets