Skip to content

Commit 734e075

Browse files
committed
chore(release): 🔖 version 0.20.0
2 parents faba564 + 588f8aa commit 734e075

File tree

352 files changed

+9214
-1391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

352 files changed

+9214
-1391
lines changed

‎.github/workflows/main.yaml‎

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ env:
2626
TERM: xterm
2727
# enable Docker push only if the required secrets are defined
2828
ENABLE_DOCKER_PUSH: ${{ secrets.DOCKERHUB_USER != null && secrets.DOCKERHUB_TOKEN != null }}
29+
DOCKER_BUILDKIT: 1
30+
# CACHE_FROM: "/tmp/.buildx-cache"
31+
CACHE_FROM_TYPE: "gha"
32+
# CACHE_TO: "/tmp/.buildx-cache"
33+
CACHE_TO_TYPE: "gha,mode=max"
2934

3035
jobs:
3136
# Verifies pep8, pyflakes and circular complexity
@@ -34,15 +39,25 @@ jobs:
3439
runs-on: ubuntu-latest
3540
strategy:
3641
matrix:
37-
python-version: ["3.11"]
42+
python-version: ["3.12"]
3843
steps:
3944
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
4045
- uses: actions/checkout@v4
4146
- name: Set up Python v${{ matrix.python-version }}
4247
uses: actions/setup-python@v5
4348
with:
4449
python-version: ${{ matrix.python-version }}
50+
- name: Cache dependencies
51+
uses: actions/cache@v4
52+
id: flake8-cache
53+
with:
54+
path: ${{ env.pythonLocation }}-flake8
55+
# key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-ml.txt') }}
56+
key: ${{ env.pythonLocation }}-flake8
57+
restore-keys:
58+
${{ env.pythonLocation }}-flake8
4559
- name: Install flake8
60+
if: steps.flake8-primes.outputs.cache-hit != 'true'
4661
run: pip install flake8
4762
- name: Run checks
4863
run: flake8 -v .
@@ -53,15 +68,25 @@ jobs:
5368
runs-on: ubuntu-latest
5469
strategy:
5570
matrix:
56-
python-version: ["3.11"]
71+
python-version: ["3.12"]
5772
steps:
5873
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
5974
- uses: actions/checkout@v4
6075
- name: Set up Python v${{ matrix.python-version }}
6176
uses: actions/setup-python@v5
6277
with:
6378
python-version: ${{ matrix.python-version }}
79+
- name: Cache dependencies
80+
uses: actions/cache@v4
81+
id: openapi-spec-validator-cache
82+
with:
83+
path: ${{ env.pythonLocation }}-openapi-spec-validator
84+
# key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-ml.txt') }}
85+
key: ${{ env.pythonLocation }}-openapi-spec-validator
86+
restore-keys:
87+
${{ env.pythonLocation }}-openapi-spec-validator
6488
- name: Install OpenAPI Spec Validator
89+
if: steps.openapi-spec-validator-cache.outputs.cache-hit != 'true'
6590
run: pip install openapi-spec-validator
6691
- name: Run checks
6792
run: openapi-spec-validator specs/api.yaml
@@ -75,20 +100,14 @@ jobs:
75100
run: "docker images"
76101
- name: Checkout
77102
uses: actions/checkout@v4
78-
- name: Set up QEMU
79-
uses: docker/setup-qemu-action@v2
103+
# - name: Set up QEMU
104+
# uses: docker/setup-qemu-action@v2
80105
- name: Set up Docker Buildx
81-
uses: docker/setup-buildx-action@v2
106+
uses: docker/setup-buildx-action@v3
107+
- name: List available Docker images
108+
run: "docker images"
82109
- name: Generate certificates
83110
run: make certs
84-
# So now you can use Actions' own caching!
85-
- name: Cache Docker layers
86-
uses: actions/cache@v3
87-
with:
88-
path: /tmp/.buildx-cache
89-
key: ${{ runner.os }}-buildx-${{ github.sha }}
90-
restore-keys: |
91-
${{ runner.os }}-buildx-
92111
- name: "Set software version"
93112
run: |
94113
git fetch --unshallow
@@ -106,7 +125,7 @@ jobs:
106125
# Extract Docker metadata and set labels and tags
107126
- name: Extract Docker metadata
108127
id: docker_meta
109-
uses: docker/metadata-action@v4
128+
uses: docker/metadata-action@v5
110129
with:
111130
images: ${{ env.DOCKERHUB_REPO }}
112131
tags: |
@@ -122,22 +141,21 @@ jobs:
122141
org.opencontainers.image.version=${{ env.SOFTWARE_VERSION }}.build${{ github.run_number }}
123142
# Build and tag LifeMonitor Docker image
124143
- name: Build Docker image
125-
uses: docker/build-push-action@v3
144+
uses: docker/build-push-action@v6
126145
with:
127146
context: .
128147
file: docker/lifemonitor.Dockerfile
129148
tags: ${{ steps.docker_meta.outputs.tags }}
130149
labels: ${{ steps.docker_meta.outputs.labels }}
131-
cache-from: type=local,src=/tmp/.buildx-cache
132-
cache-to: type=local,dest=/tmp/.buildx-cache-new
150+
cache-from: type=gha
151+
cache-to: type=gha,mode=max
133152
load: true
134153
build-args: |
135154
SW_VERSION=${{ env.SOFTWARE_VERSION }}
136155
BUILD_NUMBER=${{ github.run_number }}
137-
- name: Update cache
138-
run: |
139-
rm -rf /tmp/.buildx-cache
140-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
156+
# List available Docker images
157+
- name: List Docker images
158+
run: "docker images"
141159
# Setup testing environment
142160
- name: Set up testing environment
143161
# Tag the latest built image as `crs4/lifemonitor:latest`
@@ -146,14 +164,18 @@ jobs:
146164
docker images ;
147165
docker tag ${{ env.DOCKERHUB_REPO }}:${{ env.SOFTWARE_VERSION_AS_DOCKER_TAG }} crs4/lifemonitor:latest ;
148166
docker images ;
149-
SKIP_BUILD=1 SW_VERSION=${{ env.SOFTWARE_VERSION }} BUILD_NUMBER=${{ github.run_number }} make start-testing
167+
SKIP_BUILD=1 SW_VERSION=${{ env.SOFTWARE_VERSION }} BUILD_NUMBER=${{ github.run_number }} SEEK_FINAL_WAIT_TIME=30 make start-testing ;
168+
sleep 30 ;
169+
docker compose logs ;
150170
env:
151171
TRAVIS_TESTING_SERVICE_URL: ${{ secrets.TRAVIS_TESTING_SERVICE_URL }}
152172
TRAVIS_TESTING_SERVICE_TOKEN: ${{ secrets.TRAVIS_TESTING_SERVICE_TOKEN }}
153173
TRAVIS_TESTING_SERVICE_TYPE: travis
154174
GH_TESTING_SERVICE_URL: ${{ secrets.GH_TESTING_SERVICE_URL }}
155175
GH_TESTING_SERVICE_TOKEN: ${{ secrets.GH_TESTING_SERVICE_TOKEN }}
156176
GH_TESTING_SERVICE_TYPE: github
177+
CACHE_FROM: type=gha
178+
CACHE_TO: type=gha,mode=max
157179
# Run tests
158180
- name: Run tests
159181
run: SKIP_BUILD=1 SKIP_RESET_COMPOSE=1 SW_VERSION=${{ env.SOFTWARE_VERSION }} BUILD_NUMBER=${{ github.run_number }} make run-tests
@@ -169,14 +191,14 @@ jobs:
169191
run: make down
170192
# Log in to DockerHub
171193
- name: Login to Docker Hub
172-
uses: docker/login-action@v2
194+
uses: docker/login-action@v3
173195
if: ${{ env.ENABLE_DOCKER_PUSH == 'true' }}
174196
with:
175197
username: ${{ secrets.DOCKERHUB_USER }}
176198
password: ${{ secrets.DOCKERHUB_TOKEN }}
177199
# Push LifeMonitor Docker image
178200
- name: Build and push
179-
uses: docker/build-push-action@v3
201+
uses: docker/build-push-action@v6
180202
if: ${{ env.ENABLE_DOCKER_PUSH == 'true' }}
181203
with:
182204
context: .

‎Makefile‎

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ ifdef PLATFORMS
9292
platforms_opt := $(call get_opts,platforms,$(PLATFORMS))
9393
endif
9494

95+
# handle seek wait time
96+
seek_final_wait_time := 0
97+
ifdef SEEK_FINAL_WAIT_TIME
98+
seek_final_wait_time := $(SEEK_FINAL_WAIT_TIME)
99+
endif
95100

96101
all: images
97102

@@ -104,34 +109,38 @@ compose-files: docker-compose.base.yml \
104109
docker-compose.monitoring.yml \
105110
settings.conf
106111

112+
log_path:
113+
mkdir -p /tmp/lifemonitor-logs
114+
107115
prod:
108116
$(eval LM_MODE=prod)
109117

110118
dev:
111119
$(eval LM_MODE=dev)
112120

113-
certs:
114-
@if ! [[ -f "certs/lm.key" && -f "certs/lm.key" && -f "certs/lifemonitor.ca.crt" ]]; then \
115-
printf "\n$(bold)Generating certificates...$(reset)\n" ; \
116-
mkdir -p certs && \
117-
./utils/certs/gencerts.sh && \
118-
cp utils/certs/data/ca.* certs/ && \
119-
cp utils/certs/data/lm/*.pem certs/ && \
120-
mv certs/ca.pem certs/lifemonitor.ca.crt && \
121-
mv certs/cert.pem certs/lm.crt && \
122-
mv certs/key.pem certs/lm.key && \
123-
chmod 644 certs/*.{key,crt}; \
124-
printf "\n$(done)\n"; \
121+
certs:
122+
@if ! [[ -f "certs/lm.key" && -f "certs/lifemonitor.ca.crt" ]]; then \
123+
printf "\n$(bold)Generating certificates...$(reset)\n" ; \
124+
mkdir -p certs && \
125+
./utils/certs/gencerts.sh && \
126+
cp utils/certs/data/ca.* certs/ && \
127+
cp utils/certs/data/lm/*.pem certs/ && \
128+
mv certs/ca.pem certs/lifemonitor.ca.crt && \
129+
mv certs/cert.pem certs/lm.crt && \
130+
mv certs/key.pem certs/lm.key && \
131+
chmod 644 certs/*.{key,crt}; \
132+
cp -a "$$(pwd)/certs/" $$(pwd)/tests/config/registries/seek/certs ; \
133+
printf "\n$(done)\n"; \
125134
else \
126-
echo "$(yellow)WARNING: Using existing certificates$(reset)" ; \
135+
echo "$(yellow)WARNING: Using existing certificates$(reset)" ; \
127136
fi ;\
128137
if ! [[ -f "certs/jwt-key" && -f "certs/jwt-key.pub" ]]; then \
129-
printf "\n$(bold)Generating JWT keys...$(reset)\n" ; \
130-
openssl genrsa -out certs/jwt-key 4096 ; \
131-
openssl rsa -in certs/jwt-key -pubout > certs/jwt-key.pub ; \
132-
printf "\n$(done)\n"; \
138+
printf "\n$(bold)Generating JWT keys...$(reset)\n" ; \
139+
openssl genrsa -out certs/jwt-key 4096 ; \
140+
openssl rsa -in certs/jwt-key -pubout > certs/jwt-key.pub ; \
141+
printf "\n$(done)\n" ; \
133142
else \
134-
echo "$(yellow)WARNING: Using existing JWT keys $(reset)" ; \
143+
echo "$(yellow)WARNING: Using existing JWT keys $(reset)" ; \
135144
fi
136145

137146
lifemonitor: docker/lifemonitor.Dockerfile certs app.py gunicorn.conf.py ## Build LifeMonitor Docker image
@@ -141,6 +150,7 @@ lifemonitor: docker/lifemonitor.Dockerfile certs app.py gunicorn.conf.py ## Buil
141150
printf "\n$(bold)Building LifeMonitor Docker image...$(reset)\n" ; \
142151
$(build_kit) docker $(build_cmd) \
143152
--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) \
153+
--build-arg PIP_CACHE_DIR=/tmp/.buildx-cache/pip --build-arg NPM_CONFIG_CACHE=/tmp/.buildx-cache/npm \
144154
$(cache_from_opt) $(cache_to_opt) \
145155
${sw_version_arg} ${build_number_arg} ${tags_opt} ${labels_opt} ${platforms_opt} \
146156
-f docker/lifemonitor.Dockerfile -t crs4/lifemonitor . ;\
@@ -186,17 +196,17 @@ permissions: certs
186196
settings.conf \
187197
tests/config/registries/seek/nginx.conf \
188198
tests/config/registries/seek/doorkeeper.rb \
189-
&& mkdir -p /tmp/lifemonitor-logs
199+
&& mkdir -p /tmp/lifemonitor-logs && chmod a+rw /tmp/lifemonitor-logs
190200

191201

192202
aux_images: tests/config/registries/seek/seek.Dockerfile certs
193203
@printf "\n$(bold)Building auxiliary Docker images...$(reset)\n" ; \
194-
docker build -f tests/config/registries/seek/seek.Dockerfile \
195-
-t crs4/lifemonitor-tests:seek \
196-
tests/config/registries/seek/ ; \
204+
# docker build -f tests/config/registries/seek/seek.Dockerfile \
205+
# -t crs4/lifemonitor-tests:seek \
206+
# tests/config/registries/seek/ ; \
197207
printf "$(done)\n"
198208

199-
start: images compose-files prod reset_compose permissions ## Start LifeMonitor in a Production environment
209+
start: images compose-files log_path prod reset_compose permissions ## Start LifeMonitor in a Production environment
200210
@printf "\n$(bold)Starting production services...$(reset)\n" ; \
201211
base=$$(if [[ -f "docker-compose.yml" ]]; then echo "-f docker-compose.yml"; fi) ; \
202212
echo "$$(USER_UID=$$(id -u) USER_GID=$$(id -g) \
@@ -208,7 +218,7 @@ start: images compose-files prod reset_compose permissions ## Start LifeMonitor
208218
&& $(docker_compose) -f docker-compose.yml up -d redis db init lm worker ws_server nginx prometheus ;\
209219
printf "$(done)\n"
210220

211-
start-dev: images compose-files dev reset_compose permissions ## Start LifeMonitor in a Development environment
221+
start-dev: images compose-files dev log_path reset_compose permissions ## Start LifeMonitor in a Development environment
212222
@printf "\n$(bold)Starting development services...$(reset)\n" ; \
213223
base=$$(if [[ -f "docker-compose.yml" ]]; then echo "-f docker-compose.yml"; fi) ; \
214224
echo "$$(USER_UID=$$(id -u) USER_GID=$$(id -g) \
@@ -221,9 +231,8 @@ start-dev: images compose-files dev reset_compose permissions ## Start LifeMonit
221231
&& $(docker_compose) -f docker-compose.yml up -d redis db dev_proxy github_event_proxy init lm worker ws_server prometheus nginx ;\
222232
printf "$(done)\n"
223233

224-
start-testing: compose-files aux_images ro_crates images reset_compose permissions ## Start LifeMonitor in a Testing environment
225-
@printf "\n$(bold)Starting testing services...$(reset)\n" ; \
226-
base=$$(if [[ -f "docker-compose.yml" ]]; then echo "-f docker-compose.yml"; fi) ; \
234+
.start-testing: compose-files aux_images ro_crates log_path images reset_compose permissions ## Start LifeMonitor in a Testing environment
235+
@base=$$(if [[ -f "docker-compose.yml" ]]; then echo "-f docker-compose.yml"; fi) ; \
227236
echo "$$(USER_UID=$$(id -u) USER_GID=$$(id -g) \
228237
$(docker_compose) $${base} \
229238
-f docker-compose.extra.yml \
@@ -233,12 +242,22 @@ start-testing: compose-files aux_images ro_crates images reset_compose permissio
233242
-f docker-compose.test.yml \
234243
config)" > docker-compose.yml \
235244
&& cp {,.test.}docker-compose.yml \
236-
&& $(docker_compose) -f docker-compose.yml up -d db lmtests seek jenkins webserver worker ws_server ;\
237-
$(docker_compose) -f ./docker-compose.yml \
238-
exec -T lmtests /bin/bash -c "tests/wait-for-seek.sh 600"; \
239-
printf "$(done)\n"
245+
&& $(docker_compose) -f docker-compose.yml up -d db lmtests seek jenkins webserver worker ws_server \
246+
&& $(docker_compose) -f ./docker-compose.yml \
247+
exec -T lmtests /bin/bash -c "SEEK_FINAL_WAIT_TIME=$(seek_final_wait_time) tests/wait-for-seek.sh 600" \
248+
&& $(docker_compose) exec lmtests pytest tests/test_users.py::test_user1[RegistryType.SEEK] > /dev/null 2>&1 || echo "Testing environment initialized!" \
249+
&& $(docker_compose) restart db lmtests \
250+
&& printf "$(done)\n"
251+
252+
start-testing:
253+
@printf "\n$(bold)Starting testing services...$(reset)\n " ; \
254+
if [ -f /tmp/.lifemonitor-testing-started ]; then \
255+
printf "$(yellow)WARNING: Testing environment already started, skipping...$(reset)" ; \
256+
else \
257+
$(MAKE) .start-testing && touch /tmp/.lifemonitor-testing-started ; \
258+
fi
240259

241-
start-maintenance: compose-files aux_images ro_crates images reset_compose permissions ## Start LifeMonitor in a Testing environment
260+
start-maintenance: compose-files aux_images ro_crates log_path images reset_compose permissions ## Start LifeMonitor in a Testing environment
242261
@printf "\n$(bold)Starting testing services...$(reset)\n" ; \
243262
base=$$(if [[ -f "docker-compose.yml" ]]; then echo "-f docker-compose.yml"; fi) ; \
244263
echo "$$(USER_UID=$$(id -u) USER_GID=$$(id -g) \
@@ -278,8 +297,10 @@ start-aux-services: aux_images ro_crates docker-compose.extra.yml permissions ##
278297
# && $(docker_compose) up -d jupyter ; \
279298
# printf "$(done)\n"
280299

281-
run-tests: start-testing ## Run all tests in the Testing Environment
282-
@printf "\n$(bold)Running tests...$(reset)\n" ; \
300+
run-tests: ## Run all tests in the Testing Environment
301+
@export SKIP_RESET_COMPOSE=1 ; \
302+
$(MAKE) start-testing ; \
303+
printf "\n$(bold)Running tests...$(reset)\n" ; \
283304
$(docker_compose) exec -T lmtests /bin/bash -c "pytest --durations=10 --color=yes tests"
284305

285306

@@ -319,9 +340,11 @@ stop-testing: compose-files ## Stop all the services in the Testing Environment
319340
USER_UID=$$(id -u) USER_GID=$$(id -g) \
320341
$(docker_compose) -f docker-compose.extra.yml \
321342
-f docker-compose.base.yml \
343+
-f docker-compose.monitoring.yml \
322344
-f docker-compose.dev.yml \
323345
-f docker-compose.test.yml \
324346
$(log_level_opt) stop db lmtests seek jenkins webserver worker ws_server ; \
347+
rm -f /tmp/.lifemonitor-testing-started ; \
325348
printf "$(done)\n"
326349

327350
stop-dev: compose-files ## Stop all services in the Develop Environment
@@ -353,7 +376,7 @@ stop-all: ## Stop all the services
353376

354377
reset_compose:
355378
@if [[ $${SKIP_RESET_COMPOSE} -eq 1 ]]; then \
356-
echo "$(bold)Skip reset of docker-compose services $(reset)" ;\
379+
echo -e "\n$(bold)Skip reset of docker-compose services $(reset)" ;\
357380
elif [[ -f "docker-compose.yml" ]]; then \
358381
cmp -s docker-compose.yml .$(LM_MODE).docker-compose.yml ; \
359382
RETVAL=$$? ; \
@@ -363,6 +386,7 @@ reset_compose:
363386
USER_UID=$$(id -u) USER_GID=$$(id -g) \
364387
$(docker_compose) down ; \
365388
rm docker-compose.yml ; \
389+
rm -rf /tmp/.lifemonitor-testing-started ; \
366390
printf "$(done)\n" ; \
367391
fi \
368392
fi
@@ -372,6 +396,7 @@ down: ## Teardown all the services
372396
echo "$(bold)Teardown all services...$(reset)" ; \
373397
USER_UID=$$(id -u) USER_GID=$$(id -g) \
374398
$(docker_compose) down ; \
399+
rm -rf /tmp/.lifemonitor-testing-started ; \
375400
printf "$(done)\n" ; \
376401
else \
377402
printf "\n$(yellow)WARNING: nothing to remove. 'docker-compose.yml' file not found!$(reset)\n\n" ; \
@@ -387,8 +412,9 @@ clean: ## Clean up the working environment (i.e., running services, network, vol
387412
printf "$(yellow)WARNING: nothing to remove. 'docker-compose.yml' file not found!$(reset)\n" ; \
388413
fi
389414
@printf "\n$(bold)Removing certs...$(reset) " ; \
390-
rm -rf certs
391-
rm -rf utils/certs/data
415+
rm -rf certs && rm -rf utils/certs/data && rm -rf tests/config/registries/seek/certs \
416+
rm -rf /tmp/lifemonitor-logs \
417+
rm -rf /tmp/.lifemonitor-testing-started \
392418
@printf "$(done)\n"
393419
@printf "\n$(bold)Removing temp files...$(reset) " ; \
394420
rm -rf {,.prod.,.dev.,.test.}docker-compose.yml
@@ -399,9 +425,9 @@ clean: ## Clean up the working environment (i.e., running services, network, vol
399425
help: ## Show help
400426
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
401427

402-
.PHONY: all images aux_images certs prod dev \
428+
.PHONY: all images aux_images prod dev certs \
403429
lifemonitor smeeio ro_crates webserver \
404-
start start-dev start-testing start-nginx start-aux-services \
430+
start start-dev start-testing .start-testing start-nginx start-aux-services \
405431
run-tests tests \
406432
stop-aux-services stop-nginx stop-testing \
407433
stop-dev stop stop-all down reset_compose clean

0 commit comments

Comments
 (0)