UNPKG

884 BPlain TextView Raw
1@Library('pipeline-utils')_
2
3def name = 'marketplace-kit'
4
5pipeline {
6 agent any
7
8 environment {
9 PROJECT_NAME = "${env.BRANCH_NAME}-${env.GIT_COMMIT[0..5]}-${env.BUILD_ID}"
10 }
11
12 stages {
13 stage('Test') {
14 agent { docker { image "node:10-alpine"; args '-u root' } }
15
16 steps {
17 sh 'npm install'
18 sh 'npm run test'
19 }
20 }
21
22 stage('Build') {
23 when { branch 'master' }
24 steps {
25 script {
26 docker.withRegistry('https://registry.hub.docker.com', 'posops-dockerhub') {
27 def image = docker.build("platformos/${name}")
28 image.push()
29 }
30 }
31 }
32 }
33 }
34 post {
35 success {
36 notify("${name}-pipeline ${env.PROJECT_NAME} Success after ${buildDuration()}.")
37 }
38
39 failure {
40 alert("${name}-pipeline ${env.PROJECT_NAME} Failed after ${buildDuration()}.")
41 }
42 }
43}