/
.travis.yml
208 lines (158 loc) · 9.56 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
206
207
208
dist: jammy
language: shell
os: linux
env:
global:
- NODE_VERSION=18
- CC_TEST_REPORTER_ID=46ef31dae5b656e0f4be410a86bd83bdcf73e7d27ab33a704c197e6fe4bf02a0
# - DOCKER_CLI_EXPERIMENTAL=enabled
before_install:
- export IMAGE_VERSION=${TRAVIS_BRANCH//\//\_}
- export IMAGE_VERSION=${IMAGE_VERSION//\#/\_}
# Install docker with buildx
# - for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
# - sudo apt-get update
# - sudo apt-get install ca-certificates curl
- 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 run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3
# - cat /proc/sys/fs/binfmt_misc/qemu-aarch64
# 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:
# Install dependencies
- (cd app && npm ci)
- (cd e2e && npm ci)
- (cd ui && npm ci)
# Run Linter
- (cd app && npm run lint)
- (cd e2e && npm run lint)
- (cd ui && npm run lint)
# Run UT
- (cd app && npm test)
# Package ui
- set -v
- (cd ui && npm run build)
# Build wud docker image
- docker build -t wud --build-arg WUD_VERSION=$IMAGE_VERSION .
script:
# 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.30.5-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:3.2.1.5070-ls105
# 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.30.5-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:3.2.1.5070-ls105
# QUAY
- docker run -d --name quay_prometheus --label 'wud.watch=true' --label 'wud.tag.include=^v\d+\.\d+\.\d+$' quay.io/prometheus/prometheus:v2.30.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_CLIENTID="$ACR_CLIENT_ID"
--env WUD_REGISTRY_ACR_CLIENTSECRET="$ACR_CLIENT_SECRET"
--env WUD_REGISTRY_ECR_ACCESSKEYID="$AWS_ACCESSKEY_ID"
--env WUD_REGISTRY_ECR_SECRETACCESSKEY="$AWS_SECRET_ACCESSKEY"
--env WUD_REGISTRY_ECR_REGION=eu-west-1
--env WUD_REGISTRY_GCR_CLIENTEMAIL="$GCR_CLIENT_EMAIL"
--env WUD_REGISTRY_GCR_PRIVATEKEY="$GCR_PRIVATE_KEY"
--env WUD_REGISTRY_GHCR_TOKEN="$GITHUB_TOKEN"
--env WUD_REGISTRY_GITLAB_TOKEN="$GITLAB_TOKEN"
--env WUD_REGISTRY_LSCR_TOKEN="$GITHUB_TOKEN"
--env WUD_AUTH_BASIC_JOHN_USER="john"
--env WUD_AUTH_BASIC_JOHN_HASH='$apr1$8zDVtSAY$62WBh9DspNbUKMZXYRsjS/'
wud
# --env WUD_REGISTRY_HUB_LOGIN="$DOCKER_USERNAME"
# --env WUD_REGISTRY_HUB_TOKEN="$DOCKER_PASSWORD"
# Give wud a little time to fetch all available updates
- sleep 20
# Run E2E Tests
- (cd e2e && npm run cucumber)
after_success:
# Report to Code Climate
- (cd app && ./cc-test-reporter after-build -t lcov --debug --exit-code $TRAVIS_TEST_RESULT)
# Override image version with latest if master branch
- if [ "$TRAVIS_BRANCH" == "master" ] ; then export IMAGE_VERSION=latest; fi
# Override image version with tag name if any
- if [ ! -z "$TRAVIS_TAG" ] ; then export IMAGE_VERSION=$TRAVIS_TAG; fi
# Build & push image
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker login ghcr.io -u "$GITHUB_USERNAME" -p "$GITHUB_TOKEN"
- docker version
- make prepare
- make build IMAGE_NAME=whats-up-docker IMAGE_VERSION=$IMAGE_VERSION PLATFORMS=linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64 DOCKER_USERNAME=$DOCKER_USERNAME GITHUB_USERNAME=$GITHUB_USERNAME