| pipeline { |
| agent { |
| kubernetes { |
| label 'my-agent-pod' |
| yaml """ |
| apiVersion: v1 |
| kind: Pod |
| spec: |
| containers: |
| - name: node |
| image: timbru31/node-chrome:18-alpine |
| tty: true |
| command: |
| - cat |
| resources: |
| limits: |
| memory: 3Gi |
| cpu: 1 |
| requests: |
| memory: 3Gi |
| cpu: 1 |
| env: |
| - name: "HOME" |
| value: "/home/jenkins" |
| - name: "CHROME_BIN" |
| value: "/usr/bin/chromium-browser" |
| volumeMounts: |
| - mountPath: "/home/jenkins" |
| name: "jenkins-home" |
| readOnly: false |
| volumes: |
| - name: "jenkins-home" |
| emptyDir: {} |
| """ |
| } |
| } |
| options { |
| timestamps() |
| } |
| |
| stages { |
| stage('Install dependencies') { |
| steps { |
| container('node') { |
| sh 'node -v' |
| sh 'npm -v' |
| dir('plugins/org.eclipse.osee.web') { |
| sh 'npm config set fetch-timeout=100000' |
| sh 'npm ci --force' |
| } |
| } |
| } |
| } |
| |
| stage('Linting') { |
| steps { |
| container('node') { |
| dir('plugins/org.eclipse.osee.web') { |
| sh 'npx -p @angular/cli ng lint' |
| sh 'npx stylelint "**/*.scss"' |
| sh 'npx prettier --check .' |
| } |
| } |
| } |
| } |
| |
| stage('Run tests') { |
| steps { |
| container('node') { |
| dir('plugins/org.eclipse.osee.web') { |
| sh 'npx -p @angular/cli ng test --browsers=ChromeHeadless --watch=false' |
| } |
| } |
| } |
| } |
| |
| stage ('Run Icon Script'){ |
| steps{ |
| container('node'){ |
| dir('plugins/org.eclipse.osee.web'){ |
| sh 'npm run prebuild' |
| } |
| } |
| } |
| } |
| |
| stage('Build Production') { |
| steps { |
| container('node') { |
| dir('plugins/org.eclipse.osee.web') { |
| sh 'npx -p @angular/cli ng build -c production' |
| } |
| } |
| } |
| } |
| } |
| } |