From 6e874cc41a99c86ae37b0b89e1408d88db519c83 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Wed, 6 Feb 2019 15:47:56 -0500 Subject: [PATCH] Adding new jenkinsfile and modifying output path --- Jenkinsfile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ angular.json | 4 ++-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..22898cd --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,52 @@ +#!groovy + +properties( + [ + [$class: 'BuildDiscarderProperty', strategy: + [$class: 'LogRotator', artifactDaysToKeepStr: '14', artifactNumToKeepStr: '5', daysToKeepStr: '30', numToKeepStr: '60']], + pipelineTriggers( + [ + pollSCM('H/1 * * * *'), + // cron('@daily'), + ] + ) + ] +) +node { + stage('Checkout') { + //disable to recycle workspace data to save time/bandwidth + deleteDir() + checkout scm + + //enable for commit id in build number + //env.git_commit_id = sh returnStdout: true, script: 'git rev-parse HEAD' + //env.git_commit_id_short = env.git_commit_id.take(7) + //currentBuild.displayName = "#${currentBuild.number}-${env.git_commit_id_short}" + } + + stage('NPM Install') { + withEnv(["NPM_CONFIG_LOGLEVEL=warn"]) { + sh 'npm install' + } + } + + stage('Lint') { + sh 'ng lint' + } + + stage('Build') { + milestone() + sh 'ng build --prod --aot --progress=false' + } + + stage('Archive') { + sh 'tar -cvzf dist.tar.gz --strip-components=1 dist' + archive 'dist.tar.gz' + } + + stage('Deploy') { + milestone() + echo "Deploying..." + sh 'cp -r dist/. /var/www/html/master/' + } +} diff --git a/angular.json b/angular.json index 2115b9a..277517d 100644 --- a/angular.json +++ b/angular.json @@ -13,7 +13,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/frontend", + "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", @@ -130,4 +130,4 @@ } }, "defaultProject": "frontend" -} \ No newline at end of file +}