Skip to content

Commit

Permalink
new Jenkins app ayushiee#2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhei2023 committed Aug 5, 2024
1 parent 69ff691 commit 127cba0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 30 deletions.
26 changes: 11 additions & 15 deletions pipelines/build-dev.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pipeline {
}

options {
timeout(time: 10, unit: 'MINUTES')
timestamps()
timeout(time: 10, unit: 'MINUTES') // discard the build after 10 minutes of running
timestamps() // display timestamp in console output
}

environment {
Expand All @@ -30,26 +30,22 @@ pipeline {
}
}

stage('Build & Push') {
stage('Build app container') {
steps {
script {
def IMAGE_FULL_NAME = "${DOCKER_USERNAME}/${IMAGE_BASE_NAME}:${IMAGE_TAG}"
sh """
docker build -t ${IMAGE_FULL_NAME} .
docker push ${IMAGE_FULL_NAME}
"""
env.IMAGE_FULL_NAME = IMAGE_FULL_NAME
}
sh '''
IMAGE_FULL_NAME=$DOCKER_USERNAME/$IMAGE_BASE_NAME:$IMAGE_TAG
docker build -t $IMAGE_FULL_NAME .
docker push $IMAGE_FULL_NAME
'''
}
}

stage('Trigger Deploy') {
steps {
build job: 'netflixdev', wait: false, parameters: [
build job: 'NetflixDeployDev', wait: false, parameters: [
string(name: 'SERVICE_NAME', value: "NetflixFrontend"),
string(name: 'IMAGE_FULL_NAME_PARAM', value: "${env.IMAGE_FULL_NAME}")
string(name: 'IMAGE_FULL_NAME_PARAM', value: "$DOCKER_USERNAME/$IMAGE_BASE_NAME:$IMAGE_TAG")
]
}
}
}
}
}
26 changes: 11 additions & 15 deletions pipelines/build-prod.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pipeline {
}

options {
timeout(time: 10, unit: 'MINUTES')
timestamps()
timeout(time: 10, unit: 'MINUTES') // discard the build after 10 minutes of running
timestamps() // display timestamp in console output
}

environment {
Expand All @@ -30,26 +30,22 @@ pipeline {
}
}

stage('Build & Push') {
stage('Build app container') {
steps {
script {
def IMAGE_FULL_NAME = "${DOCKER_USERNAME}/${IMAGE_BASE_NAME}:${IMAGE_TAG}"
sh """
docker build -t ${IMAGE_FULL_NAME} .
docker push ${IMAGE_FULL_NAME}
"""
env.IMAGE_FULL_NAME = IMAGE_FULL_NAME
}
sh '''
IMAGE_FULL_NAME=$DOCKER_USERNAME/$IMAGE_BASE_NAME:$IMAGE_TAG
docker build -t $IMAGE_FULL_NAME .
docker push $IMAGE_FULL_NAME
'''
}
}

stage('Trigger Deploy') {
steps {
build job: 'netflixprod', wait: false, parameters: [
build job: 'NetflixDeployProd', wait: false, parameters: [
string(name: 'SERVICE_NAME', value: "NetflixFrontend"),
string(name: 'IMAGE_FULL_NAME_PARAM', value: "${env.IMAGE_FULL_NAME}")
string(name: 'IMAGE_FULL_NAME_PARAM', value: "$DOCKER_USERNAME/$IMAGE_BASE_NAME:$IMAGE_TAG")
]
}
}
}
}
}

0 comments on commit 127cba0

Please sign in to comment.