Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
wip: test multi-arch angular build
Browse files Browse the repository at this point in the history
Signed-off-by: Chaz Leong <13462818+cleong14@users.noreply.github.com>
  • Loading branch information
cleong14 committed Jul 18, 2024
1 parent 1bf8256 commit ae72a38
Showing 1 changed file with 60 additions and 15 deletions.
75 changes: 60 additions & 15 deletions angular-ui/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,75 @@
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
restartPolicy: Never
containers:
- name: build
image: artifactory.cloud.cms.gov/docker/library/node:18-alpine
command: ['tail', '-f', '/dev/null']
"""
}
parameters {
string(name: 'platform', defaultValue: 'linux/amd64', description: 'A comma separated list of platforms to build the container image for (e.g., linux/amd64,linux/arm64).')
}

agent none

stages {
stage('Build') {
stage('Build linux/arm64 Image') {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
nodeSelector:
kubernetes.io/arch: arm64
restartPolicy: Never
containers:
- name: build
image: artifactory.cloud.cms.gov/docker/library/node:18-alpine
imagePullPolicy: Always
command: ['tail', '-f', '/dev/null']
"""
}
}
when {
beforeAgent true
equals expected: 'linux/arm64', actual: "${params.platform}"
}
steps {
container('build') {
dir('angular-ui') {
sh 'npm ci && npm cache clean --force'
}
}
}
}

stage('Build linux/amd64 Image') {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
nodeSelector:
kubernetes.io/arch: amd64
restartPolicy: Never
containers:
- name: build
image: artifactory.cloud.cms.gov/docker/library/node:18-alpine
imagePullPolicy: Always
command: ['tail', '-f', '/dev/null']
"""
}
}
when {
beforeAgent true
equals expected: 'linux/amd64', actual: "${params.platform}"
}
steps {
container('build') {
dir('angular-ui') {
sh 'npm ci'
sh 'npm ci && npm cache clean --force'
}
}
}
}

stage('Test') {
agent any
parallel {
stage('Unit Test') {
steps {
Expand Down Expand Up @@ -67,6 +111,7 @@ pipeline {
}

stage('Delivery') {
agent any
steps {
build(job: 'Angular UI Delivery', wait: true, propagate: true, parameters: [
string(name: 'tag', value: "${GIT_COMMIT[0..7]}"),
Expand Down

0 comments on commit ae72a38

Please sign in to comment.