Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DevOps Assignment
frontend
Commits
e3a5e5f4
Commit
e3a5e5f4
authored
1 year ago
by
Muhammad Suleman
Browse files
Options
Downloads
Patches
Plain Diff
Update Jenkinsfile
parent
30ed8e82
Branches
QA
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Jenkinsfile
+7
-6
7 additions, 6 deletions
Jenkinsfile
with
7 additions
and
6 deletions
Jenkinsfile
+
7
−
6
View file @
e3a5e5f4
...
@@ -17,13 +17,13 @@ pipeline {
...
@@ -17,13 +17,13 @@ pipeline {
echo
branchName
;
echo
branchName
;
if
(
branchName
==
'dev'
)
{
if
(
branchName
==
'dev'
)
{
imageName
=
'sulemantalpur6/frontend:dev'
imageName
=
'sulemantalpur6/frontend:dev
${BUILD_NUMBER}
'
}
else
if
(
branchName
==
'master'
)
{
}
else
if
(
branchName
==
'master'
)
{
imageName
=
'sulemantalpur6/frontend:master'
imageName
=
'sulemantalpur6/frontend:master
${BUILD_NUMBER}
'
}
else
if
(
branchName
==
'QA'
)
{
}
else
if
(
branchName
==
'QA'
)
{
imageName
=
'sulemantalpur6/frontend:QA'
imageName
=
'sulemantalpur6/frontend:QA
${BUILD_NUMBER}
'
}
else
if
(
branchName
==
'UAT'
)
{
}
else
if
(
branchName
==
'UAT'
)
{
imageName
=
'sulemantalpur6/frontend:UAT'
imageName
=
'sulemantalpur6/frontend:UAT
${BUILD_NUMBER}
'
}
else
{
}
else
{
echo
"Branch $branchName not configured for Docker image build."
echo
"Branch $branchName not configured for Docker image build."
currentBuild
.
result
=
'FAILURE'
currentBuild
.
result
=
'FAILURE'
...
@@ -40,12 +40,13 @@ pipeline {
...
@@ -40,12 +40,13 @@ pipeline {
stage
(
'Push Docker Image to Docker Hub'
)
{
stage
(
'Push Docker Image to Docker Hub'
)
{
steps
{
steps
{
script
{
script
{
def
branchName
=
currentBuild
.
displayName
def
branchName
=
BRANCH_NAME
def
buildNumber
=
BUILD_NUMBER
if
(
branchName
==
'dev'
||
branchName
==
'master'
||
branchName
==
'QA'
||
branchName
==
'UAT'
)
{
if
(
branchName
==
'dev'
||
branchName
==
'master'
||
branchName
==
'QA'
||
branchName
==
'UAT'
)
{
withCredentials
([
usernamePassword
(
credentialsId:
'dockerHub'
,
usernameVariable:
'DOCKER_HUB_USERNAME'
,
passwordVariable:
'DOCKER_HUB_PASSWORD'
)])
{
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 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.
Preview
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