ci: add job logging initialization to production and staking workflows and fix systemd-sync script paths
Some checks failed
Production Tests / Production Integration Tests (push) Failing after 1m8s
Staking Tests / test-staking-service (push) Successful in 4s
Systemd Sync / sync-systemd (push) Successful in 5s
Staking Tests / test-staking-integration (push) Successful in 2s
Staking Tests / test-staking-contract (push) Successful in 1m17s
Staking Tests / run-staking-test-runner (push) Successful in 9s

- Added setup-job-logging.sh initialization step to production-tests.yml, all staking-tests.yml jobs, and systemd-sync.yml
- Removed redundant agent-coordinator package installation from production-tests.yml (already included in extra-packages)
- Fixed systemd-sync.yml to use relative paths (scripts/utils/link-systemd.sh) instead of absolute paths (/opt/aitbc/scripts/utils/link-systemd.sh)
This commit is contained in:
aitbc
2026-04-20 12:00:06 +02:00
parent 482e0be438
commit eb51363ea9
4 changed files with 110 additions and 7 deletions

View File

@@ -30,6 +30,11 @@ jobs:
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd /var/lib/aitbc-workspaces/production-tests/repo
bash scripts/ci/setup-job-logging.sh
- name: Setup test environment
run: |
cd /var/lib/aitbc-workspaces/production-tests/repo
@@ -43,9 +48,6 @@ jobs:
--skip-requirements \
--extra-packages "pytest pytest-asyncio pytest-timeout requests pyjwt fastapi uvicorn[standard] redis bcrypt websockets numpy psutil prometheus-client celery aiohttp pydantic"
# Install agent-coordinator package with its dependencies
venv/bin/pip install -q -e apps/agent-coordinator
# Ensure standard directories exist
mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc

View File

@@ -32,6 +32,11 @@ jobs:
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd /var/lib/aitbc-workspaces/staking-tests/repo
bash scripts/ci/setup-job-logging.sh
- name: Setup Python environment
run: |
cd /var/lib/aitbc-workspaces/staking-tests/repo
@@ -81,6 +86,11 @@ jobs:
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd /var/lib/aitbc-workspaces/staking-integration/repo
bash scripts/ci/setup-job-logging.sh
- name: Setup Python environment
run: |
cd /var/lib/aitbc-workspaces/staking-integration/repo
@@ -120,6 +130,11 @@ jobs:
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd /var/lib/aitbc-workspaces/staking-contract/repo
bash scripts/ci/setup-job-logging.sh
- name: Setup Node.js environment
run: |
cd /var/lib/aitbc-workspaces/staking-contract/repo/contracts
@@ -154,6 +169,11 @@ jobs:
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd /var/lib/aitbc-workspaces/staking-runner/repo
bash scripts/ci/setup-job-logging.sh
- name: Setup Python environment
run: |
cd /var/lib/aitbc-workspaces/staking-runner/repo

View File

@@ -28,6 +28,11 @@ jobs:
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd /var/lib/aitbc-workspaces/systemd-sync/repo
bash scripts/ci/setup-job-logging.sh
- name: Validate service files
run: |
cd /var/lib/aitbc-workspaces/systemd-sync/repo
@@ -71,14 +76,14 @@ jobs:
fi
echo "=== Syncing systemd files ==="
if [[ -x /opt/aitbc/scripts/utils/link-systemd.sh ]]; then
if [[ -x scripts/utils/link-systemd.sh ]]; then
if [[ $EUID -eq 0 ]]; then
/opt/aitbc/scripts/utils/link-systemd.sh
./scripts/utils/link-systemd.sh
else
sudo /opt/aitbc/scripts/utils/link-systemd.sh
sudo ./scripts/utils/link-systemd.sh
fi
else
echo "⚠️ /opt/aitbc/scripts/utils/link-systemd.sh not found"
echo "⚠️ scripts/utils/link-systemd.sh not found"
exit 1
fi

View File

@@ -0,0 +1,76 @@
#!/bin/bash
set -euo pipefail
LOG_DIR="${AITBC_CI_LOG_DIR:-/opt/gitea-runner/logs}"
WORKFLOW_NAME="${GITHUB_WORKFLOW:-workflow}"
JOB_NAME="${GITHUB_JOB:-job}"
RUN_ID="${GITHUB_RUN_ID:-${GITHUB_RUN_NUMBER:-$(date +%s)}}"
RUN_NUMBER="${GITHUB_RUN_NUMBER:-}"
RUN_ATTEMPT="${GITHUB_RUN_ATTEMPT:-1}"
GITHUB_ENV_FILE="${GITHUB_ENV:-${GITEA_ENV:-}}"
sanitize() {
printf '%s' "$1" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9._-]+/-/g; s/^-+//; s/-+$//'
}
SAFE_WORKFLOW="$(sanitize "$WORKFLOW_NAME")"
SAFE_JOB="$(sanitize "$JOB_NAME")"
SAFE_ATTEMPT="$(sanitize "$RUN_ATTEMPT")"
SAFE_WORKFLOW="${SAFE_WORKFLOW:-workflow}"
SAFE_JOB="${SAFE_JOB:-job}"
mkdir -p "$LOG_DIR"
LOG_BASENAME="${SAFE_WORKFLOW}_${SAFE_JOB}_${RUN_ID}_attempt-${SAFE_ATTEMPT}"
LOG_FILE="$LOG_DIR/${LOG_BASENAME}.log"
INDEX_FILE="$LOG_DIR/index.tsv"
LATEST_FILE="$LOG_DIR/latest.log"
WORKFLOW_LATEST_FILE="$LOG_DIR/latest-${SAFE_WORKFLOW}.log"
JOB_LATEST_FILE="$LOG_DIR/latest-${SAFE_WORKFLOW}-${SAFE_JOB}.log"
ENV_FILE="/tmp/aitbc-ci-log-${RUN_ID}-${SAFE_JOB}.env"
: > "$LOG_FILE"
touch "$INDEX_FILE"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
"$(date -Iseconds)" \
"$RUN_ID" \
"$RUN_NUMBER" \
"$RUN_ATTEMPT" \
"$WORKFLOW_NAME" \
"$JOB_NAME" \
"$LOG_FILE" >> "$INDEX_FILE"
ln -sfn "$LOG_FILE" "$LATEST_FILE"
ln -sfn "$LOG_FILE" "$WORKFLOW_LATEST_FILE"
ln -sfn "$LOG_FILE" "$JOB_LATEST_FILE"
cat > "$ENV_FILE" <<EOF
if [[ "\${AITBC_CI_LOGGING_ACTIVE:-}" == "1" ]]; then
return 0 2>/dev/null || :
fi
export AITBC_CI_LOGGING_ACTIVE=1
export AITBC_CI_LOG_FILE="$LOG_FILE"
exec > >(tee -a "$LOG_FILE") 2>&1
echo "=== \${GITHUB_WORKFLOW:-workflow} / \${GITHUB_JOB:-job} :: \$(date -Iseconds) ==="
EOF
if [[ -n "$GITHUB_ENV_FILE" ]]; then
{
printf 'AITBC_CI_LOG_DIR=%s\n' "$LOG_DIR"
printf 'AITBC_CI_LOG_FILE=%s\n' "$LOG_FILE"
printf 'AITBC_CI_LOG_INDEX=%s\n' "$INDEX_FILE"
printf 'AITBC_CI_LOG_LATEST=%s\n' "$LATEST_FILE"
printf 'AITBC_CI_LOG_WORKFLOW_LATEST=%s\n' "$WORKFLOW_LATEST_FILE"
printf 'AITBC_CI_LOG_JOB_LATEST=%s\n' "$JOB_LATEST_FILE"
printf 'BASH_ENV=%s\n' "$ENV_FILE"
} >> "$GITHUB_ENV_FILE"
else
echo "CI logging warning: GITHUB_ENV/GITEA_ENV not set; automatic logging for later steps is unavailable"
fi
echo "CI log file: $LOG_FILE"
echo "CI latest log: $LATEST_FILE"
echo "CI workflow latest: $WORKFLOW_LATEST_FILE"
echo "CI job latest: $JOB_LATEST_FILE"
echo "CI log index: $INDEX_FILE"