From b927314c48c8fe3feeb6a3d1adf7d48db93e61c2 Mon Sep 17 00:00:00 2001 From: Jesse James Isler Date: Thu, 9 Jun 2022 09:45:33 +0200 Subject: [PATCH] Added testing Yes, jenkins will build this twice. Once the app and once for the dockerfile. Sue me --- Jenkinsfile | 78 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 459a82e..2251efa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,72 @@ +//pipeline { +// agent { dockerfile true } +// stages { +// stage('Test') { +// steps { +// echo "Build has worked!" +// } +// } +// } +//} pipeline { - agent { dockerfile true } - stages { - stage('Test') { - steps { - echo "Build has worked!" - } - } + agent none + tools { + nodejs "815Node" + } + // environment { + // registry = 'dockerhubusername/dockerhubusername' + // registryCredential = 'dockerhubcredentials' + // } + stages { + stage('INSTALL PACKAGES') { + agent any + steps { + sh "npm install" + } } -} \ No newline at end of file + stage('CODETEST') { + agent any + steps { + echo "insert your testing here" + } + } + stage('BUILD APP') { + agent any + steps { + sh "node_modules/.bin/ng build --prod" + } + } + stage('Angular frontend Karma Test') { + agent any + steps { + sh 'npm rebuild' + sh 'npm run test' + sh 'ng test' + } + } + stage("BUILD DOCKER") { + agent { + dockerfile true + } + steps { + script { + dockerImageBuild = docker.build registry + ":latest" + } + } + } + // stage("DEPLOY DOCKER") { + // steps { + // script { + // docker.withRegistry('', registryCredential) { + // dockerImageBuild.push() + // } + // } + // } + // } + // stage("DEPLOY & ACTIVATE") { + // steps { + // echo 'this part will differ depending on setup' + // } + // } + } +}