Add automatic update notification system to eic-shell#25
Add automatic update notification system to eic-shell#25
Conversation
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
install.sh
Outdated
| echo "OPTIONAL ARGUMENTS:" | ||
| echo " -u,--upgrade Upgrade the container to the latest version" | ||
| echo " -u,--upgrade Upgrade eic-shell to the latest version" | ||
| echo " --check-updates Check for available eic-shell updates" |
There was a problem hiding this comment.
@copilot Remove the --check-updates functionality. Only do implicit update checks. Explicit update checks are not supported, and the user can anyway do an explicit upgrade.
There was a problem hiding this comment.
Done in 9c3d4f1. Removed --check-updates from both Singularity and Docker launchers (argument parsing, help text, and handler blocks).
install.sh
Outdated
There was a problem hiding this comment.
@copilot Although --version serves a different purpose already, add support for the --version options without a second argument to print the current container version and other metadata (on a single line).
There was a problem hiding this comment.
Done in 9c3d4f1. --version with no argument (or when followed by another flag) now prints a single line: container: eic_xl:nightly version: 24.06.0-stable. With an argument it continues to set the version to install (Singularity) or is version-info only (Docker). The help text and examples are updated accordingly.
install.sh
Outdated
| INSTALLED_VERSION=$(curl -s --connect-timeout 5 --max-time 5 \ | ||
| "https://api.github.com/repos/eic/eic-shell/releases/latest" 2>/dev/null \ | ||
| | grep '"tag_name":' \ | ||
| | sed -E 's/.*"([^"]+)".*/\1/') |
There was a problem hiding this comment.
@copilot Ensure that the curl call here is also async and not blocking.
There was a problem hiding this comment.
Done in 9c3d4f1. The GitHub API call is now in a background subshell (( ... ) &). The stat to capture the eic-shell mtime still runs synchronously (it's a fast local filesystem call), while the curl + metadata file write happens asynchronously without blocking the install.
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds an offline-safe, non-blocking update notification system to the generated eic-shell launcher (Singularity and Docker), plus a self-upgrade path via re-running the installer and additional metadata/cache files under $PREFIX.
Changes:
- Add background GitHub release checks with 24h caching and single-line update notifications in both launcher variants.
- Add
--upgradeand enhanced--versionbehavior to the launchers. - Persist install metadata (
$PREFIX/.eic-shell-metadata) and version-check cache ($PREFIX/.eic-shell-version-check), with installer recording original launchermtime.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| function read_metadata() { | ||
| local metadata_file="\${PREFIX}/.eic-shell-metadata" | ||
| if [ -f "\${metadata_file}" ]; then | ||
| source "\${metadata_file}" | ||
| fi | ||
| } |
| curl -L \${INSTALL_URL} \ | ||
| | bash -s -- \${FLAGS} | ||
| echo "eic-shell upgrade sucessful" | ||
| echo "eic-shell upgrade successful" |
| function read_metadata() { | ||
| local metadata_file="\${PREFIX}/.eic-shell-metadata" | ||
| if [ -f "\${metadata_file}" ]; then | ||
| source "\${metadata_file}" | ||
| fi | ||
| } |
| curl -L \${INSTALL_URL} \ | ||
| | bash -s -- \${FLAGS} | ||
| echo "eic-shell upgrade successful" |
| { | ||
| echo "INSTALLED_VERSION=$INSTALLED_VERSION" | ||
| echo "INSTALLED_DATE=$(date +%s)" | ||
| echo "CONTAINER=$CONTAINER" | ||
| echo "ORGANIZATION=$ORGANIZATION" | ||
| echo "EIC_SHELL_ORIGINAL_MTIME=$EIC_SHELL_MTIME" | ||
| } > "${PREFIX}/.eic-shell-metadata" |
Adds a non-intrusive, offline-safe update notification system that alerts users when a newer eic-shell release is available, with local modification protection and a self-upgrade path.
New behavior
check_for_updates_async) compares the installed release version against the latest GitHub release — never blocking shell startupNew flags (both Singularity and Docker launchers)
--upgrade— re-runshttps://get.epic-eic.orginstaller preservingPREFIX/VERSION/CONTAINER; blocked if local script modifications are detected--version(no argument) — prints current container and installed version on a single line:container: eic_xl:nightly version: 24.06.0-stable. When called with an argument (Singularity only), sets the version to install as before.install.sh changes
eic-shelllauncher, fetches the current release tag from the GitHub API asynchronously (non-blocking) and records it alongside the script'smtimein$PREFIX/.eic-shell-metadata"unknown"as the installed versionMetadata and cache files
$PREFIX/.eic-shell-metadataINSTALLED_VERSION,INSTALLED_DATE,CONTAINER,ORGANIZATION,EIC_SHELL_ORIGINAL_MTIME$PREFIX/.eic-shell-version-checkLAST_CHECK,LATEST_VERSION,CHECK_STATUS,HAS_LOCAL_MODIFICATIONSLocal modification detection compares the current
mtimeof theeic-shellscript againstEIC_SHELL_ORIGINAL_MTIMEstored at install time. Cross-platformstatfallback handles both Linux (stat -c %Y) and macOS (stat -f %m).Original prompt
Overview
Add an automatic update notification system to eic-shell that alerts users when newer versions are available on the main branch. The system should be non-intrusive, work offline, and protect user modifications.
Requirements
Core Functionality
Track commits from main branch
https://api.github.com/repos/eic/eic-shell/commits/mainNon-blocking, offline-safe version checking
Local modification detection
Simple notifications
eic-shell update available (oldsha -> newsha). Run './eic-shell --upgrade' to update.eic-shell update available (oldsha -> newsha), but local modifications detected. Reinstall with: curl -L https://get.epic-eic.org | bashUpgrade mechanism
--upgradeflag on eic-shell launcherManual check option
--check-updatesflag to force immediate checkImplementation Details
Metadata file:
$PREFIX/.eic-shell-metadataCache file:
$PREFIX/.eic-shell-version-checkLAST_CHECK=1234567890 LAST_CHECK_DATE="Fri Mar 14 12:00:00 UTC 2026" LATEST_COMMIT=e4f5g6h CHECK_STATUS=success HAS_LOCAL_MODIFICATIONS=noChanges to install.sh:
Changes to eic-shell launcher:
--upgradeand--check-updatesto argument parsingcheck_for_updates_asyncon normal startup (background, non-blocking)Key Functions to Implement
In eic-shell launcher script:
read_metadata()- Source metadata filecheck_local_modifications()- Return 0 if modified in last 24h, 1 otherwiseshould_check_version()- Return 0 if cache older than 1 day, 1 otherwisefetch_latest_commit()- Curl GitHub API with timeout, extract 7-char SHAcache_version_check()- Write results to cache fileread_cached_commit()- Read LATEST_COMMIT from cacheread_cached_modification_status()- Read HAS_LOCAL_MODIFICATIONS from cachedisplay_update_notification()- Echo single-line messagecheck_for_updates()- Main check logic (respects cache, handles offline)check_for_updates_async()- Background wrapper with output suppressionCross-platform Compatibility
stat -f %m) and Linux (stat -c %Y)[[ =~ ]]for regex matching (available in bash)Error Handling
curl -s --connect-timeout 5 --max-time 5 ... 2>/dev/null[[ "$result" =~ ^[0-9a-f]{7}$ ]]( check_for_updates 2>/dev/null & )Configuration
EIC_SHELL_REPO="eic/eic-shell"INSTALL_URL="https://get.epic-eic.org"CHECK_INTERVAL_DAYS=1NETWORK_TIMEOUT=5MODIFICATION_GRACE_HOURS=24Testing Scenarios
--upgradeblocked./eic-shell --check-updatesbypasses cache, shows current status./eic-shell --upgradedownloads installer, reruns with same config, updates metadataNotes
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.