CLI Upgrade Command¶
The upgrade-cli command checks for and installs updates to the Sites CLI tool.
Overview¶
The upgrade command allows you to: - Check for available CLI updates - Install the latest CLI version - Keep your CLI up to date with new features and security fixes
Global Flags¶
--debug,-d,--verbose- Show debug information--insecure,-k- Skip TLS certificate verification--force,-f,-y,--yes- Force operations without prompting--output,-o- Output format:json,yaml, ortable
Command¶
sitesctl upgrade-cli¶
Check for and install CLI updates.
Usage:
Flags:
--check- Check for available upgrade without installing- Default:
false(will install if update available) - Use to preview updates before installing
Examples:
# Check and install available upgrades
sitesctl upgrade-cli
# Only check for upgrades (don't install)
sitesctl upgrade-cli --check
# Check with JSON output
sitesctl upgrade-cli --check --output json
# Install with debug information
sitesctl upgrade-cli --debug
What it does:
Without --check flag:
1. Connects to the ECMWF update server
2. Checks for newer CLI versions
3. If update available:
- Downloads the new version
- Verifies checksum (MD5)
- Replaces the current binary
- Reports success
4. If no update available:
- Reports "No upgrades available"
With --check flag:
1. Connects to the update server
2. Checks for newer versions
3. Verifies the update package
4. Reports if upgrade is available
5. Does NOT install the update
Output Messages:
| Message | Meaning |
|---|---|
| "Upgrade available" | Newer version exists (check mode) |
| "No upgrades available" | You have the latest version |
| "Upgrade successful" | New version installed |
| "Please restart the CLI to use the new version" | Restart needed after upgrade |
Versioning¶
CLI versions follow this format:
Example: 20240227.1430
- 20240227 - Release date: February 27, 2024
- 1430 - Release time: 14:30
Version comparison: - Newer timestamps = newer versions - Easy to identify release dates - Multiple releases possible per day
Check your version:
Automatic Upgrade Checks¶
The CLI can automatically check for updates in the background.
Configuration:
Enable/disable in config:
# Enable automatic checks (default)
sitesctl config auto-upgrade --value=true
# Disable automatic checks
sitesctl config auto-upgrade --value=false
# Check current setting
sitesctl config show
How it works: - When enabled, the CLI checks for updates ~10% of the time - Checks happen on random command executions - Prevents slowdown on every command - If a newer version is found, the CLI downloads and replaces the binary - The new version takes effect on the next CLI invocation - Manual upgrade is still available
Behavior:
# With auto-upgrade enabled
$ sitesctl list
Checking for upgrades, please wait...
Upgrade successful
Please restart the CLI to use the new version
[normal command output]
# Next invocation uses the new version
$ sitesctl --version
Update Process¶
Before Upgrading¶
-
Check current version:
-
Verify connectivity:
-
Review what's new (check release notes if available)
During Upgrade¶
- CLI downloads new binary from ECMWF update server
- Verifies MD5 checksum for integrity
- Replaces the running binary
- Reports success/failure
Important: Don't interrupt the upgrade process
After Upgrading¶
-
Verify new version:
-
Test basic functionality:
-
Review any breaking changes in release notes
Rollback¶
If the upgrade causes issues:
Built-in rollback: - If verification fails, CLI automatically rolls back - No manual action needed
Manual rollback:
- Reinstall previous version from ECMWF repository
- Download from: https://get.ecmwf.int/service/rest/v1/search/assets/?repository=sites-cli
- Or restore from backup if you made one
Best Practices¶
Regular Updates¶
- Check monthly for updates
- Enable auto-checks for notifications
- Update regularly for security patches
- Test after upgrade to ensure compatibility
Production Environments¶
- Test first in development environment
- Review changes before upgrading
- Schedule upgrades during maintenance windows
- Backup scripts that depend on CLI
- Document CLI version in project requirements
CI/CD Systems¶
Pin CLI version for reproducibility:
# Download specific version
curl -L -O https://get.ecmwf.int/repository/sites-cli/linux/sitesctl-20240227.1430
# Verify checksum
md5sum sitesctl-20240227.1430
# Install
chmod +x sitesctl-20240227.1430
mv sitesctl-20240227.1430 /usr/local/bin/sitesctl
Or use latest in development:
Troubleshooting¶
Cannot Connect to Update Server¶
Problem:
Solutions:
- Check internet connectivity
- Verify firewall allows HTTPS to get.ecmwf.int
- Try with --insecure if certificate issues (not recommended)
- Check if behind a corporate proxy
Checksum Verification Failed¶
Problem:
Solutions: - Retry the upgrade (may be download corruption) - Check available disk space - Report to support if persists
Permission Denied¶
Problem:
Solutions:
# Run with appropriate permissions
sudo sitesctl upgrade-cli
# Or if installed in user directory
sitesctl upgrade-cli
Upgrade Fails Silently¶
Problem: Upgrade reports success but version unchanged
Solutions:
- Check if CLI binary is in a read-only location
- Verify you have write permissions
- Run with --debug for more information
- Check if binary is in use by another process
Version Confusion¶
Problem: --version shows old version after upgrade
Solutions: - Restart your terminal session - Check if multiple CLI installations exist - Verify PATH order
Scripting Examples¶
Check and Upgrade in Script¶
#!/bin/bash
# Upgrade CLI if needed
check_output=$(sitesctl upgrade-cli --check 2>&1)
if echo "$check_output" | grep -q "Upgrade available"; then
echo "Upgrade available. Installing..."
sitesctl upgrade-cli
echo "Upgrade complete. Version: $(sitesctl --version)"
else
echo "Already at latest version: $(sitesctl --version)"
fi
Upgrade with Notification¶
#!/bin/bash
# Upgrade and send notification
old_version=$(sitesctl --version)
sitesctl upgrade-cli
new_version=$(sitesctl --version)
if [ "$old_version" != "$new_version" ]; then
echo "CLI upgraded from $old_version to $new_version" | \
mail -s "Sites CLI Upgraded" admin@example.com
echo "Upgraded: $old_version -> $new_version"
else
echo "No upgrade performed. Version: $new_version"
fi
Pre-commit Hook for Version Check¶
#!/bin/bash
# .git/hooks/pre-commit
# Warn if CLI version is old
current_version=$(sitesctl --version | grep -oE '[0-9]{8}\.[0-9]{4}')
check_output=$(sitesctl upgrade-cli --check 2>&1)
if echo "$check_output" | grep -q "Upgrade available"; then
echo "WARNING: Newer Sites CLI version is available"
echo "Current version: $current_version"
echo "Run: sitesctl upgrade-cli"
echo ""
fi
# Continue with commit
exit 0
Automated Weekly Upgrade¶
#!/bin/bash
# Cron job: 0 2 * * 0 (weekly on Sunday at 2 AM)
logfile="/var/log/sitesctl-upgrade.log"
{
echo "=== Upgrade Check: $(date) ==="
sitesctl upgrade-cli --check
if [ $? -eq 0 ]; then
sitesctl upgrade-cli
echo "New version: $(sitesctl --version)"
fi
echo ""
} >> "$logfile" 2>&1
Update Sources¶
The CLI downloads updates from ECMWF's official repository:
Repository URL:
Available platforms: - Linux (x86_64) - macOS (x86_64, ARM64) - Windows (x86_64)
Selection: The CLI automatically detects your platform and downloads the appropriate binary.
Security¶
Verification¶
- All downloads are verified with MD5 checksum
- Downloads use HTTPS (encrypted connection)
- Binaries are signed by ECMWF
- Automatic rollback on verification failure
Trust¶
- Updates come only from official ECMWF servers
- Cannot be modified in transit (HTTPS + checksum)
- Automatic verification before installation
- Safe to enable auto-checks
Recommendations¶
- Enable auto-checks for security notifications
- Upgrade promptly when security fixes are released
- Verify source - only upgrade via sitesctl or official downloads
- Use official binaries - don't use third-party builds
Manual Installation¶
If upgrade-cli doesn't work, manually download and install:
Linux / macOS¶
# Download latest version
platform="linux" # or "darwin" for macOS
curl -L -O "https://get.ecmwf.int/repository/sites-cli/${platform}/sitesctl-latest"
# Make executable
chmod +x sitesctl-latest
# Replace current installation
sudo mv sitesctl-latest /usr/local/bin/sitesctl
# Verify
sitesctl --version
Windows¶
- Download from repository via web browser
- Replace existing
sitesctl.exe - Verify version in PowerShell:
sitesctl --version
Release Information¶
Where to find release notes:
- ECMWF Sites documentation: https://sites.ecmwf.int/docs/sites/
- Support portal: https://support.ecmwf.int
- Internal announcements (if applicable)
Typical update schedule: - Security fixes: As needed - Bug fixes: Monthly - New features: Quarterly - Major versions: Annually
Upgrade recommendations: - Security updates: Install immediately - Bug fixes: Install within a week - New features: Test in development, then upgrade - Major versions: Review breaking changes, plan migration
See Also¶
- Configuration Commands - Enabling/disabling auto-upgrade checks