Compare commits
13 Commits
t-staging-
...
improve_po
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
7436607a57
|
||
|
|
2b33bbca6f
|
||
|
|
aa858f9e54
|
||
|
|
185e8cde6d
|
||
|
|
445cb89486
|
||
|
|
1c5c8cbcf1
|
||
|
|
86f1ae18ce
|
||
|
|
c3b70b5999
|
||
|
|
b2d737d636
|
||
|
|
773aa3bd30
|
||
|
|
3e28250a6a
|
||
|
|
34ec06040b
|
||
|
|
4aadb9e4bc
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,7 @@
|
||||
*.osc
|
||||
*.conf
|
||||
.*.sw?
|
||||
/integration/logs/*.log
|
||||
!/integration/**/*.conf
|
||||
/integration/gitea-data
|
||||
/integration/gitea-logs
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Typical workflow:
|
||||
# 1. 'make build' - prepares images
|
||||
# 2. 'make up' - spawns podman-compose
|
||||
# 3. 'make pytest' - run tests inside the tester container
|
||||
# 3. 'make pytest' - run tests inside the gwf-testclient container
|
||||
# 4. 'make down' - once the containers are not needed
|
||||
#
|
||||
# OR just run 'make test' to do it all at once.
|
||||
@@ -33,36 +33,36 @@ wait_healthy:
|
||||
@echo "Waiting for services to be healthy..."
|
||||
@echo "Waiting for gitea (max 2m)..."
|
||||
@start_time=$$(date +%s); \
|
||||
until podman exec gitea-test curl -f -s http://localhost:3000/api/v1/version >/dev/null 2>&1; do \
|
||||
until podman exec gwf-gitea-test curl -f -s http://localhost:3000/api/v1/version >/dev/null 2>&1; do \
|
||||
current_time=$$(date +%s); \
|
||||
elapsed=$$((current_time - start_time)); \
|
||||
if [ $$elapsed -gt 120 ]; then \
|
||||
echo "ERROR: Gitea failed to start within 2 minutes."; \
|
||||
echo "--- Troubleshooting Info ---"; \
|
||||
echo "Diagnostics output (curl):"; \
|
||||
podman exec gitea-test curl -v http://localhost:3000/api/v1/version || true; \
|
||||
podman exec gwf-gitea-test curl -v http://localhost:3000/api/v1/version || true; \
|
||||
echo "--- Container Logs ---"; \
|
||||
podman logs gitea-test --tail 20; \
|
||||
podman logs gwf-gitea-test --tail 20; \
|
||||
echo "--- Container Status ---"; \
|
||||
podman inspect gitea-test --format '{{.State.Status}}'; \
|
||||
podman inspect gwf-gitea-test --format '{{.State.Status}}'; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
sleep 2; \
|
||||
done
|
||||
@echo "Waiting for rabbitmq (max 2m)..."
|
||||
@start_time=$$(date +%s); \
|
||||
until podman exec rabbitmq-test rabbitmq-diagnostics check_running -q >/dev/null 2>&1; do \
|
||||
until podman exec gwf-rabbitmq-test rabbitmq-diagnostics check_running -q >/dev/null 2>&1; do \
|
||||
current_time=$$(date +%s); \
|
||||
elapsed=$$((current_time - start_time)); \
|
||||
if [ $$elapsed -gt 120 ]; then \
|
||||
echo "ERROR: RabbitMQ failed to start within 2 minutes."; \
|
||||
echo "--- Troubleshooting Info ---"; \
|
||||
echo "Diagnostics output:"; \
|
||||
podman exec rabbitmq-test rabbitmq-diagnostics check_running || true; \
|
||||
podman exec gwf-rabbitmq-test rabbitmq-diagnostics check_running || true; \
|
||||
echo "--- Container Logs ---"; \
|
||||
podman logs rabbitmq-test --tail 20; \
|
||||
podman logs gwf-rabbitmq-test --tail 20; \
|
||||
echo "--- Container Status ---"; \
|
||||
podman inspect rabbitmq-test --format '{{.State.Status}}'; \
|
||||
podman inspect gwf-rabbitmq-test --format '{{.State.Status}}'; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
sleep 2; \
|
||||
@@ -70,7 +70,7 @@ wait_healthy:
|
||||
@echo "All services are healthy!"
|
||||
|
||||
pytest:
|
||||
podman-compose exec tester pytest -v tests
|
||||
podman-compose exec gwf-testclient pytest -v -s tests 2>&1|tee logs/make_pytest.log
|
||||
|
||||
build:
|
||||
podman pull docker.io/library/rabbitmq:3.13.7-management
|
||||
@@ -91,3 +91,12 @@ up-bots-package:
|
||||
# mode B
|
||||
up-bots-local:
|
||||
GIWTF_IMAGE_SUFFIX=.local podman-compose up -d
|
||||
|
||||
clean: down
|
||||
rm -rf gitea-data/ gitea-logs/ rabbitmq-data/ workflow-pr-repos/ logs/*.log
|
||||
|
||||
distclean: clean
|
||||
CONTAINERS=`podman images|grep -P 'localhost.*(integration|gwf-).*'|awk '{print $$1}'`;\
|
||||
[ -n "$$CONTAINERS" ] && \
|
||||
podman rmi -f $$CONTAINERS || \
|
||||
true
|
||||
|
||||
@@ -10,7 +10,7 @@ This document describes the targets available in the `integration/Makefile`.
|
||||
1. `build`: Prepares all container images.
|
||||
2. `up`: Starts all services via `podman-compose`.
|
||||
3. `wait_healthy`: Polls Gitea and RabbitMQ until they are ready.
|
||||
4. `pytest`: Executes the test suite inside the `tester` container.
|
||||
4. `pytest`: Executes the test suite inside the `gwf-testclient` container.
|
||||
- **Outcome**: The environment remains active for fast iteration.
|
||||
|
||||
### `test-ci`
|
||||
@@ -30,11 +30,11 @@ This document describes the targets available in the `integration/Makefile`.
|
||||
- **Action**: Starts the container topology in detached mode.
|
||||
|
||||
### `wait_healthy`
|
||||
- **Action**: Polls the health status of `gitea-test` and `rabbitmq-test` containers.
|
||||
- **Action**: Polls the health status of `gwf-gitea-test` and `gwf-rabbitmq-test` containers.
|
||||
- **Purpose**: Ensures infrastructure is stable before test execution.
|
||||
|
||||
### `pytest`
|
||||
- **Action**: Runs `pytest -v tests/*` inside the running `tester` container.
|
||||
- **Action**: Runs `pytest -v tests/*` inside the running `gwf-testclient` container.
|
||||
- **Requirement**: The environment must already be started via `up`.
|
||||
|
||||
### `down`
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
sudo rm -rf gitea-data/ gitea-logs/ rabbitmq-data/ workflow-pr-repos/
|
||||
@@ -7,9 +7,9 @@ STATIC_ROOT_PATH = /usr/share/gitea
|
||||
APP_DATA_PATH = /var/lib/gitea/data
|
||||
PPROF_DATA_PATH = /var/lib/gitea/data/tmp/pprof
|
||||
PROTOCOL = http
|
||||
DOMAIN = gitea-test
|
||||
SSH_DOMAIN = gitea-test
|
||||
ROOT_URL = http://gitea-test:3000/
|
||||
DOMAIN = gwf-gitea-test
|
||||
SSH_DOMAIN = gwf-gitea-test
|
||||
ROOT_URL = http://gwf-gitea-test:3000/
|
||||
HTTP_PORT = 3000
|
||||
DISABLE_SSH = false
|
||||
START_SSH_SERVER = true
|
||||
@@ -39,4 +39,4 @@ LEVEL = Debug
|
||||
ENABLE_BASIC_AUTHENTICATION = true
|
||||
|
||||
[webhook]
|
||||
ALLOWED_HOST_LIST = gitea-publisher
|
||||
ALLOWED_HOST_LIST = gwf-gitea-publisher
|
||||
|
||||
@@ -16,4 +16,4 @@ echo "Starting Gitea..."
|
||||
# We will switch to that user and run the web command.
|
||||
# Using exec means Gitea will become PID 1, allowing it to receive signals correctly.
|
||||
cd /var/lib/gitea
|
||||
exec su -s /bin/bash gitea -c "/usr/bin/gitea web --config /etc/gitea/conf/app.ini"
|
||||
exec /usr/bin/gitea web --config /etc/gitea/conf/app.ini
|
||||
|
||||
@@ -4,18 +4,16 @@ set -e
|
||||
|
||||
# Set ownership on the volume mounts. This allows the 'gitea' user to write to them.
|
||||
# We use -R to ensure all subdirectories (like /var/lib/gitea/data) are covered.
|
||||
chown -R gitea:gitea /var/lib/gitea /var/log/gitea
|
||||
|
||||
# Set ownership on the config directory.
|
||||
chown -R gitea:gitea /etc/gitea
|
||||
|
||||
# Run database migrations to initialize the sqlite3 db based on app.ini.
|
||||
su -s /bin/bash gitea -c 'gitea migrate'
|
||||
gitea migrate
|
||||
|
||||
# Create a default admin user if it doesn't exist
|
||||
if ! su -s /bin/bash gitea -c 'gitea admin user list' | awk 'NR>1 && $2 == "admin" {found=1} END {exit !found}'; then
|
||||
if ! gitea admin user list | awk 'NR>1 && $2 == "admin" {found=1} END {exit !found}'; then
|
||||
echo "Creating admin user..."
|
||||
su -s /bin/bash gitea -c 'gitea admin user create --username admin --password opensuse --email admin@example.com --must-change-password=false --admin'
|
||||
gitea admin user create --username admin --password opensuse --email admin@example.com --must-change-password=false --admin
|
||||
else
|
||||
echo "Admin user already exists."
|
||||
fi
|
||||
@@ -26,11 +24,10 @@ if [ -f "$ADMIN_TOKEN_FILE" ]; then
|
||||
echo "Admin token already exists at $ADMIN_TOKEN_FILE."
|
||||
else
|
||||
echo "Generating admin token..."
|
||||
ADMIN_TOKEN=$(su -s /bin/bash gitea -c "gitea admin user generate-access-token -raw -u admin -t admin-token")
|
||||
ADMIN_TOKEN=$(gitea admin user generate-access-token -raw -u admin -t admin-token)
|
||||
if [ -n "$ADMIN_TOKEN" ]; then
|
||||
printf "%s" "$ADMIN_TOKEN" > "$ADMIN_TOKEN_FILE"
|
||||
chmod 777 "$ADMIN_TOKEN_FILE"
|
||||
chown gitea:gitea "$ADMIN_TOKEN_FILE"
|
||||
echo "Admin token generated and saved to $ADMIN_TOKEN_FILE."
|
||||
else
|
||||
echo "Failed to generate admin token."
|
||||
@@ -43,16 +40,15 @@ mkdir -p "$SSH_KEY_DIR"
|
||||
if [ ! -f "$SSH_KEY_DIR/id_ed25519" ]; then
|
||||
echo "Generating SSH key for admin user..."
|
||||
ssh-keygen -t ed25519 -N "" -f "$SSH_KEY_DIR/id_ed25519"
|
||||
chown -R gitea:gitea "$SSH_KEY_DIR"
|
||||
chmod 700 "$SSH_KEY_DIR"
|
||||
chmod 600 "$SSH_KEY_DIR/id_ed25519"
|
||||
chmod 644 "$SSH_KEY_DIR/id_ed25519.pub"
|
||||
fi
|
||||
|
||||
# Create a autogits_obs_staging_bot user if it doesn't exist
|
||||
if ! su -s /bin/bash gitea -c 'gitea admin user list' | awk 'NR>1 && $2 == "autogits_obs_staging_bot" {found=1} END {exit !found}'; then
|
||||
if ! gitea admin user list | awk 'NR>1 && $2 == "autogits_obs_staging_bot" {found=1} END {exit !found}'; then
|
||||
echo "Creating autogits_obs_staging_bot user..."
|
||||
su -s /bin/bash gitea -c 'gitea admin user create --username autogits_obs_staging_bot --password opensuse --email autogits_obs_staging_bot@example.com --must-change-password=false'
|
||||
gitea admin user create --username autogits_obs_staging_bot --password opensuse --email autogits_obs_staging_bot@example.com --must-change-password=false
|
||||
else
|
||||
echo "autogits_obs_staging_bot user already exists."
|
||||
fi
|
||||
@@ -63,11 +59,10 @@ if [ -f "$BOT_TOKEN_FILE" ]; then
|
||||
echo "autogits_obs_staging_bot token already exists at $BOT_TOKEN_FILE."
|
||||
else
|
||||
echo "Generating autogits_obs_staging_bot token..."
|
||||
BOT_TOKEN=$(su -s /bin/bash gitea -c "gitea admin user generate-access-token -raw -u autogits_obs_staging_bot -t autogits_obs_staging_bot-token")
|
||||
BOT_TOKEN=$(gitea admin user generate-access-token -raw -u autogits_obs_staging_bot -t autogits_obs_staging_bot-token)
|
||||
if [ -n "$BOT_TOKEN" ]; then
|
||||
printf "%s" "$BOT_TOKEN" > "$BOT_TOKEN_FILE"
|
||||
chmod 666 "$BOT_TOKEN_FILE"
|
||||
chown gitea:gitea "$BOT_TOKEN_FILE"
|
||||
echo "autogits_obs_staging_bot token generated and saved to $BOT_TOKEN_FILE."
|
||||
else
|
||||
echo "Failed to generate autogits_obs_staging_bot token."
|
||||
@@ -75,9 +70,9 @@ else
|
||||
fi
|
||||
|
||||
# Create a workflow-pr user if it doesn't exist
|
||||
if ! su -s /bin/bash gitea -c 'gitea admin user list' | awk 'NR>1 && $2 == "workflow-pr" {found=1} END {exit !found}'; then
|
||||
if ! gitea admin user list | awk 'NR>1 && $2 == "workflow-pr" {found=1} END {exit !found}'; then
|
||||
echo "Creating workflow-pr user..."
|
||||
su -s /bin/bash gitea -c 'gitea admin user create --username workflow-pr --password opensuse --email workflow-pr@example.com --must-change-password=false'
|
||||
gitea admin user create --username workflow-pr --password opensuse --email workflow-pr@example.com --must-change-password=false
|
||||
else
|
||||
echo "workflow-pr user already exists."
|
||||
fi
|
||||
@@ -88,11 +83,10 @@ if [ -f "$BOT_TOKEN_FILE" ]; then
|
||||
echo "workflow-pr token already exists at $BOT_TOKEN_FILE."
|
||||
else
|
||||
echo "Generating workflow-pr token..."
|
||||
BOT_TOKEN=$(su -s /bin/bash gitea -c "gitea admin user generate-access-token -raw -u workflow-pr -t workflow-pr-token")
|
||||
BOT_TOKEN=$(gitea admin user generate-access-token -raw -u workflow-pr -t workflow-pr-token)
|
||||
if [ -n "$BOT_TOKEN" ]; then
|
||||
printf "%s" "$BOT_TOKEN" > "$BOT_TOKEN_FILE"
|
||||
chmod 666 "$BOT_TOKEN_FILE"
|
||||
chown gitea:gitea "$BOT_TOKEN_FILE"
|
||||
echo "workflow-pr token generated and saved to $BOT_TOKEN_FILE."
|
||||
else
|
||||
echo "Failed to generate workflow-pr token."
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set -e
|
||||
|
||||
GITEA_URL="http://localhost:3000"
|
||||
WEBHOOK_URL="http://gitea-publisher:8002/rabbitmq-forwarder"
|
||||
WEBHOOK_URL="http://gwf-gitea-publisher:8002/rabbitmq-forwarder"
|
||||
TOKEN_NAME="webhook-creator"
|
||||
|
||||
echo "Webhook setup script started in background."
|
||||
|
||||
0
integration/logs/.keep
Normal file
0
integration/logs/.keep
Normal file
7
integration/obs/base/Dockerfile
Normal file
7
integration/obs/base/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
#!BuildTag: openbuildservice/gwf-test-basecontainer
|
||||
#!UseOBSRepositories
|
||||
FROM registry.suse.com/bci/bci-base:15.7
|
||||
|
||||
RUN zypper -n install binutils gawk git git-core git-lfs jq make openssh openssh-clients sqlite3 vim which
|
||||
|
||||
RUN zypper -n install autogits-gitea-events-rabbitmq-publisher autogits-obs-staging-bot autogits-workflow-pr gitea
|
||||
5
integration/obs/client/Dockerfile
Normal file
5
integration/obs/client/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
#!BuildTag: openbuildservice/gwf-client
|
||||
#!UseOBSRepositories
|
||||
FROM opensuse/tumbleweed
|
||||
|
||||
RUN zypper -n install podman podman-compose vim make python3-pytest python3-requests python3-pytest-dependency python3-pytest-httpserver
|
||||
@@ -9,7 +9,7 @@ This document describes the services defined in `podman-compose.yml` used for in
|
||||
|
||||
### gitea
|
||||
- **Description**: Self-hosted Git service, serving as the central hub for repositories.
|
||||
- **Container Name**: `gitea-test`
|
||||
- **Container Name**: `gwf-gitea-test`
|
||||
- **Image**: Built from `./gitea/Dockerfile`
|
||||
- **Ports**: `3000` (HTTP), `3022` (SSH)
|
||||
- **Volumes**: `./gitea-data` (persistent data), `./gitea-logs` (logs)
|
||||
@@ -17,39 +17,39 @@ This document describes the services defined in `podman-compose.yml` used for in
|
||||
|
||||
### rabbitmq
|
||||
- **Description**: Message broker for asynchronous communication between services.
|
||||
- **Container Name**: `rabbitmq-test`
|
||||
- **Container Name**: `gwf-rabbitmq-test`
|
||||
- **Image**: `rabbitmq:3.13.7-management`
|
||||
- **Ports**: `5671` (AMQP with TLS), `15672` (Management UI)
|
||||
- **Volumes**: `./rabbitmq-data`, `./rabbitmq-config/certs`, `./rabbitmq-config/rabbitmq.conf`, `./rabbitmq-config/definitions.json`
|
||||
- **Healthcheck**: Ensures the broker is running and ready to accept connections.
|
||||
|
||||
### gitea-publisher
|
||||
### gwf-gitea-publisher
|
||||
- **Description**: Publishes events from Gitea webhooks to the RabbitMQ message queue.
|
||||
- **Container Name**: `gitea-publisher`
|
||||
- **Container Name**: `gwf-gitea-publisher`
|
||||
- **Dependencies**: `gitea` (started), `rabbitmq` (healthy)
|
||||
- **Topic Domain**: `suse`
|
||||
|
||||
### workflow-pr
|
||||
### gwf-workflow-pr
|
||||
- **Description**: Manages pull request workflows, synchronizing between ProjectGit and PackageGit.
|
||||
- **Container Name**: `workflow-pr`
|
||||
- **Container Name**: `gwf-workflow-pr`
|
||||
- **Dependencies**: `gitea` (started), `rabbitmq` (healthy)
|
||||
- **Environment**: Configured via `AUTOGITS_*` variables.
|
||||
- **Volumes**: `./gitea-data` (read-only), `./workflow-pr/workflow-pr.json` (config), `./workflow-pr-repos` (working directories)
|
||||
|
||||
### tester
|
||||
### gwf-testclient
|
||||
- **Description**: The dedicated test runner container. It hosts the `pytest` suite and provides a mock OBS API using `pytest-httpserver`.
|
||||
- **Container Name**: `tester`
|
||||
- **Image**: Built from `./Dockerfile.tester`
|
||||
- **Container Name**: `gwf-testclient`
|
||||
- **Image**: Built from `./Dockerfile.gwf-testclient`
|
||||
- **Mock API**: Listens on port `8080` within the container network to simulate OBS.
|
||||
- **Volumes**: Project root mounted at `/opt/project` for source access.
|
||||
|
||||
### obs-staging-bot
|
||||
- **Description**: Interacts with Gitea and the OBS API (mocked by `tester`) to manage staging projects.
|
||||
- **Container Name**: `obs-staging-bot`
|
||||
- **Dependencies**: `gitea` (started), `tester` (started)
|
||||
### gwf-obs-staging-bot
|
||||
- **Description**: Interacts with Gitea and the OBS API (mocked by `gwf-testclient`) to manage staging projects.
|
||||
- **Container Name**: `gwf-obs-staging-bot`
|
||||
- **Dependencies**: `gitea` (started), `gwf-testclient` (started)
|
||||
- **Environment**:
|
||||
- `AUTOGITS_STAGING_BOT_POLL_INTERVAL`: Set to `2s` for fast integration testing.
|
||||
- **Mock Integration**: Points to `http://tester:8080` for both OBS API and Web hosts.
|
||||
- **Mock Integration**: Points to `http://gwf-testclient:8080` for both OBS API and Web hosts.
|
||||
|
||||
---
|
||||
|
||||
@@ -58,7 +58,7 @@ This document describes the services defined in `podman-compose.yml` used for in
|
||||
1. **Build**: `make build` (root) then `make build` (integration).
|
||||
2. **Up**: `make up` starts all services.
|
||||
3. **Wait**: `make wait_healthy` ensures infrastructure is ready.
|
||||
4. **Test**: `make pytest` runs the suite inside the `tester` container.
|
||||
4. **Test**: `make pytest` runs the suite inside the `gwf-testclient` container.
|
||||
5. **Down**: `make down` stops and removes containers.
|
||||
|
||||
Use `make test` to perform steps 1-4 automatically.
|
||||
|
||||
@@ -5,9 +5,9 @@ networks:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
gitea:
|
||||
gwf-gitea-test:
|
||||
build: ./gitea
|
||||
container_name: gitea-test
|
||||
container_name: gwf-gitea-test
|
||||
init: true
|
||||
environment:
|
||||
- GITEA_WORK_DIR=/var/lib/gitea
|
||||
@@ -24,10 +24,16 @@ services:
|
||||
# Persist Gitea's logs to a local directory
|
||||
- ./gitea-logs:/var/log/gitea:Z
|
||||
restart: unless-stopped
|
||||
userns_mode: "keep-id:uid=497,gid=483"
|
||||
user: "497:497"
|
||||
logging:
|
||||
driver: "k8s-file"
|
||||
options:
|
||||
path: "logs/gwf-gitea-test.log"
|
||||
|
||||
rabbitmq:
|
||||
gwf-rabbitmq:
|
||||
image: rabbitmq:3.13.7-management
|
||||
container_name: rabbitmq-test
|
||||
container_name: gwf-rabbitmq-test
|
||||
init: true
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmq-diagnostics", "check_running", "-q"]
|
||||
@@ -51,33 +57,42 @@ services:
|
||||
# Mount exchange definitions
|
||||
- ./rabbitmq-config/definitions.json:/etc/rabbitmq/definitions.json:Z
|
||||
restart: unless-stopped
|
||||
userns_mode: "keep-id"
|
||||
logging:
|
||||
driver: "k8s-file"
|
||||
options:
|
||||
path: "logs/gwf-rabbitmq-test.log"
|
||||
|
||||
gitea-publisher:
|
||||
gwf-gitea-publisher:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: integration/gitea-events-rabbitmq-publisher/Dockerfile${GIWTF_IMAGE_SUFFIX}
|
||||
container_name: gitea-publisher
|
||||
container_name: gwf-gitea-publisher
|
||||
init: true
|
||||
networks:
|
||||
- gitea-network
|
||||
depends_on:
|
||||
gitea:
|
||||
gwf-gitea-test:
|
||||
condition: service_started
|
||||
rabbitmq:
|
||||
gwf-rabbitmq:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
- RABBITMQ_HOST=rabbitmq-test
|
||||
- RABBITMQ_HOST=gwf-rabbitmq-test
|
||||
- RABBITMQ_USERNAME=gitea
|
||||
- RABBITMQ_PASSWORD=gitea
|
||||
- SSL_CERT_FILE=/usr/share/pki/trust/anchors/gitea-rabbitmq-ca.crt
|
||||
command: [ "-listen", "0.0.0.0:8002", "-topic-domain", "suse", "-debug" ]
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "k8s-file"
|
||||
options:
|
||||
path: "logs/gwf-gitea-publisher.log"
|
||||
|
||||
workflow-pr:
|
||||
gwf-workflow-pr:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: integration/workflow-pr/Dockerfile${GIWTF_IMAGE_SUFFIX}
|
||||
container_name: workflow-pr
|
||||
container_name: gwf-workflow-pr
|
||||
init: true
|
||||
networks:
|
||||
- gitea-network
|
||||
@@ -87,9 +102,9 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
depends_on:
|
||||
gitea:
|
||||
gwf-gitea-test:
|
||||
condition: service_started
|
||||
rabbitmq:
|
||||
gwf-rabbitmq:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
- AMQP_USERNAME=gitea
|
||||
@@ -99,21 +114,25 @@ services:
|
||||
- ./gitea-data:/var/lib/gitea:ro,z
|
||||
- ./workflow-pr/workflow-pr.json:/etc/workflow-pr.json:ro,z
|
||||
- ./workflow-pr-repos:/var/lib/workflow-pr/repos:Z
|
||||
command: [
|
||||
command: [
|
||||
"-check-on-start",
|
||||
"-debug",
|
||||
"-gitea-url", "http://gitea-test:3000",
|
||||
"-url", "amqps://rabbitmq-test:5671",
|
||||
"-debug",
|
||||
"-gitea-url", "http://gwf-gitea-test:3000",
|
||||
"-url", "amqps://gwf-rabbitmq-test:5671",
|
||||
"-config", "/etc/workflow-pr.json",
|
||||
"-repo-path", "/var/lib/workflow-pr/repos"
|
||||
]
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "k8s-file"
|
||||
options:
|
||||
path: "logs/gwf-workflow-pr.log"
|
||||
|
||||
tester:
|
||||
gwf-testclient:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.tester
|
||||
container_name: tester
|
||||
dockerfile: Dockerfile.gwf-testclient
|
||||
container_name: gwf-testclient
|
||||
init: true
|
||||
dns_search: .
|
||||
networks:
|
||||
@@ -124,17 +143,21 @@ services:
|
||||
volumes:
|
||||
- ..:/opt/project:z
|
||||
command: sleep infinity
|
||||
logging:
|
||||
driver: "k8s-file"
|
||||
options:
|
||||
path: "logs/gwf-testclient.log"
|
||||
|
||||
obs-staging-bot:
|
||||
gwf-obs-staging-bot:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: integration/obs-staging-bot/Dockerfile${GIWTF_IMAGE_SUFFIX}
|
||||
container_name: obs-staging-bot
|
||||
container_name: gwf-obs-staging-bot
|
||||
init: true
|
||||
networks:
|
||||
- gitea-network
|
||||
depends_on:
|
||||
workflow-pr:
|
||||
gwf-workflow-pr:
|
||||
condition: service_started
|
||||
environment:
|
||||
- OBS_USER=mock
|
||||
@@ -144,7 +167,11 @@ services:
|
||||
- ./gitea-data:/gitea-data:ro,z
|
||||
command:
|
||||
- "-debug"
|
||||
- "-gitea-url=http://gitea-test:3000"
|
||||
- "-obs=http://tester:8080"
|
||||
- "-obs-web=http://tester:8080"
|
||||
- "-gitea-url=http://gwf-gitea-test:3000"
|
||||
- "-obs=http://gwf-testclient:8080"
|
||||
- "-obs-web=http://gwf-testclient:8080"
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "k8s-file"
|
||||
options:
|
||||
path: "logs/gwf-obs-staging-bot.log"
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
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
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
@@ -38,7 +38,7 @@ def default_obs_handlers(httpserver, obs_mock_state):
|
||||
"""
|
||||
def project_meta_handler(request):
|
||||
project = request.path.split("/")[2]
|
||||
scmsync = obs_mock_state.project_metas.get(project, "http://gitea-test:3000/myproducts/mySLFO.git")
|
||||
scmsync = obs_mock_state.project_metas.get(project, "http://gwf-gitea-test:3000/myproducts/mySLFO.git")
|
||||
return f'<project name="{project}"><scmsync>{scmsync}</scmsync></project>'
|
||||
|
||||
def build_result_handler(request):
|
||||
@@ -54,7 +54,7 @@ def default_obs_handlers(httpserver, obs_mock_state):
|
||||
# or we can use the template. For simplicity, let's use a basic one.
|
||||
xml_template = f"""<resultlist state="mock">
|
||||
<result project="{project}" repository="standard" arch="x86_64" code="unpublished" state="unpublished">
|
||||
<scmsync>http://gitea-test:3000/myproducts/mySLFO.git?onlybuild={package_name}#sha</scmsync>
|
||||
<scmsync>http://gwf-gitea-test:3000/myproducts/mySLFO.git?onlybuild={package_name}#sha</scmsync>
|
||||
<status package="{package_name}" code="{code}"/>
|
||||
</result>
|
||||
</resultlist>"""
|
||||
@@ -283,7 +283,7 @@ def gitea_env():
|
||||
"webhooks": set(),
|
||||
}
|
||||
|
||||
gitea_url = "http://gitea-test:3000"
|
||||
gitea_url = "http://gwf-gitea-test:3000"
|
||||
admin_token_path = os.path.join(os.path.dirname(__file__), "..", "gitea-data", "admin.token")
|
||||
|
||||
admin_token = None
|
||||
@@ -329,7 +329,7 @@ def gitea_env():
|
||||
else: stats["repos"]["reused"] += 1
|
||||
|
||||
# Create webhook for publisher
|
||||
new_hook = client.create_webhook(org, repo, "http://gitea-publisher:8002/rabbitmq-forwarder")
|
||||
new_hook = client.create_webhook(org, repo, "http://gwf-gitea-publisher:8002/rabbitmq-forwarder")
|
||||
if repo_full not in handled_in_session["webhooks"]:
|
||||
handled_in_session["webhooks"].add(repo_full)
|
||||
if new_hook: stats["webhooks"]["new"] += 1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<title>openSUSE Leap 16.0 based on SLFO</title>
|
||||
<description>Leap 16.0 based on SLES 16.0 (specifically SLFO:1.2)</description>
|
||||
<link project="openSUSE:Backports:SLE-16.0"/>
|
||||
<scmsync>http://gitea-test:3000/myproducts/mySLFO#staging-main</scmsync>
|
||||
<scmsync>http://gwf-gitea-test:3000/myproducts/mySLFO#staging-main</scmsync>
|
||||
<person userid="dimstar_suse" role="maintainer"/>
|
||||
<person userid="lkocman-factory" role="maintainer"/>
|
||||
<person userid="maxlin_factory" role="maintainer"/>
|
||||
|
||||
@@ -65,12 +65,6 @@ class GiteaAPIClient:
|
||||
return None
|
||||
raise
|
||||
|
||||
def get_submodule_sha(self, owner: str, repo: str, submodule_path: str, ref: str = "main"):
|
||||
info = self.get_file_info(owner, repo, submodule_path, branch=ref)
|
||||
if info and info.get("type") == "submodule":
|
||||
return info.get("sha")
|
||||
return None
|
||||
|
||||
def create_user(self, username, password, email):
|
||||
vprint(f"--- Creating user: {username} ---")
|
||||
data = {
|
||||
@@ -244,7 +238,7 @@ index 00000000..{pkg_b_sha}
|
||||
if hook["config"]["url"] == target_url:
|
||||
vprint(f"Webhook for {owner}/{repo} already exists with correct URL.")
|
||||
return False
|
||||
elif "gitea-publisher" in hook["config"]["url"] or "10.89.0." in hook["config"]["url"]:
|
||||
elif "gitea-publisher" in hook["config"]["url"] or "gwf-gitea-publisher" in hook["config"]["url"] or "10.89.0." in hook["config"]["url"]:
|
||||
vprint(f"Found old webhook {hook['id']} with URL {hook['config']['url']}. Deleting...")
|
||||
self._request("DELETE", f"{url}/{hook['id']}")
|
||||
except requests.exceptions.HTTPError:
|
||||
@@ -531,14 +525,6 @@ index 00000000..{pkg_b_sha}
|
||||
|
||||
return review
|
||||
|
||||
def request_reviewers(self, repo_full_name: str, pr_number: int, reviewers: list):
|
||||
owner, repo = repo_full_name.split("/")
|
||||
url = f"repos/{owner}/{repo}/pulls/{pr_number}/requested_reviewers"
|
||||
data = {"reviewers": reviewers}
|
||||
vprint(f"--- Requesting reviewers for {repo_full_name} PR #{pr_number}: {reviewers} ---")
|
||||
response, duration = self._request("POST", url, json=data)
|
||||
return response.json()
|
||||
|
||||
def list_reviews(self, repo_full_name: str, pr_number: int):
|
||||
owner, repo = repo_full_name.split("/")
|
||||
url = f"repos/{owner}/{repo}/pulls/{pr_number}/reviews"
|
||||
@@ -604,35 +590,3 @@ index 00000000..{pkg_b_sha}
|
||||
|
||||
time.sleep(1)
|
||||
return package_merged, project_merged
|
||||
|
||||
def wait_for_comment(self, repo_full_name: str, pr_number: int, text_to_find: str, subtext: str = None, timeout: int = 60):
|
||||
"""Wait for a specific comment in the PR timeline."""
|
||||
vprint(f"Waiting for comment '{text_to_find}'" + (f" with subtext '{subtext}'" if subtext else "") + f" in {repo_full_name} PR #{pr_number}...")
|
||||
for _ in range(timeout):
|
||||
time.sleep(1)
|
||||
try:
|
||||
events = self.get_timeline_events(repo_full_name, pr_number)
|
||||
except Exception:
|
||||
continue
|
||||
for event in events:
|
||||
body = event.get("body", "")
|
||||
if not body:
|
||||
continue
|
||||
if subtext:
|
||||
if text_to_find in body and subtext in body:
|
||||
return True
|
||||
else:
|
||||
if text_to_find == body.strip():
|
||||
return True
|
||||
return False
|
||||
|
||||
def create_submodule_diff(submodule_name, old_sha, new_sha):
|
||||
"""Create a git diff string for updating a submodule commit ID."""
|
||||
return f"""diff --git a/{submodule_name} b/{submodule_name}
|
||||
index {old_sha[:7]}..{new_sha[:7]} 160000
|
||||
--- a/{submodule_name}
|
||||
+++ b/{submodule_name}
|
||||
@@ -1 +1 @@
|
||||
-Subproject commit {old_sha}
|
||||
+Subproject commit {new_sha}
|
||||
"""
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
import time
|
||||
import re
|
||||
from tests.lib.common_test_utils import vprint, create_submodule_diff
|
||||
|
||||
def wait_for_staging_bot_reviewer(gitea_env, prj_pr_number, timeout=30):
|
||||
"""Wait for staging-bot to be added as a reviewer."""
|
||||
for _ in range(timeout):
|
||||
time.sleep(1)
|
||||
pr_details = gitea_env.get_pr_details("myproducts/mySLFO", prj_pr_number)
|
||||
if any(
|
||||
r.get("login") == "autogits_obs_staging_bot"
|
||||
for r in pr_details.get("requested_reviewers", [])
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
# This will hold the current status for the mock OBS server.
|
||||
_obs_mock_state = {
|
||||
"project_name": "",
|
||||
"repo_arch_package_status": {}
|
||||
}
|
||||
|
||||
def setup_obs_mock(httpserver, project_name, repo_arch_package_status):
|
||||
"""Setup OBS mock handlers using the provided status dictionary."""
|
||||
_obs_mock_state["project_name"] = project_name
|
||||
_obs_mock_state["repo_arch_package_status"] = repo_arch_package_status
|
||||
|
||||
def general_project_meta_handler(request):
|
||||
project = request.path.split("/")[2]
|
||||
return f'<project name="{project}"><scmsync>http://gitea-test:3000/myproducts/mySLFO.git</scmsync></project>'
|
||||
|
||||
def build_result_handler(request):
|
||||
return create_build_result_xml(_obs_mock_state["project_name"], _obs_mock_state["repo_arch_package_status"])
|
||||
|
||||
httpserver.clear()
|
||||
httpserver.expect_request(re.compile(r"/source/[^/]+/_meta$"), method="GET").respond_with_handler(general_project_meta_handler)
|
||||
httpserver.expect_request(re.compile(f"/build/{project_name}/_result"), method="GET").respond_with_handler(build_result_handler)
|
||||
httpserver.expect_request(re.compile(r"/source/[^/]+/_meta$"), method="PUT").respond_with_data("OK")
|
||||
httpserver.expect_request(re.compile(r"/source/[^/]+$"), method="DELETE").respond_with_data("OK")
|
||||
|
||||
## We don't clear anymore to preserve conftest defaults
|
||||
# httpserver.expect_request(re.compile(f"/source/{project_name}/_meta$"), method="GET").respond_with_handler(general_project_meta_handler)
|
||||
# httpserver.expect_request(re.compile(f"/build/{project_name}/_result"), method="GET").respond_with_handler(build_result_handler)
|
||||
# httpserver.expect_request(re.compile(f"/source/{project_name}/_meta$"), method="PUT").respond_with_data("OK")
|
||||
|
||||
# httpserver.expect_request(re.compile(f"/source/{project_name}$"), method="DELETE").respond_with_data("OK")
|
||||
|
||||
def create_build_result_xml(project_name, repo_arch_package_status):
|
||||
"""Create the XML response for OBS build results."""
|
||||
results_xml = ""
|
||||
grouped = {}
|
||||
for (repo, arch, package), (repo_code, pkg_code) in repo_arch_package_status.items():
|
||||
if (repo, arch) not in grouped:
|
||||
grouped[(repo, arch)] = {"repo_code": repo_code, "packages": []}
|
||||
grouped[(repo, arch)]["packages"].append((package, pkg_code))
|
||||
|
||||
for (repo, arch), data in grouped.items():
|
||||
repo_code = data["repo_code"]
|
||||
pkg_statuses = "".join([f'\n <status package="{p}" code="{c}"/>' for p, c in data["packages"]])
|
||||
results_xml += f"""
|
||||
<result project="{project_name}" repository="{repo}" arch="{arch}" code="{repo_code}" state="{repo_code}">{pkg_statuses}
|
||||
</result>"""
|
||||
return f'<resultlist state="mock">{results_xml}\n</resultlist>'
|
||||
|
||||
def prepare_multi_package_test(gitea_env, merge_branch_name, test_name_suffix):
|
||||
"""
|
||||
Step 1: Create package PRs and project PR with submodule updates.
|
||||
Returns (pkg_pr_num1, pkg_pr_num2, prj_pr_number)
|
||||
"""
|
||||
diff = f"diff --git a/test_br_{test_name_suffix}_pkgA.txt b/test_br_{test_name_suffix}_pkgA.txt\nnew file mode 100644\nindex 00000000..473a0f4c\n"
|
||||
pr1 = gitea_env.create_gitea_pr("mypool/pkgA", diff, f"Test BR {test_name_suffix} PR A", False, base_branch=merge_branch_name)
|
||||
pkg_pr_number1 = pr1["number"]
|
||||
pkg_head_sha1 = pr1["head"]["sha"]
|
||||
|
||||
diff2 = f"diff --git a/test_br_{test_name_suffix}_pkgB.txt b/test_br_{test_name_suffix}_pkgB.txt\nnew file mode 100644\nindex 00000000..473a0f4c\n"
|
||||
pr2 = gitea_env.create_gitea_pr("mypool/pkgB", diff2, f"Test BR {test_name_suffix} PR B", False, base_branch=merge_branch_name)
|
||||
pkg_pr_number2 = pr2["number"]
|
||||
pkg_head_sha2 = pr2["head"]["sha"]
|
||||
|
||||
# Close automatically created project PRs for each package PR
|
||||
for repo, num in [("mypool/pkgA", pkg_pr_number1), ("mypool/pkgB", pkg_pr_number2)]:
|
||||
prj_pr_num = gitea_env.wait_for_project_pr(repo, num)
|
||||
if prj_pr_num:
|
||||
vprint(f"Closing automatically created project PR #{prj_pr_num} for {repo}#{num}")
|
||||
gitea_env.update_gitea_pr_properties("myproducts/mySLFO", prj_pr_num, state="closed")
|
||||
|
||||
old_sha1 = gitea_env.get_submodule_sha("myproducts", "mySLFO", "pkgA", ref=merge_branch_name)
|
||||
old_sha2 = gitea_env.get_submodule_sha("myproducts", "mySLFO", "pkgB", ref=merge_branch_name)
|
||||
|
||||
prj_diff = create_submodule_diff("pkgA", old_sha1, pkg_head_sha1)
|
||||
prj_diff += create_submodule_diff("pkgB", old_sha2, pkg_head_sha2)
|
||||
|
||||
body = f"PR: mypool/pkgA!{pkg_pr_number1}\nPR: mypool/pkgB!{pkg_pr_number2}"
|
||||
prj_pr = gitea_env.create_gitea_pr("myproducts/mySLFO", prj_diff, f"Test Project PR Multi {test_name_suffix}", False, base_branch=merge_branch_name, body=body)
|
||||
prj_pr_number = prj_pr["number"]
|
||||
|
||||
return pkg_pr_number1, pkg_pr_number2, prj_pr_number
|
||||
|
||||
def finish_multi_package_setup(gitea_env, prj_pr_number, httpserver):
|
||||
"""
|
||||
Step 2: Configure OBS mock and only THEN add staging_bot as reviewer.
|
||||
Returns (project_name, repo_arch_package_status, repos, archs)
|
||||
"""
|
||||
project_name = f"openSUSE:Leap:16.0:PullRequest:{prj_pr_number}"
|
||||
repos = ["repo1", "repo2"]
|
||||
archs = ["x86_64", "aarch64"]
|
||||
packages = ["pkgA", "pkgB"]
|
||||
repo_arch_package_status = {}
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
for p in packages:
|
||||
repo_arch_package_status[(r, a, p)] = ("building", "building")
|
||||
|
||||
setup_obs_mock(httpserver, project_name, repo_arch_package_status)
|
||||
|
||||
# Add staging_bot as a reviewer AFTER mock is ready
|
||||
gitea_env.request_reviewers("myproducts/mySLFO", prj_pr_number, ["autogits_obs_staging_bot"])
|
||||
assert wait_for_staging_bot_reviewer(gitea_env, prj_pr_number), "Staging bot was not added as a reviewer."
|
||||
|
||||
# Expected Result 1: "Build is started in..."
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build is started in", project_name), "Staging bot did not post 'Build is started' comment."
|
||||
|
||||
return project_name, repo_arch_package_status, repos, archs
|
||||
@@ -1,285 +0,0 @@
|
||||
import pytest
|
||||
import time
|
||||
from tests.lib.common_test_utils import GiteaAPIClient, vprint, create_submodule_diff
|
||||
from tests.lib.staging_test_utils import (
|
||||
wait_for_staging_bot_reviewer,
|
||||
setup_obs_mock,
|
||||
create_build_result_xml,
|
||||
prepare_multi_package_test,
|
||||
finish_multi_package_setup
|
||||
)
|
||||
|
||||
@pytest.mark.t001
|
||||
def test_001_build_on_all_archs_success(staging_main_env, httpserver):
|
||||
gitea_env, test_full_repo_name, merge_branch_name = staging_main_env
|
||||
|
||||
# 1. Create a package PR.
|
||||
diff = "diff --git a/test_br.txt b/test_br.txt\nnew file mode 100644\nindex 00000000..473a0f4c\n"
|
||||
pr = gitea_env.create_gitea_pr("mypool/pkgA", diff, "Test BR PR", False, base_branch=merge_branch_name)
|
||||
pkg_pr_number = pr["number"]
|
||||
|
||||
# 2. Wait for the workflow-pr bot to create the related project PR.
|
||||
prj_pr_number = gitea_env.wait_for_project_pr("mypool/pkgA", pkg_pr_number)
|
||||
assert prj_pr_number is not None, "Workflow bot did not create a project PR."
|
||||
|
||||
# 3. Mock the OBS result list.
|
||||
project_name = f"openSUSE:Leap:16.0:PullRequest:{prj_pr_number}"
|
||||
repos = ["repo1", "repo2"]
|
||||
archs = ["x86_64", "aarch64"]
|
||||
repo_arch_package_status = {}
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("building", "building")
|
||||
|
||||
setup_obs_mock(httpserver, project_name, repo_arch_package_status)
|
||||
|
||||
# 4. Wait for staging-bot to be added as a reviewer.
|
||||
assert wait_for_staging_bot_reviewer(gitea_env, prj_pr_number), "Staging bot was not added as a reviewer."
|
||||
|
||||
# Expected Result 1: "Build is started in..."
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build is started in", project_name), "Staging bot did not post 'Build is started' comment."
|
||||
|
||||
# 5. Transition all to success.
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("published", "succeeded")
|
||||
|
||||
# Expected Result 2: "Build successful" on project PR.
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build successful"), "Staging bot did not post 'Build successful' comment on project PR."
|
||||
|
||||
# Expected Result 3: "Build successful..." on package PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgA", pkg_pr_number, "Build successful, for more information go in", project_name), "Staging bot did not post 'Build successful' comment on package PR."
|
||||
|
||||
@pytest.mark.t002
|
||||
def test_002_build_on_all_archs_mix(staging_main_env, httpserver):
|
||||
gitea_env, test_full_repo_name, merge_branch_name = staging_main_env
|
||||
|
||||
# 1. Create a package PR.
|
||||
diff = "diff --git a/test_br_mix.txt b/test_br_mix.txt\nnew file mode 100644\nindex 00000000..473a0f4c\n"
|
||||
pr = gitea_env.create_gitea_pr("mypool/pkgA", diff, "Test BR Mix PR", False, base_branch=merge_branch_name)
|
||||
pkg_pr_number = pr["number"]
|
||||
|
||||
# 2. Wait for the workflow-pr bot to create the related project PR.
|
||||
prj_pr_number = gitea_env.wait_for_project_pr("mypool/pkgA", pkg_pr_number)
|
||||
assert prj_pr_number is not None, "Workflow bot did not create a project PR."
|
||||
|
||||
# 4. Mock the OBS result list BEFORE adding reviewer.
|
||||
project_name = f"openSUSE:Leap:16.0:PullRequest:{prj_pr_number}"
|
||||
repos = ["repo1", "repo2"]
|
||||
archs = ["x86_64", "aarch64"]
|
||||
repo_arch_package_status = {}
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("building", "building")
|
||||
|
||||
setup_obs_mock(httpserver, project_name, repo_arch_package_status)
|
||||
|
||||
# 3. Add staging-bot as a reviewer.
|
||||
gitea_env.request_reviewers("myproducts/mySLFO", prj_pr_number, ["autogits_obs_staging_bot"])
|
||||
assert wait_for_staging_bot_reviewer(gitea_env, prj_pr_number), "Staging bot was not added as a reviewer."
|
||||
|
||||
# Expected Result 1: "Build is started in..."
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build is started in", project_name), "Staging bot did not post 'Build is started' comment."
|
||||
|
||||
# 6. Transition the first repository (all architectures) to "finished" mode and set its package statuses to "success" (e.g., code="succeeded").
|
||||
for a in archs:
|
||||
repo_arch_package_status[("repo1", a, "pkgA")] = ("published", "succeeded")
|
||||
|
||||
# 7. Transition the second repository (all architectures) to "finished" mode and set its package statuses to "failed" (e.g., code="failed").
|
||||
for a in archs:
|
||||
repo_arch_package_status[("repo2", a, "pkgA")] = ("finished", "failed")
|
||||
|
||||
# Expected Result 2: "Build failed" on project PR.
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build failed"), "Staging bot did not post 'Build failed' comment on project PR."
|
||||
|
||||
# Expected Result 3: "Build failed, for more information go in..." on package PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgA", pkg_pr_number, "Build failed, for more information go in", project_name), "Staging bot did not post 'Build failed' comment on package PR."
|
||||
|
||||
@pytest.mark.t003
|
||||
def test_003_build_on_some_archs_failed(staging_main_env, httpserver):
|
||||
gitea_env, test_full_repo_name, merge_branch_name = staging_main_env
|
||||
|
||||
# 1. Create a package PR.
|
||||
diff = "diff --git a/test_br_some_fail.txt b/test_br_some_fail.txt\nnew file mode 100644\nindex 00000000..473a0f4c\n"
|
||||
pr = gitea_env.create_gitea_pr("mypool/pkgA", diff, "Test BR Some Fail PR", False, base_branch=merge_branch_name)
|
||||
pkg_pr_number = pr["number"]
|
||||
|
||||
# 2. Wait for the workflow-pr bot to create the related project PR.
|
||||
prj_pr_number = gitea_env.wait_for_project_pr("mypool/pkgA", pkg_pr_number)
|
||||
assert prj_pr_number is not None, "Workflow bot did not create a project PR."
|
||||
|
||||
# 4. Mock the OBS result list BEFORE adding reviewer.
|
||||
project_name = f"openSUSE:Leap:16.0:PullRequest:{prj_pr_number}"
|
||||
repos = ["repo1", "repo2"]
|
||||
archs = ["x86_64", "aarch64"]
|
||||
repo_arch_package_status = {}
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("building", "building")
|
||||
|
||||
setup_obs_mock(httpserver, project_name, repo_arch_package_status)
|
||||
|
||||
# 3. Add staging-bot as a reviewer.
|
||||
gitea_env.request_reviewers("myproducts/mySLFO", prj_pr_number, ["autogits_obs_staging_bot"])
|
||||
assert wait_for_staging_bot_reviewer(gitea_env, prj_pr_number), "Staging bot was not added as a reviewer."
|
||||
|
||||
# Expected Result 1: "Build is started in..."
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build is started in", project_name), "Staging bot did not post 'Build is started' comment."
|
||||
|
||||
# 6. Transition the first repository (all architectures) to "finished" mode and set its package statuses to "success" (e.g., code="succeeded").
|
||||
for a in archs:
|
||||
repo_arch_package_status[("repo1", a, "pkgA")] = ("published", "succeeded")
|
||||
|
||||
# 7. Transition the second repository to "finished" mode, setting the first architecture to "failed" (code="failed") and the second architecture to "success" (code="succeeded").
|
||||
repo_arch_package_status[("repo2", archs[0], "pkgA")] = ("finished", "failed")
|
||||
repo_arch_package_status[("repo2", archs[1], "pkgA")] = ("finished", "succeeded")
|
||||
|
||||
# Expected Result 2: "Build failed" on project PR.
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build failed"), "Staging bot did not post 'Build failed' comment on project PR."
|
||||
|
||||
# Expected Result 3: "Build failed, for more information go in..." on package PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgA", pkg_pr_number, "Build failed, for more information go in", project_name), "Staging bot did not post 'Build failed' comment on package PR."
|
||||
|
||||
@pytest.mark.t004
|
||||
def test_004_build_multiple_packages_success(staging_main_env, httpserver):
|
||||
gitea_env, test_full_repo_name, merge_branch_name = staging_main_env
|
||||
|
||||
pkg_pr_number1, pkg_pr_number2, prj_pr_number = prepare_multi_package_test(
|
||||
gitea_env, merge_branch_name, "multi"
|
||||
)
|
||||
|
||||
project_name, repo_arch_package_status, repos, archs = finish_multi_package_setup(
|
||||
gitea_env, prj_pr_number, httpserver
|
||||
)
|
||||
|
||||
# 6. Transition all repositories and architectures for the first package to "finished" mode and set its package statuses to "success" (e.g., code="succeeded").
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("published", "succeeded")
|
||||
|
||||
# Verify "Build successful" is NOT yet posted
|
||||
time.sleep(5)
|
||||
events = gitea_env.get_timeline_events("myproducts/mySLFO", prj_pr_number)
|
||||
assert not any(e.get("body") == "Build successful" for e in events), "Build successful posted prematurely."
|
||||
|
||||
# 7. Transition all repositories and architectures for the second package to "finished" mode and set its package statuses to "success" (e.g., code="succeeded").
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgB")] = ("published", "succeeded")
|
||||
|
||||
# Expected Result 2: "Build successful" on project PR.
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build successful"), "Staging bot did not post 'Build successful' comment on project PR."
|
||||
|
||||
# Expected Result 3: "Build successful..." on each package PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgA", pkg_pr_number1, "Build successful, for more information go in", project_name), "Staging bot did not post 'Build successful' comment on package PR A."
|
||||
assert gitea_env.wait_for_comment("mypool/pkgB", pkg_pr_number2, "Build successful, for more information go in", project_name), "Staging bot did not post 'Build successful' comment on package PR B."
|
||||
|
||||
@pytest.mark.t005
|
||||
def test_005_build_multiple_packages_mix(staging_main_env, httpserver):
|
||||
gitea_env, test_full_repo_name, merge_branch_name = staging_main_env
|
||||
|
||||
pkg_pr_number1, pkg_pr_number2, prj_pr_number = prepare_multi_package_test(
|
||||
gitea_env, merge_branch_name, "mix_multi"
|
||||
)
|
||||
|
||||
project_name, repo_arch_package_status, repos, archs = finish_multi_package_setup(
|
||||
gitea_env, prj_pr_number, httpserver
|
||||
)
|
||||
|
||||
# 6. Transition the first package (all repositories and architectures) to "finished" mode and set its package statuses to "success" (e.g., code="succeeded").
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("published", "succeeded")
|
||||
|
||||
# 7. Transition the second package (all repositories and architectures) to "finished" mode and set its package statuses to "failed" (e.g., code="failed").
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgB")] = ("finished", "failed")
|
||||
|
||||
# Give the bot some time to see the final state
|
||||
time.sleep(2)
|
||||
|
||||
# Expected Result 2: "Build failed" on project PR.
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build failed"), "Staging bot did not post 'Build failed' comment on project PR."
|
||||
|
||||
# Expected Result 3: "Build successful..." on the successful package's PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgA", pkg_pr_number1, "Build successful, for more information go in", project_name), "Staging bot did not post 'Build successful' comment on package PR A."
|
||||
|
||||
# Expected Result 4: "Build failed..." on the failed package's PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgB", pkg_pr_number2, "Build failed, for more information go in", project_name), "Staging bot did not post 'Build failed' comment on package PR B."
|
||||
|
||||
@pytest.mark.t006
|
||||
def test_006_build_multiple_packages_partial_fail(staging_main_env, httpserver):
|
||||
gitea_env, test_full_repo_name, merge_branch_name = staging_main_env
|
||||
|
||||
pkg_pr_number1, pkg_pr_number2, prj_pr_number = prepare_multi_package_test(
|
||||
gitea_env, merge_branch_name, "partial_multi"
|
||||
)
|
||||
|
||||
project_name, repo_arch_package_status, repos, archs = finish_multi_package_setup(
|
||||
gitea_env, prj_pr_number, httpserver
|
||||
)
|
||||
|
||||
# 6. Transition the first package (all repositories and architectures) to "finished" mode and set its package statuses to "success" (e.g., code="succeeded").
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("published", "succeeded")
|
||||
|
||||
# 7. Transition the second package:
|
||||
# Repository 1 (all architectures) to "finished" mode with "success" (e.g., code="succeeded").
|
||||
for a in archs:
|
||||
repo_arch_package_status[("repo1", a, "pkgB")] = ("published", "succeeded")
|
||||
|
||||
# Repository 2 (all architectures) to "finished" mode with "failed" (e.g., code="failed").
|
||||
for a in archs:
|
||||
repo_arch_package_status[("repo2", a, "pkgB")] = ("finished", "failed")
|
||||
|
||||
# Give the bot some time to see the final state
|
||||
time.sleep(2)
|
||||
|
||||
# Expected Result 2: "Build failed" on project PR.
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build failed"), "Staging bot did not post 'Build failed' comment on project PR."
|
||||
|
||||
# Expected Result 3: "Build successful..." on the first (successful) package's PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgA", pkg_pr_number1, "Build successful, for more information go in", project_name), "Staging bot did not post 'Build successful' comment on package PR A."
|
||||
|
||||
# Expected Result 4: "Build failed..." on the second (failed) package's PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgB", pkg_pr_number2, "Build failed, for more information go in", project_name), "Staging bot did not post 'Build failed' comment on package PR B."
|
||||
|
||||
@pytest.mark.t007
|
||||
def test_007_build_multiple_packages_arch_fail(staging_main_env, httpserver):
|
||||
gitea_env, test_full_repo_name, merge_branch_name = staging_main_env
|
||||
|
||||
pkg_pr_number1, pkg_pr_number2, prj_pr_number = prepare_multi_package_test(
|
||||
gitea_env, merge_branch_name, "arch_multi"
|
||||
)
|
||||
|
||||
project_name, repo_arch_package_status, repos, archs = finish_multi_package_setup(
|
||||
gitea_env, prj_pr_number, httpserver
|
||||
)
|
||||
|
||||
# 6. Transition the first package (all repositories and architectures) to "finished" mode and set its package statuses to "success" (e.g., code="succeeded").
|
||||
for r in repos:
|
||||
for a in archs:
|
||||
repo_arch_package_status[(r, a, "pkgA")] = ("published", "succeeded")
|
||||
|
||||
# 7. Transition the second package:
|
||||
# Architecture 1 (all repositories) to "finished" mode with "success" (e.g., code="succeeded").
|
||||
for r in repos:
|
||||
repo_arch_package_status[(r, archs[0], "pkgB")] = ("published", "succeeded")
|
||||
|
||||
# Architecture 2 (all repositories) to "finished" mode with "failed" (e.g., code="failed").
|
||||
for r in repos:
|
||||
repo_arch_package_status[(r, archs[1], "pkgB")] = ("finished", "failed")
|
||||
|
||||
# Give the bot some time to see the final state
|
||||
time.sleep(2)
|
||||
|
||||
# Expected Result 2: "Build failed" on project PR.
|
||||
assert gitea_env.wait_for_comment("myproducts/mySLFO", prj_pr_number, "Build failed"), "Staging bot did not post 'Build failed' comment on project PR."
|
||||
|
||||
# Expected Result 3: "Build successful..." on the first (successful) package's PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgA", pkg_pr_number1, "Build successful, for more information go in", project_name), "Staging bot did not post 'Build successful' comment on package PR A."
|
||||
|
||||
# Expected Result 4: "Build failed..." on the second (failed) package's PR.
|
||||
assert gitea_env.wait_for_comment("mypool/pkgB", pkg_pr_number2, "Build failed, for more information go in", project_name), "Staging bot did not post 'Build failed' comment on package PR B."
|
||||
@@ -6,7 +6,7 @@ COPY integration/rabbitmq-config/certs/cert.pem /usr/share/pki/trust/anchors/git
|
||||
RUN update-ca-certificates
|
||||
|
||||
# Install git and ssh
|
||||
RUN zypper -n in git-core openssh-clients binutils git-lfs procps gawk || (tail -n 1000 /var/log/zypper.log; exit 1)
|
||||
RUN zypper -n in git-core openssh-clients binutils git-lfs || (tail -n 1000 /var/log/zypper.log; exit 1)
|
||||
|
||||
# Copy the pre-built binary into the container
|
||||
COPY workflow-pr/workflow-pr /usr/local/bin/workflow-pr
|
||||
|
||||
@@ -9,7 +9,7 @@ RUN zypper ar -f http://download.opensuse.org/repositories/devel:/Factory:/git-w
|
||||
RUN zypper --gpg-auto-import-keys ref
|
||||
|
||||
# Install git and ssh
|
||||
RUN zypper -n in git-core openssh-clients autogits-workflow-pr binutils git-lfs procps gawk || ( tail -n 1000 /var/log/zypper.log; exit 1 )
|
||||
RUN zypper -n in git-core openssh-clients autogits-workflow-pr binutils git-lfs || ( tail -n 1000 /var/log/zypper.log; exit 1 )
|
||||
|
||||
COPY integration/workflow-pr/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +4755 /usr/local/bin/entrypoint.sh
|
||||
|
||||
@@ -20,7 +20,7 @@ echo "GITEA_TOKEN exported (length: ${#GITEA_TOKEN})"
|
||||
|
||||
# Wait for the dummy data to be created by the gitea setup script
|
||||
echo "Waiting for workflow.config in myproducts/mySLFO (branch zz-ready-to-start)..."
|
||||
API_URL="http://gitea-test:3000/api/v1/repos/myproducts/mySLFO/contents/workflow.config?ref=zz-ready-to-start"
|
||||
API_URL="http://gwf-gitea-test:3000/api/v1/repos/myproducts/mySLFO/contents/workflow.config?ref=zz-ready-to-start"
|
||||
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$API_URL")
|
||||
|
||||
WAITED=false
|
||||
@@ -52,7 +52,7 @@ chmod 600 /root/.ssh/id_ed25519
|
||||
echo "Scanning Gitea SSH host key..."
|
||||
# We try multiple times because Gitea might still be starting its SSH server
|
||||
for i in {1..10}; do
|
||||
ssh-keyscan -p 3022 gitea-test >> /root/.ssh/known_hosts 2>/dev/null && break
|
||||
ssh-keyscan -p 3022 gwf-gitea-test >> /root/.ssh/known_hosts 2>/dev/null && break
|
||||
echo "Retrying ssh-keyscan in 2s..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user