Skip to content

Conversation

@octo-sts
Copy link
Contributor

@octo-sts octo-sts bot commented May 22, 2025

Signed-off-by: wolfi-bot <121097084+wolfi-bot@users.noreply.github.com>
@octo-sts octo-sts bot added request-version-update request for a newer version of a package automated pr labels May 22, 2025
@octo-sts
Copy link
Contributor Author

octo-sts bot commented May 22, 2025

🩹 Build Failed: Patch Application Failed

Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. Hunk #1 ignored at 31. 1 out of 1 hunk ignored -- saving rejects to file pkg/storage/unified/resource/health.go.rej

Build Details

Category Details
Build System melange
Failure Point Patch application during the 'patch' step of the melange build process

Root Cause Analysis 🔍

The second patch (related to gRPC update) failed to apply because it appears to be reversed or already applied. The patch was attempting to modify pkg/storage/unified/resource/health.go but was rejected, causing the build to fail.


🔍 Build failure fix suggestions

Found similar build failures that have been fixed in the past and analyzed them to suggest a fix:

Similar PRs with fixes

Suggested Changes

File: grafana-12.0.yaml

  • modification at line 37-38 (pipeline section)
    Original:
  - uses: patch
    with:
      patches: append-buildvcs-false-to-go-build.patch fix-pkg-storage-unified-resource-health.go.patch

Replacement:

  - uses: patch
    with:
      patches: append-buildvcs-false-to-go-build.patch

File: fix-pkg-storage-unified-resource-health.go.patch

  • information
    Content:
Either remove this file entirely or verify if the changes in this patch file are already included in the source code at v12.0.1 (commit 80658a73c5355e3ed318e5e021c0866285153b57).
Click to expand fix analysis

Analysis

Based on analyzing the similar fixed build failures, I observe a common pattern: patch failures often occur when patches are either already applied, created for different versions of code, or are being applied in reverse. In all three examples, the solution was either to:

  1. Remove the problematic patch file entirely (as seen in Examples Add binutils-2.39 configuration #1 and Add pax-utils into the OS. #2)
  2. Update the package version (and often expected-commit) to a newer version where the patch is no longer needed
  3. Modify the patch file to correctly match the current codebase

In the current failure case, the patch "fix-pkg-storage-unified-resource-health.go.patch" is failing to apply to the "pkg/storage/unified/resource/health.go" file, with the error indicating the patch may already be applied or reversed.

Click to expand fix explanation

Explanation

The build failure is occurring because the patch "fix-pkg-storage-unified-resource-health.go.patch" cannot be applied to the source code. The error message specifically states "Reversed (or previously applied) patch detected!" which strongly suggests that either:

  1. The patch has already been incorporated into the upstream source at version 12.0.1 (commit 80658a73c5355e3ed318e5e021c0866285153b57)
  2. The patch was created relative to a different version of the code and doesn't apply cleanly to the current version
  3. The patch is being applied in reverse

Looking at similar fixes, the most straightforward approach is to simply remove the problematic patch from the build process. The error message indicates the patch is likely already applied in the codebase, especially given the "previously applied patch detected" wording.

This approach is similar to what was done in Fix Examples #1 and #2, where problematic patches were removed entirely after updating to a newer version where the patches were already incorporated upstream. In the current case, since the error suggests the patch might already be applied, removing it from the build process should allow the build to proceed successfully.

If the patch is still necessary but not correctly applying, an alternative would be to recreate the patch against the current source code version. However, given the error message, it's most likely that the patch is simply no longer needed.

Click to expand alternative approaches

Alternative Approaches

  • If the changes in the patch are still needed but not already in the upstream code, recreate the patch file against the current source version with: git diff > fix-pkg-storage-unified-resource-health.go.patch
  • Apply the patch in reverse if the changes need to be undone: modify the patch step to include the -R flag: patches: append-buildvcs-false-to-go-build.patch -- -R fix-pkg-storage-unified-resource-health.go.patch
  • If there are specific gRPC-related changes that still need to be applied, examine the specific changes in the rejected patch file (health.go.rej) and manually implement those changes as a new patch file based on the current source code

Was this comment helpful? Please use 👍 or 👎 reactions on this comment.

@octo-sts octo-sts bot added the ai/skip-comment Stop AI from commenting on PR label May 22, 2025
@AmberArcadia AmberArcadia self-assigned this May 22, 2025
@AmberArcadia AmberArcadia requested a review from a team May 22, 2025 20:26
@octo-sts octo-sts bot added the bincapz/blocking Bincapz (aka malcontent) scan results detected CRITICALs on the packages. label May 22, 2025
@egibs egibs added the malcontent/reviewed The malcontent findings in this PR have been manually reviewed by security. label May 22, 2025
@OddBloke OddBloke merged commit 9fe17c0 into main May 23, 2025
17 of 18 checks passed
@OddBloke OddBloke deleted the wolfictl-1b32b5bf-8e52-4ac3-bed7-6f72b3da354a branch May 23, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/skip-comment Stop AI from commenting on PR automated pr bincapz/blocking Bincapz (aka malcontent) scan results detected CRITICALs on the packages. malcontent/reviewed The malcontent findings in this PR have been manually reviewed by security. request-version-update request for a newer version of a package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants