-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy path.travis.yml
205 lines (157 loc) · 9.46 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
dist: jammy
language: shell
os: linux
env:
global:
- CC_TEST_REPORTER_ID=46ef31dae5b656e0f4be410a86bd83bdcf73e7d27ab33a704c197e6fe4bf02a0
- DOCKER_PLATFORMS=linux/arm/v7,linux/arm64/v8,linux/amd64
- IMAGE_NAME=wud
- NODE_VERSION=23
before_install:
- export IMAGE_VERSION=${TRAVIS_BRANCH//\//\_}
- export IMAGE_VERSION=${IMAGE_VERSION//\#/\_}
# Install docker with buildx
- sudo install -m 0755 -d /etc/apt/keyrings
- sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
- sudo chmod a+r /etc/apt/keyrings/docker.asc
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- sudo apt-get update
- sudo apt-get install -y docker-buildx-plugin
- docker version
# Install Nodejs
- nvm install $NODE_VERSION
# Init Code Climate
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./app/cc-test-reporter
- (cd app && chmod +x ./cc-test-reporter)
- (cd app && ./cc-test-reporter before-build)
install:
- (cd app && npm ci)
- (cd e2e && npm ci)
- (cd ui && npm ci)
script:
# Fail at first non zero exit code
- set -e
# Run Linter
- (cd app && npm run lint)
- (cd e2e && npm run lint)
- (cd ui && npm run lint)
# Run UT
- (cd app && npm test)
# Report to Code Climate
- (cd app && ./cc-test-reporter after-build -t lcov --debug --exit-code $TRAVIS_TEST_RESULT)
# Package ui
- (cd ui && npm run build)
# Build wud docker image
- docker build -t wud --build-arg WUD_VERSION=$IMAGE_VERSION .
# Login to private registries
- docker login registry.gitlab.com -u "$GITLAB_USERNAME" -p "$GITLAB_TOKEN"
# Pull nginx as a test image
- docker pull nginx:1.10-alpine
- docker pull nginx:1.20-alpine
# Tag nginx 1.10 as latest to simulate an update_available
- docker tag nginx:1.10-alpine nginx:latest
# Tag nginx as if it was coming from private Hub, ECR, GCR, ACR...
- docker tag nginx:1.10-alpine fmartinou/test:1.0.0
- docker tag nginx:1.10-alpine 229211676173.dkr.ecr.eu-west-1.amazonaws.com/test:1.0.0
- docker tag nginx:1.10-alpine 229211676173.dkr.ecr.eu-west-1.amazonaws.com/sub/test:1.0.0
- docker tag nginx:1.10-alpine 229211676173.dkr.ecr.eu-west-1.amazonaws.com/sub/sub/test:1.0.0
# - docker tag nginx:1.10-alpine gcr.io/wud-test/test:1.0.0
# - docker tag nginx:1.10-alpine gcr.io/wud-test/sub/test:1.0.0
# - docker tag nginx:1.10-alpine gcr.io/wud-test/sub/sub/test:1.0.0
# - docker tag nginx:1.10-alpine wudtest.azurecr.io/test:1.0.0
# - docker tag nginx:1.10-alpine wudtest.azurecr.io/sub/test:1.0.0
# - docker tag nginx:1.10-alpine wudtest.azurecr.io/sub/sub/test:1.0.0
# Pull homeassistant
- docker pull homeassistant/home-assistant
- docker pull homeassistant/home-assistant:2021.6.1
# Pull omnidb
- docker pull omnidbteam/omnidb
# Pull pihole
- docker pull pihole/pihole
- docker pull pihole/pihole:v5.7
# Pull pyload
- docker pull writl/pyload
# Pull traefik
- docker pull traefik
- docker pull traefik:2.4.5
# Pull vaultwarden
- docker pull vaultwarden/server
- docker pull vaultwarden/server:1.32.7-alpine
# Pull youtubedl
- docker pull jeeaaasustest/youtube-dl
# Run containers for tests
# ACR
# - docker run -d --name acr_test --label "wud.watch=true" wudtest.azurecr.io/test:1.0.0
# - docker run -d --name acr_sub_test --label "wud.watch=true" wudtest.azurecr.io/sub/test:1.0.0
# - docker run -d --name acr_sub_sub_test --label "wud.watch=true" wudtest.azurecr.io/sub/sub/test:1.0.0
# ECR
- docker run -d --name ecr_sub_sub_test --label 'wud.watch=true' 229211676173.dkr.ecr.eu-west-1.amazonaws.com/sub/sub/test:1.0.0
- docker run -d --name ecr_sub_test --label 'wud.watch=true' 229211676173.dkr.ecr.eu-west-1.amazonaws.com/sub/test:1.0.0
- docker run -d --name ecr_test --label 'wud.watch=true' 229211676173.dkr.ecr.eu-west-1.amazonaws.com/test:1.0.0
# GCR
# - docker run -d --name gcr_test --label "wud.watch=true" gcr.io/wud-test/test:1.0.0
# - docker run -d --name gcr_sub_test --label "wud.watch=true" gcr.io/wud-test/sub/test:1.0.0
# - docker run -d --name gcr_sub_sub_test --label "wud.watch=true" gcr.io/wud-test/sub/sub/test:1.0.0
# GHCR
- docker run -d --name ghcr_radarr --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+\.\d+\.\d+-ls\d+$' ghcr.io/linuxserver/radarr:5.14.0.9383-ls245
# GITLAB
- docker run -d --name gitlab_test --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+\.\d+$' registry.gitlab.com/manfred-martin/docker-registry-test:1.0.0
# HUB
- docker run -d --name hub_homeassistant_202161 --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+.\d+$' --label 'wud.link.template=https://github.com/home-assistant/core/releases/tag/${major}.${minor}.${patch}' homeassistant/home-assistant:2021.6.1
- docker run -d --name hub_homeassistant_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' homeassistant/home-assistant
- docker run -d --name hub_nginx_120 --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+-alpine$' nginx:1.20-alpine
- docker run -d --name hub_nginx_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' nginx
- docker run -d --name hub_omnidb_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' omnidbteam/omnidb
- docker run -d --name hub_pihole_57 --label 'wud.watch=true' --label 'wud.tag.include=^v\d+\.\d+.\d+$' pihole/pihole:v5.7
- docker run -d --name hub_pihole_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' pihole/pihole
- docker run -d --name hub_pyload_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' writl/pyload
# - docker run -d --name hub_test --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+.\d+$' fmartinou/test:1.0.0
- docker run -d --name hub_traefik_245 --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+.\d+$' traefik:2.4.5
- docker run -d --name hub_traefik_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' traefik
- docker run -d --name hub_vaultwarden_1222 --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+.\d+-alpine$' -e I_REALLY_WANT_VOLATILE_STORAGE=true vaultwarden/server:1.32.7-alpine
- docker run -d --name hub_vaultwarden_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' -e I_REALLY_WANT_VOLATILE_STORAGE=true vaultwarden/server
- docker run -d --name hub_youtubedb_latest --label 'wud.watch=true' --label 'wud.watch.digest=true' --label 'wud.tag.include=^latest$' jeeaaasustest/youtube-dl
# LSCR
- docker run -d --name lscr_radarr --label 'wud.watch=true' --label 'wud.tag.include=^\d+\.\d+\.\d+\.\d+-ls\d+$' lscr.io/linuxserver/radarr:5.14.0.9383-ls245
# QUAY
- docker run -d --name quay_prometheus --label 'wud.watch=true' --label 'wud.tag.include=^v\d+\.\d+\.\d+$' quay.io/prometheus/prometheus:v2.52.0
# Run wud docker image
- >
docker run -d
--name wud
--publish 3000:3000
--volume /var/run/docker.sock:/var/run/docker.sock
--env WUD_TRIGGER_MOCK_EXAMPLE_MOCK=mock
--env WUD_WATCHER_LOCAL_WATCHBYDEFAULT=false
--env WUD_REGISTRY_ACR_PRIVATE_CLIENTID="$ACR_CLIENT_ID"
--env WUD_REGISTRY_ACR_PRIVATE_CLIENTSECRET="$ACR_CLIENT_SECRET"
--env WUD_REGISTRY_ECR_PRIVATE_ACCESSKEYID="$AWS_ACCESSKEY_ID"
--env WUD_REGISTRY_ECR_PRIVATE_SECRETACCESSKEY="$AWS_SECRET_ACCESSKEY"
--env WUD_REGISTRY_ECR_PRIVATE_REGION=eu-west-1
--env WUD_REGISTRY_GCR_PRIVATE_CLIENTEMAIL="$GCR_CLIENT_EMAIL"
--env WUD_REGISTRY_GCR_PRIVATE_PRIVATEKEY="$GCR_PRIVATE_KEY"
--env WUD_REGISTRY_GHCR_PRIVATE_USERNAME="$GITHUB_USERNAME"
--env WUD_REGISTRY_GHCR_PRIVATE_TOKEN="$GITHUB_TOKEN"
--env WUD_REGISTRY_GITLAB_PRIVATE_TOKEN="$GITLAB_TOKEN"
--env WUD_REGISTRY_LSCR_PRIVATE_USERNAME="$GITHUB_USERNAME"
--env WUD_REGISTRY_LSCR_PRIVATE_TOKEN="$GITHUB_TOKEN"
--env WUD_AUTH_BASIC_JOHN_USER="john"
--env WUD_AUTH_BASIC_JOHN_HASH='$apr1$8zDVtSAY$62WBh9DspNbUKMZXYRsjS/'
wud
# Give wud a little time to fetch all available updates
- sleep 20
# Run E2E Tests
- (cd e2e && npm run cucumber)
# Override image version with tag name if any
- export DOCKER_TAGS="-t ${DOCKER_USERNAME}/${IMAGE_NAME}:${IMAGE_VERSION} -t ghcr.io/${GITHUB_USERNAME}/${IMAGE_NAME}:${IMAGE_VERSION}"
- |
if [ ! -z "$TRAVIS_TAG" ]
then
export DOCKER_TAGS="${DOCKER_TAGS} -t ${DOCKER_USERNAME}/${IMAGE_NAME}:latest -t ghcr.io/${GITHUB_USERNAME}/${IMAGE_NAME}:latest"
fi
# Build & push image
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker login ghcr.io -u "$GITHUB_USERNAME" -p "$GITHUB_TOKEN"
- docker buildx create --use
- echo "Building & pushing ${DOCKER_TAGS}"
- docker buildx build --push --platform ${DOCKER_PLATFORMS} --build-arg WUD_VERSION=${IMAGE_VERSION} ${DOCKER_TAGS} .