-
Notifications
You must be signed in to change notification settings - Fork 134
WIP: Automate Update Site verification #1397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
67b3811
704e033
a7cc736
3ce0c80
f2b7c2d
f6f957d
222b43a
0944502
d0ba52f
37b8017
73517f8
394b72b
037e53c
b661a0e
113d0e7
f003de4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,169 @@ | ||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||
| set -x | ||||||||||||||||||
| set -e | ||||||||||||||||||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard against an empty If the tarball extracts to an unexpected directory name (or extraction fails silently after 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| 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" | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded zip internal path
🤖 Prompt for AI Agents |
||||||||||||||||||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 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
fiOr better, grep for the specific p2 error messages that indicate real conflicts. 🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| # 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" | ||||||||||||||||||
There was a problem hiding this comment.
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 pipefailto avoid silently masking pipe failures.set -ealone does not propagate failures from the left-hand side of a pipe. ThePIPESTATUS[0]checks on lines 73 and 100 partially compensate, but any unexpected pipe failure (e.g.,teeitself failing) will still be masked. Addingpipefailmakes the intent explicit and catches additional failure modes. Note: withpipefailenabled,set -ewill abort on a non-zero eclipse exit before reaching thePIPESTATUScheck, so you'd need to temporarily disableset -eor use|| truearound the pipe and rely solely onPIPESTATUS.Suggested approach
Then guard the piped commands so the
PIPESTATUScheck still works:Apply the same pattern around the RC install pipe.
🤖 Prompt for AI Agents