-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text File Busy #441
Comments
As an update, I have also tried to do random file names instead of using - name: Setup Unique Trivy File Name
run: |
echo TRIVY_FILE_NAME=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32).txt >> $GITHUB_ENV
# Check With Trivy
- name: Aqua Security Trivy
uses: aquasecurity/[email protected]
with:
scan-type: "config"
hide-progress: true
ignore-unfixed: true
exit-code: "0"
severity: "CRITICAL,HIGH,MEDIUM"
output: ${{ env.TRIVY_FILE_NAME }}
scan-ref: ${{ matrix.target_directory }}
- name: Publish Trivy Output to Summary
if: ${{ always() }}
run: |
if [[ -s ${{ env.TRIVY_FILE_NAME }} ]]; then
{
echo "### ${{ matrix.target_directory}} Security Output"
echo "<details><summary>Click to expand</summary>"
echo ""
echo '```terraform'
cat ${{ env.TRIVY_FILE_NAME }}
echo '```'
echo "</details>"
} >> $GITHUB_STEP_SUMMARY
fi These jobs run on self-hosted runners (AWS EC!2 instances). Could the reason for the failure being too many parallel jobs are trying to use trivy from the same location |
Another update is I downgraded to [email protected] and had no issues with my CI run. Since the change in this PR for Would appreciate some support regarding this issue as I don't believe it's due to any setup/configuration issues on my end but rather something that isn't working properly in |
Hi @EricAverittTMNA Try to add env like |
@lbvffvbl Thank you for your suggestion. I am calling the trivy workflow from a reusable workflow so the github run_id will be the same for all items in the matrix. So I added the directory path to make it unique but I'm still receiving the same error Calling workflow: - name: Sets MODIFIED_BRANCH_NAME
run: |
echo "MODIFIED_BRANCH_NAME=$( echo ${{ matrix.target_directory }} | tr -d '/' )" >> $GITHUB_ENV
# Check With Trivy
- name: Aqua Security Trivy
uses: aquasecurity/[email protected]
with:
scan-type: "config"
hide-progress: true
ignore-unfixed: true
exit-code: "0"
severity: "CRITICAL,HIGH,MEDIUM"
output: trivy.txt
scan-ref: ${{ matrix.target_directory }}
env:
TRIVY_CACHE_DIR: /tmp/trivy-cache-${{ env.MODIFIED_BRANCH_NAME }}-${{ github.run_id }} matrix.target_directory is something like Error log: Run actions/cache@v4
with:
path: /mnt/vol1/actions-runner05/_work/reponame/reponame/.cache/trivy
key: cache-trivy-2025-01-02
restore-keys: cache-trivy-
enableCrossOsArchive: false
fail-on-cache-miss: false
lookup-only: false
save-always: false
env:
AWS_REGION: ***
TARGET_ASSUME_ROLE_NAME: ***
AWS_DEFAULT_REGION: ***
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_SESSION_TOKEN: ***
TERRAFORM_CLI_PATH: /mnt/vol1/actions-runner05/_work/_temp/470fb504-14c0-42d1-8dbc-fa2cf63fa8ab
MODIFIED_BRANCH_NAME: envppszin
TRIVY_CACHE_DIR: /tmp/trivy-cache-envppszin-12586144996
Cache Size: ~0 MB (177416 B)
/usr/bin/tar -xf /mnt/vol1/actions-runner05/_work/_temp/71822a9c-72c5-43fc-bdb4-aa079a49a3e9/cache.tzst -P -C /mnt/vol1/actions-runner05/_work/reponame/reponame --use-compress-program unzstd
Cache restored successfully
Cache restored from key: cache-trivy-2025-01-02
Run echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH
Run # Note: There is currently no way to distinguish between undefined variables and empty strings in GitHub Actions.
Run entrypoint.sh
Running Trivy with options: trivy config env/pp/sz/in
/mnt/vol1/actions-runner05/_work/_actions/aquasecurity/trivy-action/0.29.0/entrypoint.sh: line 44: /home/ec2-user/.local/bin/trivy-bin/trivy: Text file busy |
also in my case helped skipping installation of trivy (but install it in self-hosted runner yourself before)
|
@lbvffvbl Thank you very much for your support. |
In my current setup, I have Trivy scanning Terraform repos and checking for any vulnerabilities. There are a lot of terraform repos and to make things common, I am using a reusable workflow that will scan a terraform repo via the Trivy Action. During the scan, there are different environments that have different configurations so the scan results will differ based on the terraform but around 20+ environments are scanned at the same time.
This worked without any issues in Trivy Action 0.24.0 however after updating recently to 0.28.0 I am intermittently receiving an error that says "Text file busy". Simply rerunning the failed jobs causes the GitHub CI to succeed however I have to do this almost every time and the environment that fails is different almost every time.
Something has changed with the
entrypoint.sh
file such that my jobs continue to fail periodically. There has not been any update to theentrypoint.sh
file since 0.28.0 so I have not updated to 0.29.0 just yet. Can anyone assist with this issue?CI Preview Setup with failed jobs:
GitHub Failed Job Step Description: (Sensitive information redacted)
The reusable workflow that contains the trivy action code:
The text was updated successfully, but these errors were encountered: