Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,26 @@ jobs:
distribution: 'temurin'
cache: 'maven'

- name: Build with Maven
run: export NO_AT_BRIDGE=1 && mvn clean verify -Djarsigner.skip=true -DskipTests=false -DtestWorkspace=/opt/actions-runner/_work/workspace
# - name: Build with Maven
# run: export NO_AT_BRIDGE=1 && mvn clean verify -Djarsigner.skip=true -DskipTests=false -DtestWorkspace=/opt/actions-runner/_work/workspace

- name: Run Eclipse Update Site Test
run: |
chmod +x releng/update-site-tests/detect-latest-eclipse.sh
chmod +x releng/update-site-tests/test-update.sh
releng/update-site-tests/detect-latest-eclipse.sh
env:
LOGDIR: ${{ github.workspace }}/releng/update-site-tests/logs
REPORT_FILE: ${{ github.workspace }}/releng/update-site-tests/report.txt

- name: Upload Eclipse Upgrade Logs and Report
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: eclipse-update-site-test-logs
path: |
releng/update-site-tests/logs
releng/update-site-tests/report.txt

- name: Publish Test Reports
if: ${{ always() }}
Expand Down
39 changes: 39 additions & 0 deletions releng/update-site-tests/detect-latest-eclipse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -e
set -o pipefail

RELEASE_XML="https://ftp2.osuosl.org/pub/eclipse/technology/epp/downloads/release/release.xml"
EPP_BASE="https://ftp2.osuosl.org/pub/eclipse/technology/epp/downloads/release"

echo "Fetching Eclipse release list..."

LATEST_ECLIPSE_RELEASE=$(curl -s "$RELEASE_XML" \
| grep -oE '[0-9]{4}-[0-9]{2}/R' \
| sed 's|/R||' \
| sort -r \
| head -n1)

if [ -z "$LATEST_ECLIPSE_RELEASE" ]; then
echo "❌ Could not detect latest Eclipse release"
exit 1
fi

echo "Latest Eclipse release detected: $LATEST_ECLIPSE_RELEASE"

ECLIPSE_URL="$EPP_BASE/$LATEST_ECLIPSE_RELEASE/R/eclipse-cpp-$LATEST_ECLIPSE_RELEASE-R-linux-gtk-x86_64.tar.gz"

echo "Resolved Eclipse URL:"
echo "$ECLIPSE_URL"

if ! curl -sfI "$ECLIPSE_URL" > /dev/null; then
echo "❌ Eclipse archive not found at resolved URL"
exit 1
fi

echo "✅ Eclipse archive verified"
# Export for test script
export ECLIPSE_URL
export LATEST_ECLIPSE_RELEASE

# Run your test
bash releng/update-site-tests/test-update.sh
169 changes: 169 additions & 0 deletions releng/update-site-tests/test-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#!/bin/bash
set -x
set -e
Comment on lines 1 to 3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add set -o pipefail to avoid silently masking pipe failures.

set -e alone does not propagate failures from the left-hand side of a pipe. The PIPESTATUS[0] checks on lines 73 and 100 partially compensate, but any unexpected pipe failure (e.g., tee itself failing) will still be masked. Adding pipefail makes the intent explicit and catches additional failure modes. Note: with pipefail enabled, set -e will abort on a non-zero eclipse exit before reaching the PIPESTATUS check, so you'd need to temporarily disable set -e or use || true around the pipe and rely solely on PIPESTATUS.

Suggested approach
 #!/bin/bash
-set -e
+set -euo pipefail

Then guard the piped commands so the PIPESTATUS check still works:

-"$ECLIPSE_HOME/eclipse" \
+set +e
+"$ECLIPSE_HOME/eclipse" \
   ...
   | tee "$LOGDIR/stable-install.log"
 
 STABLE_EXIT=${PIPESTATUS[0]}
+set -e
 if [ $STABLE_EXIT -ne 0 ]; then

Apply the same pattern around the RC install pipe.

🤖 Prompt for AI Agents
In `@releng/update-site-tests/test-update.sh` around lines 1 - 2, Add `set -o
pipefail` after the existing `set -e` in test-update.sh to ensure pipe failures
aren't masked, then update the two piped commands guarded by `PIPESTATUS` (the
two places currently checking PIPESTATUS[0], referenced in the comment as lines
with PIPESTATUS checks) so they won't be prematurely aborted: either temporarily
disable `set -e` around each pipeline or append `|| true` to the pipeline and
continue to use the existing `PIPESTATUS` checks to detect failures; ensure you
apply the same pattern to the RC install pipeline as well so both pipelines
reliably surface errors.

set -o pipefail

# CONFIGURATION
ECLIPSE_URL="${ECLIPSE_URL:?ECLIPSE_URL not set}"
LATEST_ECLIPSE_RELEASE="${LATEST_ECLIPSE_RELEASE:?LATEST_ECLIPSE_RELEASE not set}"

ECLIPSE_RELEASE_REPO="https://download.eclipse.org/releases/$LATEST_ECLIPSE_RELEASE"
STABLE_ZIP_URL="https://dl.espressif.com/dl/idf-eclipse-plugin/updates/com.espressif.idf.update-v4.0.0.zip"
RC_REPO="https://dl.espressif.com/dl/idf-eclipse-plugin/updates/latest/"
FEATURE_ID="com.espressif.idf.feature.feature.group"

WORKDIR="${WORKDIR:-$PWD/releng/update-site-tests/workdir}"
LOGDIR="${LOGDIR:-$PWD/releng/update-site-tests/logs}"
REPORT="${REPORT_FILE:-$PWD/releng/update-site-tests/report.txt}"

echo "Cleaning previous workdir and logs..."
rm -rf "${WORKDIR:?}"
rm -rf "${LOGDIR:?}"

mkdir -p "$WORKDIR" "$LOGDIR"

STEP_SUMMARY=()

# STEP 1: DOWNLOAD AND EXTRACT ECLIPSE
echo "Downloading Eclipse..."
wget -q "$ECLIPSE_URL" -O "$WORKDIR/eclipse.tar.gz"
tar -xzf "$WORKDIR/eclipse.tar.gz" -C "$WORKDIR"
ECLIPSE_HOME=$(find "$WORKDIR" -maxdepth 1 -type d -name "eclipse*" | head -n1)
echo "Eclipse installed at: $ECLIPSE_HOME"
Comment on lines +31 to +32
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Guard against an empty ECLIPSE_HOME from find.

If the tarball extracts to an unexpected directory name (or extraction fails silently after set -e is bypassed somehow), find returns nothing and ECLIPSE_HOME becomes an empty string. Subsequent uses like "$ECLIPSE_HOME/eclipse" would resolve to /eclipse, which is dangerous.

Proposed fix
 ECLIPSE_HOME=$(find "$WORKDIR" -maxdepth 1 -type d -name "eclipse*" | head -n1)
+if [ -z "$ECLIPSE_HOME" ] || [ ! -x "$ECLIPSE_HOME/eclipse" ]; then
+    echo "❌ Eclipse extraction failed or eclipse binary not found"
+    exit 1
+fi
 echo "Eclipse installed at: $ECLIPSE_HOME"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ECLIPSE_HOME=$(find "$WORKDIR" -maxdepth 1 -type d -name "eclipse*" | head -n1)
echo "Eclipse installed at: $ECLIPSE_HOME"
ECLIPSE_HOME=$(find "$WORKDIR" -maxdepth 1 -type d -name "eclipse*" | head -n1)
if [ -z "$ECLIPSE_HOME" ] || [ ! -x "$ECLIPSE_HOME/eclipse" ]; then
echo "❌ Eclipse extraction failed or eclipse binary not found"
exit 1
fi
echo "Eclipse installed at: $ECLIPSE_HOME"
🤖 Prompt for AI Agents
In `@releng/update-site-tests/test-update.sh` around lines 36 - 37, The current
assignment to ECLIPSE_HOME via the find command can yield an empty string; guard
against that by checking ECLIPSE_HOME after the find (the variable set by
ECLIPSE_HOME=$(find "$WORKDIR" -maxdepth 1 -type d -name "eclipse*" | head
-n1")) and if empty, print a clear error message (including WORKDIR context) and
exit non‑zero; otherwise continue and echo the path as now. Ensure subsequent
references use the validated $ECLIPSE_HOME.

STEP_SUMMARY+=("Step 1: Eclipse downloaded and extracted - ✅")

# STEP 2: DOWNLOAD AND UNZIP STABLE PLUGIN
echo "Downloading stable plugin zip..."
wget -q "$STABLE_ZIP_URL" -O "$WORKDIR/stable.zip"

echo "Extracting stable plugin..."
mkdir -p "$WORKDIR/stable-repo"
unzip -q "$WORKDIR/stable.zip" -d "$WORKDIR/stable-repo"

STABLE_REPO="file://$WORKDIR/stable-repo/artifacts/update"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Hardcoded zip internal path artifacts/update is fragile.

STABLE_REPO assumes the zip extracts into artifacts/update/. If the zip structure changes across plugin versions, this silently breaks. Consider discovering the path dynamically (e.g., by locating content.jar or artifacts.jar inside the extracted directory).

🤖 Prompt for AI Agents
In `@releng/update-site-tests/test-update.sh` at line 50, STABLE_REPO is hardcoded
to "file://$WORKDIR/stable-repo/artifacts/update" which breaks if the zip layout
changes; modify test-update.sh to discover the extracted subdirectory
dynamically by searching under "$WORKDIR/stable-repo" for a unique marker file
(e.g., content.jar or artifacts.jar) and set STABLE_REPO to the file:// URL of
the directory that contains that marker. In other words, replace the fixed
STABLE_REPO assignment with logic that uses WORKDIR and a find/lookup of
content.jar or artifacts.jar, assigns the containing directory to STABLE_REPO,
and emits a clear error if no marker is found.

STEP_SUMMARY+=("Step 2: Stable plugin downloaded and unzipped - ✅")

# STEP 3: INSTALL STABLE PLUGIN
echo "Installing stable plugin..."
if ! "$ECLIPSE_HOME/eclipse" \
-nosplash \
-application org.eclipse.equinox.p2.director \
-repository "$STABLE_REPO,$ECLIPSE_RELEASE_REPO" \
-installIU "$FEATURE_ID" \
-destination "$ECLIPSE_HOME" \
-profile SDKProfile \
-bundlepool "$WORKDIR/p2" \
-roaming \
-consoleLog \
| tee "$LOGDIR/stable-install.log"
then
STEP_SUMMARY+=("Step 3: Stable plugin installation - ❌ FAILED")
echo "❌ Stable plugin installation failed"
exit 1
fi

echo "✅ Stable plugin installed successfully"
STEP_SUMMARY+=("Step 3: Stable plugin installed successfully - ✅")

# STEP 4: INSTALL RC UPDATE
echo "Installing Release Candidate update..."
if ! "$ECLIPSE_HOME/eclipse" \
-nosplash \
-application org.eclipse.equinox.p2.director \
-repository "$RC_REPO,$ECLIPSE_RELEASE_REPO" \
-uninstallIU "$FEATURE_ID" \
-installIU "$FEATURE_ID" \
-destination "$ECLIPSE_HOME" \
-profile SDKProfile \
-bundlepool "$WORKDIR/p2" \
-roaming \
-consoleLog \
| tee "$LOGDIR/rc-installation-verify.log"
then
STEP_SUMMARY+=("Step 4: Release Candidate update installation - ❌ FAILED")
echo "❌ Release Candidate update failed"
exit 1
fi

echo "✅ Release Candidate update installed successfully"
STEP_SUMMARY+=("Step 4: Release Candidate update installed successfully - ✅")

# STEP 5: EXTRACT INSTALLED VERSIONS
STABLE_VERSION=$(grep -Eo "Installing $FEATURE_ID [0-9\.]+" "$LOGDIR/stable-install.log" | awk '{print $3}')
RC_VERSION=$(grep -Eo "Installing $FEATURE_ID [0-9\.]+" "$LOGDIR/rc-installation-verify.log" | awk '{print $3}')
UNINSTALL_VERSION=$(grep -Eo "Installing $FEATURE_ID [0-9\.]+" "$LOGDIR/rc-installation-verify.log" | awk '{print $3}')

echo "✅ Versions summary:"
echo " Stable installed: $STABLE_VERSION"
echo " RC update applied: $RC_VERSION"
echo " RC update replaced: $UNINSTALL_VERSION"

# STEP 6: CHECK FOR CONFLICTS
echo "Checking logs for conflicts..."
ERROR_PATTERNS="conflict|cannot complete|missing requirement"
CONFLICT_FILE="$LOGDIR/conflicts-detected.txt"

if grep -Ei "$ERROR_PATTERNS" "$LOGDIR"/*.log > "$CONFLICT_FILE"; then
echo "❌ Conflicts detected"
STEP_SUMMARY+=("Step 5: Conflict check - ❌ conflicts found")
CONFLICT_STATUS="FAILED"
else
echo "✅ No conflicts detected"
echo "No conflicts found." > "$CONFLICT_FILE"
STEP_SUMMARY+=("Step 5: Conflict check - ✅")
CONFLICT_STATUS="PASSED"
fi
Comment on lines 102 to 115
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

grep "conflict" is overly broad and may produce false positives or false negatives.

The word "conflict" could appear in benign log messages (e.g., "No conflicts found", class names containing "conflict"). Consider grepping for p2-specific conflict markers or error patterns instead. Also, if no .log files exist the glob will fail under set -e.

Suggestion
-if grep -iq "conflict" "$LOGDIR"/*.log; then
+shopt -s nullglob
+if grep -iqP '(?<!no )conflicts?\b' "$LOGDIR"/*.log; then
     echo "❌ Conflict detected in installation logs!"
     exit 1
 fi

Or better, grep for the specific p2 error messages that indicate real conflicts.

🤖 Prompt for AI Agents
In `@releng/update-site-tests/test-update.sh` around lines 111 - 115, Change the
broad grep that searches for "conflict" in $LOGDIR/*.log to first ensure there
are log files (e.g., test if any "$LOGDIR"/*.log exist and skip check if none),
then grep only for p2-specific error patterns (use grep -iqE -- 'Cannot
satisfy|conflicting requirements|Conflicts detected|Resolution failed'
"$LOGDIR"/*.log) so you avoid benign matches; if grep returns success, print the
failure message and exit 1. Ensure you reference LOGDIR and replace the existing
grep -iq "conflict" "$LOGDIR"/*.log block with this guarded, pattern-specific
check.


# STEP 7: CAPTURE INSTALLED ROOTS
echo "Capturing installed roots..."
if !"$ECLIPSE_HOME/eclipse" \
-nosplash \
-application org.eclipse.equinox.p2.director \
-listInstalledRoots \
-destination "$ECLIPSE_HOME" \
-profile SDKProfile \
-consoleLog \
| tee "$LOGDIR/installed-roots.txt"
then
STEP_SUMMARY+=("Step 6: Installed roots captured - ❌ FAILED")
echo "❌ Installed roots captured failed"
exit 1
fi
echo "✅ Installed roots captured"
STEP_SUMMARY+=("Step 6: Installed roots captured - ✅")

# STEP 8: GENERATE REPORT
{
echo "ESP Eclipse Plug-in 'Update Site Test' Report"
echo "=============================================="
echo ""

echo "Summary:"
for step in "${STEP_SUMMARY[@]}"; do
echo " - $step"
done

echo ""
echo "Environment:"
echo " - Eclipse Version: $LATEST_ECLIPSE_RELEASE"
echo " - Eclipse URL: $ECLIPSE_URL"
echo " - Release Repo: $ECLIPSE_RELEASE_REPO"

echo ""
echo "Versions Summary:"
echo " - Stable installed: $STABLE_VERSION"
echo " - RC update applied: $RC_VERSION"
echo " - RC update replaced: $UNINSTALL_VERSION"

echo ""
echo "Conflict Status: $CONFLICT_STATUS"
echo "Conflict Details:"
cat "$CONFLICT_FILE"

echo ""
echo "Installed Roots:"
cat "$LOGDIR/installed-roots.txt"

echo ""
echo "Logs directory: $LOGDIR"
} > "$REPORT"
Loading