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