chore: small improvements

This commit is contained in:
ITQ
2025-11-20 07:34:26 +03:00
parent 52f3072729
commit 8e913479bc
5 changed files with 45 additions and 43 deletions
+39 -35
View File
@@ -31,7 +31,7 @@ cache:
.trivy-fs-template: &trivy-fs-scan
stage: security
image:
image:
name: aquasec/trivy:latest
entrypoint: [""]
cache:
@@ -61,7 +61,7 @@ cache:
.trivy-image-template: &trivy-image-scan
stage: security
image:
image:
name: aquasec/trivy:latest
entrypoint: [""]
cache:
@@ -138,37 +138,6 @@ cache:
when: manual
allow_failure: true
.test-template: &test-config
<<: *docker-job
stage: test
script:
- apk add --no-cache docker-compose
- |
REGISTRY_PREFIX=$CI_REGISTRY_IMAGE \
docker compose -f compose.yaml -f compose.prod.yaml \
--profile migrations --profile tests up -d -y --quiet-pull --quiet-build
- |
TEST_CONTAINER_ID=$(docker compose --profile migrations --profile tests ps -q tests -a)
timeout 600 docker wait $TEST_CONTAINER_ID
TEST_EXIT_CODE=$(docker inspect --format "{{.State.ExitCode}}" $TEST_CONTAINER_ID)
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo "Tests passed."
else
echo "Tests failed with exit code $TEST_EXIT_CODE."
exit 1
fi
- |
docker compose -f compose.yaml -f compose.prod.yaml down
artifacts:
paths:
- ./.cov
expire_in: 1 week
when: always
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
sast-filesystem:
<<: *trivy-fs-scan
@@ -217,8 +186,43 @@ build-migrations:
CONTAINERFILE: Containerfile
BUILDTARGET: migrations
run-tests:
<<: *test-config
test-e2e:
<<: *docker-job
stage: test
variables:
COMPOSE_PROFILES: |
--profile migrations
--profile tests
script:
- export PROFILES="$(printf '%s ' $COMPOSE_PROFILES)"
- apk add --no-cache docker-compose
- |
REGISTRY_PREFIX=$CI_REGISTRY_IMAGE \
docker compose -f compose.yaml -f compose.prod.yaml \
$PROFILES up -d -y --quiet-pull --quiet-build
- |
TEST_CONTAINER_ID=$(docker compose $PROFILES ps -q tests -a)
timeout 600 docker wait $TEST_CONTAINER_ID
TEST_EXIT_CODE=$(docker inspect --format "{{.State.ExitCode}}" $TEST_CONTAINER_ID)
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo "Tests passed."
else
echo "Tests failed with exit code $TEST_EXIT_CODE."
exit 1
fi
- docker compose $PROFILES logs --no-color > compose.log
- |
docker compose -f compose.yaml -f compose.prod.yaml down
artifacts:
paths:
- ./.cov
- ./compose.log
expire_in: 1 week
when: always
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
dependencies:
- build-runtime
- build-tests