Commit 30066c88 authored by Ivan Mazhukin's avatar Ivan Mazhukin

epm ci: move run_one_ci.sh to ci dir

epm ci: add ipfs put logic in ci/prepare_ipfs.sh epm ci: rm unneeded var in run_one_ci.sh epm ci: separate download and install test on p11
parent f473deaa
...@@ -37,6 +37,29 @@ for app in $apps; do ...@@ -37,6 +37,29 @@ for app in $apps; do
echo " - ./bin/epm -y install wget glibc-pthread file" echo " - ./bin/epm -y install wget glibc-pthread file"
echo " - ./bin/epm -y play kubo" echo " - ./bin/epm -y play kubo"
echo " script:" echo " script:"
echo " - bash ./ci/prepare-ipfs.sh $app"
echo " artifacts:"
echo " when: always"
echo " expire_in: 30 days"
echo " paths:"
echo " - ipfs"
echo ""
#
# --------Stage: test (ALT p11) --------
#
echo "test_${safe_app}_p11:"
echo " stage: test"
echo " allow_failure: true"
echo " image: alt:p11"
echo " tags:"
echo " - access"
echo " before_script:"
echo " - ./bin/epm -y repo set etersoft"
echo " - ./bin/epm update"
echo " - ./bin/epm -y install wget glibc-pthread file"
echo " - mkdir -p /var/lib/eepm"
echo " - cp ipfs/eget-ipfs-db.txt /var/lib/eepm/eget-ipfs-db.txt"
echo " script:"
echo " - bash ./ci/run_one_ci.sh $app" echo " - bash ./ci/run_one_ci.sh $app"
echo " artifacts:" echo " artifacts:"
echo " when: always" echo " when: always"
...@@ -58,9 +81,11 @@ for app in $apps; do ...@@ -58,9 +81,11 @@ for app in $apps; do
echo " before_script:" echo " before_script:"
echo " - ./bin/epm update" echo " - ./bin/epm update"
echo " - ./bin/epm install -y bash wget ca-certificates coreutils file" echo " - ./bin/epm install -y bash wget ca-certificates coreutils file"
echo " - mkdir -p /var/lib/eepm"
echo " - cp ipfs/eget-ipfs-db.txt /var/lib/eepm/eget-ipfs-db.txt"
echo " script:" echo " script:"
echo " - echo \"Testing $app on Debian bookworm (IPFS mode)\"" echo " - echo \"Testing $app on Debian bookworm (IPFS mode)\""
echo " - bash ./ci/run_one_ci.sh $app --ipfs" echo " - bash ./ci/run_one_ci.sh $app"
echo " artifacts:" echo " artifacts:"
echo " when: always" echo " when: always"
echo " expire_in: 30 days" echo " expire_in: 30 days"
......
#!/usr/bin/env bash
set -euo pipefail
APP="${1:?usage: ci/prepare_ipfs.sh <app>}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PROJECT_DIR="${CI_PROJECT_DIR:-$REPO_ROOT}"
IPFS_DIR="$PROJECT_DIR/ipfs"
DB_FILE="$IPFS_DIR/eget-ipfs-db.txt"
LOG_DIR="$IPFS_DIR/log"
ERR_DIR="$IPFS_DIR/errors"
mkdir -p "$IPFS_DIR" "$LOG_DIR" "$ERR_DIR"
LOG_FILE="$LOG_DIR/$APP-download.log"
ERR_FILE="$ERR_DIR/$APP-download.log"
cd "$REPO_ROOT/bin"
echo "=== IPFS PREPARE (producer) ==="
echo "App: $APP"
# Producer behaviour: always fetch from upstream
export EGET_IPFS_FORCE_LOAD=1
export EGET_IPFS_API=/ip4/91.232.225.49/tcp/5001
# Temporary workspace
TMPDIR="$(mktemp -d)"
trap 'rm -rf "$TMPDIR"' EXIT
echo "Downloading package from upstream"
set +e
./epm play --auto --download-only "$APP" >"$LOG_FILE" 2>"$ERR_FILE"
rc=$?
set -e
if [ "$rc" -ne 0 ]; then
echo "ERROR: download failed for $APP (exit code $rc)"
echo "See: ipfs/errors/$APP-download.log"
exit "$rc"
fi
# Find downloaded file (expect exactly one)
DOWNLOADED_FILE="$(find "$TMPDIR" -type f | head -n 1)"
if [ -z "$DOWNLOADED_FILE" ] || [ ! -f "$DOWNLOADED_FILE" ]; then
echo "ERROR: downloaded file not found for $APP"
exit 1
fi
FILENAME="$(basename "$DOWNLOADED_FILE")"
echo "Downloaded file:"
echo " $FILENAME"
# Extract URL from log (last URL wget followed)
URL="$(grep -Eo 'https?://[^ ]+' "$LOG_FILE" | tail -n 1 || true)"
if [ -z "$URL" ]; then
echo "ERROR: failed to determine source URL for $APP"
exit 1
fi
echo "Source URL:"
echo " $URL"
# Publish to IPFS
echo "Publishing to IPFS"
CID="$(ipfs add -q "$DOWNLOADED_FILE")"
if [ -z "$CID" ]; then
echo "ERROR: ipfs add returned empty CID"
exit 1
fi
echo "IPFS CID:"
echo " $CID"
# Update IPFS DB (idempotent)
touch "$DB_FILE"
# Remove old entries for the same URL
grep -v "^$URL " "$DB_FILE" >"$DB_FILE.tmp" || true
mv "$DB_FILE.tmp" "$DB_FILE"
# Append new entry
echo "$URL $CID $FILENAME" >>"$DB_FILE"
# Cleanup empty error log
[ -s "$ERR_FILE" ] || rm -f "$ERR_FILE"
echo "IPFS DB updated:"
echo " ipfs/eget-ipfs-db.txt"
echo "=== IPFS PREPARE COMPLETED ==="
...@@ -25,7 +25,7 @@ mkdir -p "$PLAY_DIR" "$ERR_DIR" "$LOG_DIR" "$REQ_DIR" ...@@ -25,7 +25,7 @@ mkdir -p "$PLAY_DIR" "$ERR_DIR" "$LOG_DIR" "$REQ_DIR"
cd "$REPO_ROOT/bin" cd "$REPO_ROOT/bin"
# IPFS is always enabled # IPFS is always enabled
export EGET_IPFS_FORCE_LOAD=1
export EPM_IPFS_DB_UPDATE_SKIPPING=1 export EPM_IPFS_DB_UPDATE_SKIPPING=1
export EGET_IPFS_API=/ip4/91.232.225.49/tcp/5001 export EGET_IPFS_API=/ip4/91.232.225.49/tcp/5001
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment