Repository navigation
fix: resolve AUR and release workflow failures - #282
Conversation
Change update-aur job to exclude submodules during initial checkout, then manually initialize AUR submodule after SSH agent setup. Root cause: actions/checkout attempted to clone AUR submodule via SSH before SSH keys and known_hosts were available, causing "Host key verification failed" errors. Changes: - Set submodules: false in update-aur checkout step - Add ssh-keyscan to populate aur.archlinux.org in known_hosts - Manually initialize AUR submodule after SSH setup Fixes workflow failure in update-aur job where AUR submodule clone failed during recursive submodule checkout.
…iner The webfactory/ssh-agent action doesn't work properly with container-based workflows because the SSH agent socket is not accessible inside containers. Changes: - Remove webfactory/ssh-agent action from update-aur job - Add manual SSH setup step that runs inside the archlinux container - Write SSH private key from secret to file with proper permissions - Configure SSH to use the AUR key for aur.archlinux.org host - Add known_hosts entry for AUR - Test SSH connection before proceeding This ensures SSH authentication works within the container environment required for AUR package operations.
Git was failing to use the SSH config file when cloning submodules, resulting in "Permission denied (publickey)" errors despite successful SSH connection tests. Changes: - Use GIT_SSH_COMMAND environment variable to explicitly specify SSH key and options for Git operations - Fix SSH config EOF marker to prevent variable expansion issues - Change AUR test command from 'uname' to 'help' (uname is invalid on AUR) This ensures Git uses the correct SSH key when cloning AUR submodules inside the container environment.
Replace verbose 'help' command with silent 'list-repos' test. Redirect all output to /dev/null and only show success message. This makes workflow logs much cleaner while still verifying SSH connectivity to AUR.
Prevent checkout failures in update-nix and update-flathub jobs by excluding the AUR submodule that requires SSH authentication. Changes: - Set submodules: false for both jobs - Manually initialize only required submodules: - update-nix: packages/acore-scripts - update-flatpak: fdroid, flathub, flatpak-flutter, shared-modules - Skip packaging/aur submodule that needs SSH access This allows non-AUR jobs to run without SSH setup while ensuring each job only initializes the submodules it actually needs.
Instead of failing when release hash doesn't match PKGBUILD, automatically update the PKGBUILD with the new hash. This handles common scenario where releases are recreated during development. Changes: - Rename step from 'Verify checksums' to 'Verify and update checksums' - Replace exit 1 on hash mismatch with automatic PKGBUILD update - Use sed to update sha256sums line with new computed hash - Log the change for debugging and transparency This makes the AUR update workflow more robust by automatically handling release recreations without manual intervention.
Replace unconditional 3-minute sleep with smart asset availability check. Changes: - Check if release assets exist before waiting - If assets ready: proceed immediately (0s wait) - If assets not ready: wait 2 minutes instead of 3 - Retry after wait and report status - Better logging for debugging This improves workflow speed when assets are ready quickly while still providing sufficient wait time for GitHub's CDN propagation.
Fix two critical issues causing job failures: 1. update-aur job: - Add packages/acore-scripts submodule initialization - update_aur.sh depends on logger.sh from acore-scripts - Without this, script fails with "No such file or directory" 2. update_nix.sh script: - Handle git pull --rebase failures gracefully - nix flake update creates uncommitted .scratch files - When rebase fails, push changes directly instead of failing - Use --no-recurse-submodules flags for git operations These fixes ensure all release jobs complete successfully.
The update_flathub.sh script depends on logger.sh from acore-scripts but the workflow wasn't initializing that submodule. Changes: - Add packages/acore-scripts to update-flathub job submodule initialization This fixes the "No such file or directory" error for logger.sh in the update_flathub script.
Fix critical issues causing update-aur and update-flathub failures: 1. update-aur SSH authentication: - Move GIT_SSH_COMMAND to job-level environment variables - This ensures SSH key configuration persists across steps - Fix update_aur.sh to not override existing GIT_SSH_COMMAND - Previously script overwrote the SSH key path, causing permission errors 2. update-flathub git rebase conflicts: - Handle git pull --rebase failures gracefully - Abort failed rebases and push directly instead of failing - Clean up rebase state before retrying push These fixes ensure all release jobs handle git operations robustly without failing on authentication or merge conflicts.
Apply the same graceful rebase failure handling that was added to the update-flathub job. The AUR job was also failing with 'cannot pull with rebase: You have unstaged changes'. Changes: - Wrap git pull --rebase in error handling - Abort failed rebases and push directly instead of failing - Use --no-edit flag for cleaner rebase behavior This ensures the AUR update job completes successfully even when git encounters conflicts during rebase operations.
The updpkgsums command downloads the release artifact (tar.gz) to compute checksums. This file remains in the working directory and causes 'git status -s' to return non-empty, triggering the 'No changes to commit' exit path even though PKGBUILD and .SRCINFO have been updated. Changes: - Add cleanup command after .SRCINFO generation - Remove whph-v*.tar.gz files before git status check This ensures the script correctly identifies when there are actual changes to commit and continues with the AUR update process.
All three update jobs (update-flathub, update-nix, update-aur) were running in parallel and trying to push to the same parent repository simultaneously. This created a race condition where only one job would succeed and the others would fail with 'failed to push some refs'. Changes: - Make jobs run sequentially: update-flathub → update-nix → update-aur - update-nix now needs: [release, update-flathub] - update-aur now needs: [release, update-nix] - Simplified git push handling (no longer need complex rebase fallback logic) - Remove forced push attempts that could cause conflicts Now each job waits for the previous one to complete, ensuring clean git operations without conflicting pushes to the parent repository.
Update job dependency chain to follow the correct order: 1. update-aur (runs first after release) 2. update-nix (waits for aur) 3. update-flathub (waits for nix, runs last) This ensures proper sequential execution and avoids git push race conditions when updating submodule pointers.
The jobs are failing with 'cannot pull with rebase: You have unstaged changes' because there are files from earlier operations or submodule initialization that remain untracked or modified. Changes: - Check for unstaged changes (excluding our staged submodule changes) - Stash them before pulling - Fallback to merge pull if rebase fails - Restore stashed changes after pull - Apply this pattern to all three jobs: AUR, Nix, Flathub This ensures git operations succeed regardless of the working directory state from previous steps.
The issue was that git stash without -u flag only stashes tracked files, leaving untracked files in the working directory. When git pull tries to merge, it fails because the untracked files conflict with incoming changes. Changes: - Use 'git stash push -u' to include untracked files - Don't restore stash with 'git stash pop' (causes merge conflicts) - Instead, drop the stash after pull (these are temporary build files) - Apply to all three update jobs: AUR, Nix, Flathub The stashed files are temporary artifacts from build processes, not actual work that needs to be preserved. By stashing them for the pull and then discarding them, we ensure clean merges without conflicts.
The update-flathub job was initializing 5 submodules but only needs 2: - packages/acore-scripts (for update_flathub.sh logger) - packaging/flatpak/flathub (the target submodule to update) Removed unnecessary initialization of: - packaging/fdroid (not used by flathub job) - packaging/flatpak/flatpak-flutter (not used by flathub job) - packaging/flatpak/shared-modules (not used by flathub job) This reduces job initialization time and network overhead.
There was a problem hiding this comment.
Code Review
This pull request updates subproject commits, bumps the Nix package version to 0.22.3, and enhances the AUR and Nix update scripts with improved cleanup and git synchronization logic. The review feedback identifies several critical issues in the update_nix.sh script, specifically regarding the new stashing logic. Key concerns include an ineffective grep filter due to path mismatches and regex syntax errors, an incorrect git stash drop command that could lead to data loss for local users, and the unnecessary suppression of error messages during git operations. Improvements were suggested to simplify the status check and ensure safe, correct stash management.
| git push | ||
|
|
||
| # Handle any unstaged changes before pulling (including untracked files) | ||
| if [[ -n $(git status -s | grep -v "$FLAKE_FILE\|$NIX_DIR/flake.lock") ]]; then |
There was a problem hiding this comment.
The grep filter is ineffective and contains several issues:
- Path Mismatch:
$FLAKE_FILEand$NIX_DIRare absolute paths, whilegit status -sreturns paths relative to the repository root. The filter will fail to match, meaning it won't actually exclude these files. - Regex Syntax: The pipe
|is not escaped, so in standardgrepit is treated as a literal character rather than an OR operator. It should be\|or usegrep -E. - Redundancy: Since the Nix changes were already committed on line 89, they will not appear in
git statusanyway. - Data Loss Risk: The subsequent
git stash drop(line 106) will permanently delete any changes caught by this block. If a developer runs this locally with other work-in-progress, their work will be lost.
If the goal is to stash any other remaining changes to ensure a clean pull, a simple check for a non-empty status is sufficient.
| if [[ -n $(git status -s | grep -v "$FLAKE_FILE\|$NIX_DIR/flake.lock") ]]; then | |
| if [[ -n $(git status -s) ]]; then |
| if git stash list | grep -q "Temporary stash before rebase"; then | ||
| git stash drop "Temporary stash before rebase" || true | ||
| fi |
There was a problem hiding this comment.
The git stash drop command is used incorrectly here:
- Syntax Error: It does not accept a message string as an argument; it requires a stash reference like
stash@{0}. The current command will fail with an error. - Destructive Operation: Dropping the stash without restoring it (
git stash pop) is a destructive operation. While intended to clean up temporary artifacts in CI, this script can be run locally. If a developer has uncommitted work in other files, this logic will permanently delete their changes.
If these are strictly temporary build artifacts, it is safer to use git clean -fd on specific known artifact paths or use git stash pop to restore the workspace state after the pull.
| if git stash list | grep -q "Temporary stash before rebase"; then | |
| git stash drop "Temporary stash before rebase" || true | |
| fi | |
| # Clean up stash (drop the latest stash created at line 94) | |
| if git stash list | grep -q "Temporary stash before rebase"; then | |
| git stash drop stash@{0} || true | |
| fi |
| fi | ||
|
|
||
| # Pull with rebase, fallback to merge if it fails | ||
| if ! git pull --rebase --no-recurse-submodules --no-edit 2>/dev/null; then |
There was a problem hiding this comment.
Suppressing stderr with 2>/dev/null makes it difficult to diagnose why a git pull might have failed (e.g., network issues, authentication errors, or complex conflicts). It is generally better to allow the error output to be visible in the logs for troubleshooting.
| if ! git pull --rebase --no-recurse-submodules --no-edit 2>/dev/null; then | |
| if ! git pull --rebase --no-recurse-submodules --no-edit; then |
The flathub submodule has a nested submodule (shared-modules) that is required by the flathub manifest. Without initializing this nested submodule, the flathub build will fail. Changes: - Initialize flathub's shared-modules submodule after cloning flathub - Change back to GITHUB_WORKSPACE after initialization - Only initialize what's needed: acore-scripts, flathub, and its nested shared-modules This ensures all required dependencies are available for the flathub manifest update process.
- Simplify untracked files check (remove broken grep filter with absolute paths)
- Remove stderr suppression on git pull for better debugging
- Fix git stash drop syntax to use reference (stash@{0}) instead of message string
Critical fixes:
- Fix stash drop to use message-based reference instead of stash@{0}
Prevents accidentally dropping wrong stash when multiple exist
Important fixes:
- Add rebase state check before aborting (check for .git/rebase-* files)
- Add SSH key masking in workflow to prevent log exposure
- Add explicit error handling for ssh-keyscan and submodule init
- Log nix fallback explicitly when nix-prefetch-url fails
Medium priority fixes:
- Add comment explaining 2-minute wait for GitHub CDN propagation
- Fix stash drop in both workflow locations (aur and flathub jobs)
Files modified:
- .github/workflows/release.yml: SSH masking, rebase checks, error handling
- scripts/update_nix.sh: Stash reference, nix fallback log, rebase check
- scripts/update_aur.sh: Explicit ssh-keyscan error handling
Extracts duplicated pull-with-rebase-fallback logic into a reusable function: - Creates scripts/git_helpers.sh with git_pull_with_fallback function - Supports optional filter pattern to exclude paths from stash check - Updates workflow to use shared function in aur and flathub jobs - Updates update_nix.sh to use shared function Benefits: - Reduces code duplication across 3 locations - Centralizes git pull logic for easier maintenance - Ensures consistent behavior across all update jobs - Net reduction: 33 lines of code Files: - scripts/git_helpers.sh (new) - .github/workflows/release.yml (simplified) - scripts/update_nix.sh (simplified)
The --strategy-option theirs syntax is incorrect for git merge. Changed to: - Fetch first: git fetch origin <branch> - Then merge with proper flags: git merge -X theirs -X patience This ensures the merge strategy is correctly applied when handling divergent branches that were created before a release.
… into ci/fix-aur-release
… into ci/fix-aur-release
… into ci/fix-aur-release
… into ci/fix-aur-release
… into ci/fix-aur-release
… into ci/fix-aur-release
🚀 Motivation and Context
The release workflow was consistently failing in the update-aur, update-nix, and update-flathub jobs. These jobs update their respective package repositories (AUR, Nix, Flathub) and push submodule pointer changes back to the main repository. Multiple critical issues prevented successful releases.
⚙️ Implementation Details
This fix addresses multiple interconnected issues:
Git SSH Authentication: The AUR update job runs in an archlinux container and requires SSH authentication to push to the AUR. The SSH setup was failing because the GIT_SSH_COMMAND environment variable wasn't persisting across workflow steps. Moved SSH configuration to job-level environment variables.
Git Push Race Conditions: All three update jobs (update-aur, update-nix, update-flathub) were running in parallel and attempting to push submodule pointer changes to the same parent repository simultaneously. This caused 'failed to push some refs' errors. Restructured job dependencies to run sequentially: aur → nix → flathub.
Unstaged/Untracked File Conflicts: The jobs were failing during git pull operations due to unstaged and untracked files in the working directory. Implemented comprehensive handling that stashes both tracked and untracked files before pull operations and discards them afterward (they're temporary build artifacts).
Downloaded Source Artifacts: The AUR update script downloads release artifacts to compute checksums but these files remained in the working directory, causing git status checks to fail. Added cleanup commands to remove these files after checksum generation.
Release Asset Availability: The jobs were attempting to update before release assets were fully propagated to GitHub's CDN. Implemented smart waiting logic that polls for asset availability instead of using fixed delays.
📋 Checklist for Reviewer
🔗 Related
Closes #[if applicable]