forked from razee-io/WatchKeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
169 lines (150 loc) · 6.72 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
language: node_js
node_js:
- "16"
services:
- docker
env:
global:
- GITHUB_TOKEN="${PUBLIC_GITHUB_TOKEN_2023_07_10}"
before_install:
- echo "$DOCKERHUB_TOKEN" | docker login -u "icdevops" --password-stdin
jobs:
include:
- stage: building images
name: building amd64 image
arch: amd64
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]+$ ]]; then npm version --no-git-tag-version "${TRAVIS_TAG}"; fi
- docker build --rm -t "quay.io/razee/watch-keeper:${TRAVIS_COMMIT}-amd64" .
- if [ -n "${TRAVIS_TAG}" ]; then docker tag quay.io/razee/watch-keeper:${TRAVIS_COMMIT}-amd64 quay.io/razee/watch-keeper:${TRAVIS_TAG}-amd64; fi
- docker images
- ./build/process-template.sh kubernetes/watch-keeper/resource.yaml >/tmp/resource.yaml
- ./build/process-template.sh kubernetes/watch-keeper/rbac.yaml >/tmp/rbac.yaml
before_deploy:
- docker login -u="${QUAY_ID}" -p="${QUAY_TOKEN}" quay.io
deploy:
# Deploy alpha builds
- provider: script
script: docker push "quay.io/razee/watch-keeper:${TRAVIS_TAG}-amd64"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$
# Deploy released builds
- provider: script
script: docker push "quay.io/razee/watch-keeper:${TRAVIS_TAG}-amd64"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- name: building ppc64le image
arch: ppc64le
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 test
- if [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then npm version --no-git-tag-version "${TRAVIS_TAG}"; fi
- docker build --rm -t "quay.io/razee/watch-keeper:${TRAVIS_COMMIT}-ppc64le" .
- if [ -n "${TRAVIS_TAG}" ]; then docker tag quay.io/razee/watch-keeper:${TRAVIS_COMMIT}-ppc64le quay.io/razee/watch-keeper:${TRAVIS_TAG}-ppc64le; fi
- docker images
- ./build/process-template.sh kubernetes/watch-keeper/resource.yaml >/tmp/resource.yaml
- ./build/process-template.sh kubernetes/watch-keeper/rbac.yaml >/tmp/rbac.yaml
before_deploy:
- docker login -u="${QUAY_ID}" -p="${QUAY_TOKEN}" quay.io
deploy:
# Deploy alpha builds
- provider: script
script: docker push "quay.io/razee/watch-keeper:${TRAVIS_TAG}-ppc64le"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$
# Deploy released builds
- provider: script
script: docker push "quay.io/razee/watch-keeper:${TRAVIS_TAG}-ppc64le"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- name: building s390x image
arch: s390x
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 test
- if [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then npm version --no-git-tag-version "${TRAVIS_TAG}"; fi
- docker build --rm -t "quay.io/razee/watch-keeper:${TRAVIS_COMMIT}-s390x" .
- if [ -n "${TRAVIS_TAG}" ]; then docker tag quay.io/razee/watch-keeper:${TRAVIS_COMMIT}-s390x quay.io/razee/watch-keeper:${TRAVIS_TAG}-s390x; fi
- docker images
- ./build/process-template.sh kubernetes/watch-keeper/resource.yaml >/tmp/resource.yaml
- ./build/process-template.sh kubernetes/watch-keeper/rbac.yaml >/tmp/rbac.yaml
before_deploy:
- docker login -u="${QUAY_ID}" -p="${QUAY_TOKEN}" quay.io
deploy:
# Deploy alpha builds
- provider: script
script: docker push "quay.io/razee/watch-keeper:${TRAVIS_TAG}-s390x"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$
# Deploy released builds
- provider: script
script: docker push "quay.io/razee/watch-keeper:${TRAVIS_TAG}-s390x"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- stage: publish multi-arch image, npm & github release
arch: amd64
script:
- if [[ $TRAVIS_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then npm version --no-git-tag-version "${TRAVIS_TAG}"; fi
- ./build/process-template.sh kubernetes/watch-keeper/resource.yaml >/tmp/resource.yaml
- ./build/process-template.sh kubernetes/watch-keeper/rbac.yaml >/tmp/rbac.yaml
- export DOCKER_CLI_EXPERIMENTAL=enabled
- sudo chown -R $USER:$USER /etc/docker/
- |
if [ -n "${TRAVIS_TAG}" ]; then
docker manifest create quay.io/razee/watch-keeper:${TRAVIS_TAG} \
quay.io/razee/watch-keeper:${TRAVIS_TAG}-amd64 \
quay.io/razee/watch-keeper:${TRAVIS_TAG}-ppc64le \
quay.io/razee/watch-keeper:${TRAVIS_TAG}-s390x
fi
before_deploy:
- docker login -u="${QUAY_ID}" -p="${QUAY_TOKEN}" quay.io
deploy:
# Deploy alpha builds
- provider: script
script: docker manifest push "quay.io/razee/watch-keeper:${TRAVIS_TAG}"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$
# Deploy released builds
- provider: script
script: docker manifest push "quay.io/razee/watch-keeper:${TRAVIS_TAG}"
skip_cleanup: true
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- provider: releases
file:
- "/tmp/resource.yaml"
- "/tmp/rbac.yaml"
skip_cleanup: true
api_key: "${GITHUB_TOKEN}"
name: "${TRAVIS_TAG}"
on:
tags: true
condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$
- 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]+$