Files
Arnaud Dartois 021281f3dd
Build Bifrost / build (push) Failing after 2m37s
feat: add reproducible local import validation
2026-10-29 10:56:19 +01:00

52 lines
2.1 KiB
Bash

#!/usr/bin/env bash
set -Eeuo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
if ! docker info >/dev/null 2>&1; then
echo "Docker Engine is not available. Start Docker Desktop or the local Docker daemon, then retry." >&2
exit 1
fi
version="$(bash scripts/version.sh)"
artifact_dir="$repo_root/target/e2e-artifact"
plugin_jar="$artifact_dir/sonar-bifrost-plugin-$version.jar"
if command -v cygpath >/dev/null 2>&1; then
compose_plugin_path="$(cygpath -w "$plugin_jar")"
else
compose_plugin_path="$plugin_jar"
fi
export BIFROST_PLUGIN_JAR="$compose_plugin_path"
export GITEA_TEST_USER="${GITEA_TEST_USER:-bifrost-e2e-admin}"
export GITEA_TEST_PASSWORD="${GITEA_TEST_PASSWORD:-bifrost-gitea-test-password}"
export SONAR_TEST_PASSWORD="${SONAR_TEST_PASSWORD:-bifrost-sonar-test-password}"
compose=(docker compose --project-name bifrost-e2e -f docker-compose.yml)
echo "Building plugin version $version and exporting the test JAR."
docker build --build-arg "REVISION=$version" --target export --output "type=local,dest=$artifact_dir" .
test -f "$plugin_jar" || { echo "The expected plugin JAR was not exported: $plugin_jar" >&2; exit 1; }
echo "Resetting only the isolated bifrost-e2e Compose project and its volumes."
"${compose[@]}" down --volumes --remove-orphans
echo "Starting fresh PostgreSQL, Gitea, and SonarQube services."
"${compose[@]}" up --detach --wait --wait-timeout 360 postgres gitea sonarqube
echo "Creating the disposable Gitea test administrator."
"${compose[@]}" exec --no-TTY gitea gitea admin user create \
--username "$GITEA_TEST_USER" \
--password "$GITEA_TEST_PASSWORD" \
--email "$GITEA_TEST_USER@example.test" \
--admin \
--must-change-password=false >/dev/null
echo "Running the Chromium end-to-end test against the installed plugin."
"${compose[@]}" run --build --rm e2e
echo
echo "End-to-end validation passed. The isolated stack remains available at http://localhost:9000 and http://localhost:3000."
echo "Run 'docker compose --project-name bifrost-e2e down --volumes --remove-orphans' to remove only this test stack and its data."