Skip to content
Snippets Groups Projects
Commit b1c562d7 authored by Homada.Boumedane's avatar Homada.Boumedane
Browse files

chore(dlcm-portal): jenkinsfile

refactor jenkinsfile
parent bb8bde09
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env groovy
pipeline{
agent any
options{
timestamps()
buildDiscarder(logRotator(numToKeepStr: '5'))
disableConcurrentBuilds()
}
tools{
maven 'Maven 3.3.9'
}
environment{
CHROME_BIN = '/usr/bin/chromium'
}
parameters {
booleanParam(name: 'RELEASE', description: 'Build a release from current commit.', defaultValue: false)
string(name: 'RELEASE_VERSION', defaultValue: '1.0.0', description: 'RELEASE Version')
string(name: 'SNAPSHOT_VERSION', defaultValue: '1.4.0-SNAPSHOT', description: 'SNAPSHOT Version')
string(name: 'TAG_NAME', defaultValue: 'dlcm-1.4.0', description: 'TAG Name')
}
triggers {
cron('@midnight')
}
stages{
stage ('Checkout'){
steps{
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'LocalBranch', localBranch: 'master']],
submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'GitLabRelease', url: 'git@gitlab.unige.ch:dlcm/ui/dlcm-portal.git']]
])
}
}
stage ('Install node_modules'){
steps{
sh 'npm install --verbose -d'
}
}
stage ('Unit tests'){
steps{
sh 'ng test --watch=false --no-progress --browsers=ChromeNoSandboxHeadless'
}
}
stage ('Code quality'){
steps{
sh 'ng lint --format=checkstyle > checkstyle-result.xml'
}
}
stage ('Build & Deploying SNAPSHOT'){
environment {
WEB_CONTEXT_ROOT = 'portal'
}
steps {
withMaven(maven: 'Maven 3.3.9', mavenSettingsConfig: '829b97c1-b457-48ad-a48b-f8140b5a5821'){
sh "mvn clean deploy -Dweb.context.root=${WEB_CONTEXT_ROOT}"
}
}
}
stage("Release") {
when {
allOf {
branch 'master'
expression { params.RELEASE }
}
}
steps {
echo "Tag name is ${params.TAG_NAME}"
echo "Release version is ${params.RELEASE_VERSION}"
echo "Snapshot version is ${params.SNAPSHOT_VERSION}"
withMaven(maven: 'Maven 3.3.9', mavenSettingsConfig: '829b97c1-b457-48ad-a48b-f8140b5a5821'){
sshagent(credentials: ['GitLabRelease']) {
sh "mvn -B release:clean release:prepare release:perform -Dtag=${params.TAG_NAME} -DreleaseVersion=${params.RELEASE_VERSION} -DdevelopmentVersion=${params.SNAPSHOT_VERSION}"
}
}
}
}
}
post {
always {
recordIssues tool: tsLint(pattern: 'checkstyle-result.xml'), enabledForFailure: true
}
failure {
mail to: 'homada.boumedane@unige.ch, hugues.cazeaux@unige.ch, florent.poittevin@unige.ch',
subject: "Angular Fontend Build: ${env.JOB_NAME} - Failed",
body: "Job Failed - \"${env.JOB_NAME}\" build: ${env.BUILD_NUMBER}\n\nView the log at:\n ${env.BUILD_URL}\n\nBlue Ocean:\n${env.RUN_DISPLAY_URL}"
}
cleanup {
echo '...Cleaning up workspace'
cleanWs()
}
}
properties([
parameters([
booleanParam(name: 'RELEASE', description: 'Build a release from current commit.', defaultValue: false),
string(name: 'RELEASE_VERSION', defaultValue: '1.0.0', description: 'RELEASE Version'),
string(name: 'SNAPSHOT_VERSION', defaultValue: '1.4.0-SNAPSHOT', description: 'SNAPSHOT Version'),
string(name: 'TAG_NAME', defaultValue: 'dlcm-1.4.0', description: 'TAG Name'),
])
])
@Library('solidify-pipelinelibrary@master') _
angularWithMavenTemplate {
masterBranchName = 'master'
skipTests = false
skipCodeInspection = true
}
......@@ -3,7 +3,6 @@
// The list of file replacements can be found in `angular.json`.
import {InjectionToken} from "@angular/core";
import {ThemeEnum} from "@app/shared/enums/theme.enum";
import {defaultEnvironment} from "./environment.defaults";
import {environmentLocal} from "./environment.local";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment