Jenkinsfile 2
This commit is contained in:
24
Jenkinsfile
vendored
24
Jenkinsfile
vendored
@@ -1,11 +1,11 @@
|
|||||||
#!groovy
|
#!groovy
|
||||||
|
|
||||||
node {
|
node {
|
||||||
stage('Checkout'){
|
stage('Checkout') {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare
|
stage('Prepare') {
|
||||||
sh 'git rev-parse --verify HEAD > GIT_COMMIT'
|
sh 'git rev-parse --verify HEAD > GIT_COMMIT'
|
||||||
env.GIT_COMMIT = readFile('GIT_COMMIT').trim().substring(0, 10)
|
env.GIT_COMMIT = readFile('GIT_COMMIT').trim().substring(0, 10)
|
||||||
sh 'rm GIT_COMMIT'
|
sh 'rm GIT_COMMIT'
|
||||||
@@ -20,13 +20,9 @@ node {
|
|||||||
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
||||||
|
|
||||||
def customImage
|
def customImage
|
||||||
|
}
|
||||||
|
|
||||||
|
/*stage('Test') {
|
||||||
currentBuild.result = "SUCCESS"
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
/*stage('Test'){
|
|
||||||
env.NODE_ENV = "test"
|
env.NODE_ENV = "test"
|
||||||
print "Environment will be : ${env.NODE_ENV}"
|
print "Environment will be : ${env.NODE_ENV}"
|
||||||
sh 'node -v'
|
sh 'node -v'
|
||||||
@@ -35,7 +31,7 @@ node {
|
|||||||
sh 'npm test'
|
sh 'npm test'
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
stage('Build Prod'){
|
stage('Build Prod') {
|
||||||
env.NODE_ENV = "production"
|
env.NODE_ENV = "production"
|
||||||
print "Environment will be : ${env.NODE_ENV}"
|
print "Environment will be : ${env.NODE_ENV}"
|
||||||
|
|
||||||
@@ -47,11 +43,11 @@ node {
|
|||||||
sh 'npm install --only=production'
|
sh 'npm install --only=production'
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build Docker'){
|
stage('Build Docker') {
|
||||||
customImage = docker.build(env.DOCKER_NAME)
|
customImage = docker.build(env.DOCKER_NAME)
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy'){
|
stage('Deploy') {
|
||||||
echo 'Push to Repo'
|
echo 'Push to Repo'
|
||||||
docker.withRegistry("https://${DOCKER_REGISTRY}", 'docker-registry-robot-web-development') {
|
docker.withRegistry("https://${DOCKER_REGISTRY}", 'docker-registry-robot-web-development') {
|
||||||
/* Push the container to the custom Registry */
|
/* Push the container to the custom Registry */
|
||||||
@@ -67,10 +63,4 @@ node {
|
|||||||
sh 'docker image prune -f'
|
sh 'docker image prune -f'
|
||||||
sh 'docker rmi $(docker images -a | grep "<none>" | awk "{print \$3}") &2>/del/null || exit 0'
|
sh 'docker rmi $(docker images -a | grep "<none>" | awk "{print \$3}") &2>/del/null || exit 0'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
currentBuild.result = "FAILURE"
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user