Skip to content

ci: Free up disk space for the test job#279

Merged
rm3l merged 1 commit intoredhat-developer:mainfrom
rm3l:ci/free_up_disk_space_for_test_job
Dec 5, 2025
Merged

ci: Free up disk space for the test job#279
rm3l merged 1 commit intoredhat-developer:mainfrom
rm3l:ci/free_up_disk_space_for_test_job

Conversation

@rm3l
Copy link
Copy Markdown
Member

@rm3l rm3l commented Dec 5, 2025

Description of the change

Running in-place upgrades might require pulling multiple images.
This is prevent similar issues faced in the operator repo and fixed in redhat-developer/rhdh-operator#1972

Which issue(s) does this PR fix or relate to

How to test changes / Special notes to the reviewer

Checklist

  • For each Chart updated, version bumped in the corresponding Chart.yaml according to Semantic Versioning.
  • For each Chart updated, variables are documented in the values.yaml and added to the corresponding README.md. The pre-commit utility can be used to generate the necessary content. Use pre-commit run -a to apply changes. The pre-commit Workflow will do this automatically for you if needed.
  • JSON Schema template updated and re-generated the raw schema via the pre-commit hook.
  • Tests pass using the Chart Testing tool and the ct lint command.
  • If you updated the orchestrator-infra chart, make sure the versions of the Knative CRDs are aligned with the versions of the CRDs installed by the OpenShift Serverless operators declared in the values.yaml file. See Installing Knative Eventing and Knative Serving CRDs for more details.

Running in-place upgrades might require pulling multiple images
@rhdh-qodo-merge
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🔒 No security concerns identified
⚡ No major issues detected
📚 Focus areas based on broader codebase context

Workflow Action Misuse

The free-disk-space step sets rm_cmd: "rmz", which is a nonstandard command and likely breaks the cleanup, leaving images and tooling in place. This can prevent pulling multiple images needed for tests that rely on the configured test images in values files. (Ref 1, Ref 4)

- name: Remove unnecessary files to free up disk space
  if: steps.list-changed.outputs.changed == 'true'
  uses: endersonmenezes/free-disk-space@6c4664f43348c8c7011b53488d5ca65e9fc5cd1a # v3
  with:
    remove_android: true
    remove_dotnet: true
    remove_haskell: true
    rm_cmd: "rmz"

Reference reasoning: The charts define specific test images (e.g., curl and bitnami/kubectl) that must be pulled during CI. If disk cleanup does not run properly due to an invalid command, available space may be insufficient to pull these images. The referenced values files show the reliance on these images for tests, underscoring the need for a functioning cleanup step to ensure adequate disk space.

📄 References
  1. redhat-developer/rhdh-chart/charts/backstage/ci/with-custom-image-for-test-pod-values.yaml [1-15]
  2. redhat-developer/rhdh-chart/charts/orchestrator-infra/values.yaml [37-41]
  3. redhat-developer/rhdh-chart/charts/orchestrator-software-templates-infra/ci/upstream-values.yaml [1-27]
  4. redhat-developer/rhdh-chart/charts/orchestrator-software-templates-infra/values.yaml [141-163]
  5. redhat-developer/rhdh-chart/charts/orchestrator-infra/templates/tests/infra-test.yaml [0-2]
  6. redhat-developer/rhdh-chart/charts/orchestrator-software-templates-infra/templates/tests/infra-test.yaml [0-2]
  7. redhat-developer/rhdh-chart/charts/orchestrator-software-templates-infra/templates/openshift-pipelines/post-cleanup.yaml [0-2]
  8. redhat-developer/rhdh-chart/charts/orchestrator-software-templates-infra/templates/openshift-gitops/post-cleanup.yaml [0-2]

@rhdh-qodo-merge rhdh-qodo-merge Bot added Review effort 2/5 enhancement New feature or request labels Dec 5, 2025
@rhdh-qodo-merge
Copy link
Copy Markdown

PR Type

Enhancement


Description

  • Add disk space cleanup step to free resources before running chart tests

  • Removes unnecessary Android, .NET, and Haskell files during test workflow

  • Prevents disk space issues when pulling multiple images for in-place upgrades


File Walkthrough

Relevant files
Enhancement
test.yaml
Add disk space cleanup step to test workflow                         

.github/workflows/test.yaml

  • Added new workflow step to remove unnecessary files and free disk
    space
  • Uses endersonmenezes/free-disk-space action to clean Android, .NET,
    and Haskell artifacts
  • Step runs conditionally when chart changes are detected
  • Prevents disk space exhaustion during image pulls in in-place upgrade
    tests
+9/-0     

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Dec 5, 2025

@rm3l rm3l merged commit c2101ea into redhat-developer:main Dec 5, 2025
6 of 7 checks passed
@rhdh-qodo-merge
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Security
Replace third-party action with script

Replace the third-party GitHub Action endersonmenezes/free-disk-space with a run
step that uses shell commands to delete unnecessary files. This improves
security and reduces external dependencies.

.github/workflows/test.yaml [55-62]

-- name: Remove unnecessary files to free up disk space
+- name: Free up disk space
   if: steps.list-changed.outputs.changed == 'true'
-  uses: endersonmenezes/free-disk-space@6c4664f43348c8c7011b53488d5ca65e9fc5cd1a # v3
-  with:
-    remove_android: true
-    remove_dotnet: true
-    remove_haskell: true
-    rm_cmd: "rmz"
+  run: |
+    echo "Freeing up disk space by removing Android, .NET, and Haskell SDKs..."
+    sudo rm -rf /usr/local/lib/android
+    sudo rm -rf /usr/share/dotnet
+    sudo rm -rf /opt/ghc
+    echo "Disk space freed."
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies an unnecessary third-party dependency and proposes a more secure and self-contained solution using a run script, which is a best practice for CI/CD pipelines.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant