-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
121 lines (112 loc) · 3.51 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# are alma9 and centos7 the only options?
image: artifacts.ncei.noaa.gov/ncei/base:alma9
variables:
NODE_VERSION: "v18.20.2"
stages:
- .pre
- test
- build
#- security # Required for security scan jobs
- artifactory # Required for deployments. The artifacts must be saved somewhere first.
- deploy # Required for deployments.
setup-job:
stage: .pre
script:
- curl -o node-$NODE_VERSION-linux-x64.tar.gz https://artifacts.ncei.noaa.gov:443/artifactory/node-dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz
- tar -xzf node-$NODE_VERSION-linux-x64.tar.gz
- export PATH=$PATH:$PWD/node-$NODE_VERSION-linux-x64/bin
# set up npm registry and CA certs
- npm config set registry https://artifacts.ncei.noaa.gov/artifactory/api/npm/npm.upstream/
- export NODE_EXTRA_CA_CERTS=/etc/pki/tls/certs/ca-bundle.crt
- npm -d install
# pass along to the next stage
artifacts:
paths:
- node_modules
- node-$NODE_VERSION-linux-x64
expire_in: 2 week
## TODO setup vitest
test-job:
stage: test
script:
# node and node_modules passed from previous stage but must set environment in every job
- export PATH=$PATH:$PWD/node-$NODE_VERSION-linux-x64/bin
- export NODE_EXTRA_CA_CERTS=/etc/pki/tls/certs/ca-bundle.crt
- export PATH=$PATH:$PWD/node-$NODE_VERSION-linux-x64/bin
- echo "Linting code..."
# - npm run lint
- echo "Running unit tests..."
# - npm run test
- echo "Running code coverage..."
# - npm run coverage
artifacts:
paths:
- node_modules
- node-$NODE_VERSION-linux-x64
expire_in: 2 week
build-job:
stage: build
tags:
- build
script:
- export PATH=$PATH:$PWD/node-$NODE_VERSION-linux-x64/bin
- export NODE_EXTRA_CA_CERTS=/etc/pki/tls/certs/ca-bundle.crt
- export PATH=$PATH:$PWD/node-$NODE_VERSION-linux-x64/bin
- echo "Running build..."
# - npm run build
- npx vite build -m test --base /maps/imlgs/
- echo "packaging..."
- cd dist
- tar czf ../imlgs.tar.gz *
- cd ..
artifacts:
paths:
- imlgs.tar.gz
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
#-----------------------------------------------------------------------------
# Push artifact to artifactory dev repository
#-----------------------------------------------------------------------------
include:
# The utilities for uploading to Artifactory.
- component: git.ncei.noaa.gov/pipeline-components/artifactory/upload_artifact_dev_repo@main
inputs:
job_name: artifactory-upload-imlgs
artifact_path: '.'
artifact_name: 'imlgs.tar.gz'
artifactory-upload-imlgs:
needs:
- build-job
#-----------------------------------------------------------------------------
# Deployments
#-----------------------------------------------------------------------------
deploy-imlgs-to-test:
variables:
BUILD_REF: ${CI_COMMIT_SHA}
PROJECT_NAME: ${CI_PROJECT_NAME}
PROJECT_PATH_SLUG: ${CI_PROJECT_PATH_SLUG}
TIER: "test"
stage: deploy
needs:
- artifactory-upload-imlgs
trigger:
project: deployers/deployer
strategy: depend
# when: manual
deploy-imlgs-to-prod:
variables:
BUILD_REF: ${CI_COMMIT_SHA}
PROJECT_NAME: ${CI_PROJECT_NAME}
TIER: "prod"
stage: deploy
needs:
- artifactory-upload-imlgs
trigger:
project: deployers/deployer
strategy: depend
when: manual
# TODO security scanner not available in NCEI archive
# sast:
# stage: test
# include:
# - template: Security/SAST.gitlab-ci.yml