Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Deploytoprod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "hello I'm on prod"
64 changes: 36 additions & 28 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
node {
def app

stage('Clone repository') {


checkout scm
pipeline {
agent any
parameters {
choice(choices: 'staging\nproduction', description: 'Which environment?', name: 'ENVIRONMENT')
}

stage('Build image') {

app = docker.build("raj80dockerid/test")
environment {
GIT_TAG = sh(returnStdout: true, script: 'git describe --always').trim()
}

stage('Test image') {


app.inside {
sh 'echo "Tests passed"'
stages {
stage("Checkout") {
steps {
checkout scm
}
}
}

stage('Push image') {

docker.withRegistry('https://registry.hub.docker.com', 'dockerhub') {
app.push("${env.BUILD_NUMBER}")
stage("Test") {
steps {
sh('chmod 777 run_all_tests.sh ')
sh('./run_all_tests.sh')
}
}
}

stage('Trigger ManifestUpdate') {
echo "triggering updatemanifestjob"
build job: 'updatemanifest', parameters: [string(name: 'DOCKERTAG', value: env.BUILD_NUMBER)]
stage("Deploy to Staging") {
when {
buildingTag()
environment name: 'ENVIRONMENT', value: 'staging'
}
steps {
sh('chmod 777 build_and_publish.sh')
sh('./build_and_publish.sh')
}
}
stage("Deploy to Production") {
when {
buildingTag()
environment name: 'ENVIRONMENT', value: 'production'
}
steps {
sh('chmod 777 Deploytoprod.sh')
sh('./Deploytoprod.sh')
}
}
}
}
34 changes: 34 additions & 0 deletions Jenkinsfile.back
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
node {
def app

stage('Clone repository') {


checkout scm
}

stage('Build image') {

app = docker.build("nikita1239/pro11")
}

stage('Test image') {


app.inside {
sh 'echo "Tests passed"'
}
}

stage('Push image') {

docker.withRegistry('https://registry.hub.docker.com', 'dockerhub') {
app.push("${env.BUILD_NUMBER}")
}
}

stage('Trigger ManifestUpdate') {
echo "triggering updatemanifestjob"
build job: 'updatemanifest', parameters: [string(name: 'DOCKERTAG', value: env.BUILD_NUMBER)]
}
}
2 changes: 2 additions & 0 deletions build_and_publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "hello from build and push script Deploy to stage"
2 changes: 2 additions & 0 deletions run_all_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "hello I'm testing here"