-
Notifications
You must be signed in to change notification settings - Fork 8
/
.travis.yml
80 lines (74 loc) · 3.03 KB
/
.travis.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
language: node_js
dist: focal
node_js:
- "18"
services:
- docker
env:
global:
- GITHUB_TOKEN="${PUBLIC_GITHUB_TOKEN_2024_08_20}"
before_install:
- echo "$DOCKERHUB_TOKEN" | docker login -u "icdevops" --password-stdin
- export WS_APIKEY=${WS_APIKEY}
- export WS_USERKEY=${WS_USERKEY}
- export WS_PRODUCTNAME=${WS_PRODUCTNAME}
- export WS_PROJECTNAME=razeedeploy-delta
- export WS_WSS_URL=https://ibmets.whitesourcesoftware.com/agent
- ./build/download-kubelint.sh
script:
# Audit npm packages. Fail build whan a PR audit fails, otherwise report the vulnerability and proceed.
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then npx audit-ci --config audit-ci.json; else npx audit-ci --config audit-ci.json || true; fi
- npm run lint
- npm test
- if [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$ ]]; then npm version --no-git-tag-version "${TRAVIS_TAG}"; fi
- npm version
- docker build --rm -t "quay.io/razee/razeedeploy-delta:${TRAVIS_COMMIT}" .
- if [ -n "${TRAVIS_TAG}" ]; then docker tag quay.io/razee/razeedeploy-delta:${TRAVIS_COMMIT} quay.io/razee/razeedeploy-delta:${TRAVIS_TAG}; fi
- docker images
- ./build/process-template.sh kubernetes/razeedeploy-delta/resource.yaml >/tmp/resource.yaml
- ./build/process-template.sh kubernetes/job/resource.yaml >/tmp/job.yaml
- sed 's/{{ ARGS_ARRAY }}/["--rr", "--wk", "-a"]/' /tmp/job.yaml > /tmp/jobwargs.yaml # doing this because the kube linter doesn't know about mustache syntax and complains about {{ ARGS_ARRAY }}
- kubelint /tmp/resource.yaml
- kubelint /tmp/jobwargs.yaml
# Perform UA scan on non-PR builds
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then curl -LJO https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar; java -jar wss-unified-agent.jar -d . || echo "UA Scan Error occurred"; fi
before_deploy:
- docker login -u="${QUAY_ID}" -p="${QUAY_TOKEN}" quay.io
# Use npm v9 for deployments (v10 has problems with authentication with api_key)
- npm install -g npm@9
deploy:
# Publish npm package with tag "next" on release candidates
- provider: npm
email: "${NPMJS_EMAIL}"
api_key: "${NPMJS_API_KEY}"
tag: next
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)$
# Publish docker image on release and release candidates
- provider: script
script: docker push "quay.io/razee/razeedeploy-delta:${TRAVIS_TAG}"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$
# Publish npm package as "latest" on release
- provider: npm
email: "${NPMJS_EMAIL}"
api_key: "${NPMJS_API_KEY}"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
# Publish GitHub release assets on release
- provider: releases
file:
- "/tmp/resource.yaml"
- "/tmp/job.yaml"
skip_cleanup: true
api_key: "${GITHUB_TOKEN}"
name: "${TRAVIS_TAG}"
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$