Fix 'xargs: command line too long' in SOPS encryption task #1594
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
The SOPS encryption task was failing with the error "command line too long" when processing many files using
xargs
. This happened because the number of files found byfind
exceeded the system's command-line length limit.Solution:
Replaced
xargs
with awhile read -r
loop to process each file individually, avoiding command length limits.Relocated existing precondition checks in the encryption task.
Changes:
Added shell checks for the SOPS configuration and Age key file at the beginning of the encryption task.
Replaced the
xargs
command with a while loop to handle file encryption without exceeding command-line length limitations.This PR fixes the command line limit issue while retaining the original precondition checks to ensure all necessary files are present before encryption.