Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps Assignment
frontend
Commits
fec4f85e
You need to sign in or sign up before continuing.
Commit
fec4f85e
authored
1 year ago
by
Muhammad Suleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Jenkinsfile
parent
409cd076
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
Jenkinsfile
Jenkinsfile
+7
-6
No files found.
Jenkinsfile
View file @
fec4f85e
...
...
@@ -17,13 +17,13 @@ pipeline {
echo
branchName
;
if
(
branchName
==
'dev'
)
{
imageName
=
'sulemantalpur6/frontend:dev'
imageName
=
'sulemantalpur6/frontend:dev
-${BUILD_NUMBER}
'
}
else
if
(
branchName
==
'master'
)
{
imageName
=
'sulemantalpur6/frontend:master'
imageName
=
'sulemantalpur6/frontend:master
-${BUILD_NUMBER}
'
}
else
if
(
branchName
==
'QA'
)
{
imageName
=
'sulemantalpur6/frontend:QA'
imageName
=
'sulemantalpur6/frontend:QA
-${BUILD_NUMBER}
'
}
else
if
(
branchName
==
'UAT'
)
{
imageName
=
'sulemantalpur6/frontend:UAT'
imageName
=
'sulemantalpur6/frontend:UAT
-${BUILD_NUMBER}
'
}
else
{
echo
"Branch $branchName not configured for Docker image build."
currentBuild
.
result
=
'FAILURE'
...
...
@@ -40,12 +40,13 @@ pipeline {
stage
(
'Push Docker Image to Docker Hub'
)
{
steps
{
script
{
def
branchName
=
currentBuild
.
displayName
def
branchName
=
BRANCH_NAME
def
buildNumber
=
BUILD_NUMBER
if
(
branchName
==
'dev'
||
branchName
==
'master'
||
branchName
==
'QA'
||
branchName
==
'UAT'
)
{
withCredentials
([
usernamePassword
(
credentialsId:
'dockerHub'
,
usernameVariable:
'DOCKER_HUB_USERNAME'
,
passwordVariable:
'DOCKER_HUB_PASSWORD'
)])
{
sh
"docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD"
sh
"docker push sulemantalpur6/frontend:$branchName"
sh
"docker push sulemantalpur6/frontend:$branchName
$buildNumber
"
}
}
}
...
...
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