Skip to content

GHA - free disk space in mnt directory#34

Open
ada333 wants to merge 2 commits into
jiridanek:mainfrom
ada333:Issue-10
Open

GHA - free disk space in mnt directory#34
ada333 wants to merge 2 commits into
jiridanek:mainfrom
ada333:Issue-10

Conversation

@ada333
Copy link
Copy Markdown

@ada333 ada333 commented Jul 22, 2025

Fixes #10
Adding a new step in GHA to free disk space in mnt directory, because there were some rare errors with full disk usage.

Summary by CodeRabbit

  • Chores
    • Updated multiple GitHub Actions workflows to include a step that frees up disk space and disables swap, helping to prevent rare disk space exhaustion issues during workflow execution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 22, 2025

Walkthrough

A new step was added to three GitHub Actions workflow files to address disk space exhaustion by freeing space in the /mnt directory and disabling swap after Python 3.13 is set up. This aims to prevent failures during subsequent steps that require significant disk space, such as pulling large Docker images.

Changes

File(s) Change Summary
.github/workflows/rhoai-in-kind-with-cypress.yaml
.github/workflows/rhoai-in-kind-with-odh-tests-shiftleft.yaml
.github/workflows/rhoai-in-kind-with-ods-ci.yaml
Added a "Free disk space and swapoff" step after Python 3.13 setup: shows disk usage, disables swap, clears /mnt.

Estimated code review effort

1 (~3 minutes)

Poem

The disk was full, the runners cried,
So rabbit hopped in, disk space supplied.
With swap turned off and /mnt swept clean,
Now workflows run, no errors seen!
🐇✨

Onward we go, with storage anew,
For Docker pulls and tests to pursue!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49181ec and 81ad0c5.

📒 Files selected for processing (1)
  • .github/workflows/rhoai-in-kind-with-ods-ci.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/rhoai-in-kind-with-ods-ci.yaml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
.github/workflows/rhoai-in-kind-with-cypress.yaml (1)

52-60: Same glob-failure risk as in other workflow

Replicate the null-glob or || true safeguard here; otherwise the Cypress workflow may still fail when /mnt is empty.

(See earlier comment for concrete patch.)

🧹 Nitpick comments (2)
.github/workflows/rhoai-in-kind-with-odh-tests-shiftleft.yaml (1)

34-34: Remove trailing whitespace to satisfy YAML-lint

A trailing space on this line is flagged by the CI linter.
Delete the extra space to keep the workflow lint-clean.

-          python-version: '3.13'␠
+          python-version: '3.13'
.github/workflows/rhoai-in-kind-with-ods-ci.yaml (1)

34-90: Consider a reusable composite action to DRY the three identical cleanup steps

Three workflows now carry identical bash snippets.
Packaging this as a local composite action (e.g. .github/actions/free-disk-space) would:

• eliminate duplication
• ensure future tweaks propagate everywhere
• allow unit-testing in isolation

Not a blocker, but worth considering.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51f92f3 and 49181ec.

📒 Files selected for processing (3)
  • .github/workflows/rhoai-in-kind-with-cypress.yaml (1 hunks)
  • .github/workflows/rhoai-in-kind-with-odh-tests-shiftleft.yaml (1 hunks)
  • .github/workflows/rhoai-in-kind-with-ods-ci.yaml (1 hunks)
🪛 YAMLlint (1.37.1)
.github/workflows/rhoai-in-kind-with-odh-tests-shiftleft.yaml

[error] 34-34: trailing spaces

(trailing-spaces)

.github/workflows/rhoai-in-kind-with-ods-ci.yaml

[error] 90-90: trailing spaces

(trailing-spaces)

🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/rhoai-in-kind-with-odh-tests-shiftleft.yaml

[error] 34-34: trailing spaces

(trailing-spaces)

.github/workflows/rhoai-in-kind-with-ods-ci.yaml

[error] 90-90: trailing spaces

(trailing-spaces)

Comment on lines +34 to 44

# https://github.com/jiridanek/rhoai-in-kind/issues/10
# ERROR: very rarely, we end up with a full disk in mnt directory
- name: Free disk space and swapoff
run: |
df -h
sudo du -sh /mnt/*
sudo swapoff -a
sudo rm -rf /mnt/*
df -h

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Guard against empty /mnt/* glob to avoid sporadic job failures

GitHub runners execute run: scripts with bash -eo pipefail.
If /mnt is already empty, both
sudo du -sh /mnt/* and sudo rm -rf /mnt/* expand to a literal *, return exit code 1, and the step aborts – defeating the purpose of making the workflow more reliable.

-  sudo du -sh /mnt/*
-  sudo rm -rf /mnt/*
+  shopt -s nullglob
+  sudo du -sh /mnt/* || true   # tolerate empty dir
+  sudo rm -rf /mnt/* || true
+  shopt -u nullglob

Alternatively, wrap the commands in if [ -n "$(ls -A /mnt)" ]; then …; fi.


Guard against empty /mnt glob in GitHub Actions

Under the default bash -eo pipefail shell, an empty glob (/mnt/*) expands to the literal *, causing du or rm to fail and abort the step. You can prevent this by enabling nullglob (or wrapping in a conditional).

File: .github/workflows/rhoai-in-kind-with-odh-tests-shiftleft.yaml (around lines 34–44)

• Enable/disable nullglob and add || true to tolerate an empty directory:

-      sudo du -sh /mnt/*
-      sudo rm -rf /mnt/*
+      shopt -s nullglob
+      sudo du -sh /mnt/* || true   # tolerate empty dir
+      sudo rm -rf /mnt/* || true
+      shopt -u nullglob

• Alternatively, wrap in an if check:

      run: |
        df -h
        if [ -n "$(ls -A /mnt)" ]; then
          sudo du -sh /mnt/*
          sudo rm -rf /mnt/*
        fi
        sudo swapoff -a
        df -h

These changes ensure the cleanup step never fails when /mnt is empty.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 34-34: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/rhoai-in-kind-with-odh-tests-shiftleft.yaml around lines 34
to 44, the use of the glob pattern /mnt/* can cause the step to fail if /mnt is
empty because the glob expands to a literal asterisk. To fix this, modify the
run script to either enable the nullglob shell option before using the glob or
wrap the du and rm commands inside a conditional that checks if /mnt is
non-empty. This prevents errors by ensuring the commands only run when there are
files to process.

Comment on lines +81 to +90
# https://github.com/jiridanek/rhoai-in-kind/issues/10
# ERROR: very rarely, we end up with a full disk in mnt directory
- name: Free disk space and swapoff
run: |
df -h
sudo du -sh /mnt/*
sudo swapoff -a
sudo rm -rf /mnt/*
df -h

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Harden cleanup step & fix trailing whitespace

  1. Apply the null-glob / || true pattern to prevent empty-directory failures.
  2. Line 90 contains trailing spaces – YAML-lint error; remove them.
-  sudo du -sh /mnt/*
-  sudo rm -rf /mnt/*
+  shopt -s nullglob
+  sudo du -sh /mnt/* || true
+  sudo rm -rf /mnt/* || true
+  shopt -u nullglob

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 90-90: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/rhoai-in-kind-with-ods-ci.yaml around lines 81 to 90, the
cleanup step can fail if the /mnt directory is empty and line 90 has trailing
whitespace causing a YAML-lint error. Fix this by adding the null-glob or `||
true` pattern to the rm command to avoid errors when no files exist, and remove
any trailing spaces on line 90 to comply with YAML formatting rules.

python-version: '3.13'

# https://github.com/jiridanek/rhoai-in-kind/issues/10
# ERROR: very rarely, we end up with a full disk in mnt directory
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ERROR: very rarely, we end up with a full disk in mnt directory
# very rarely, GitHub Actions hosted runner begins with a completely full `/mnt` directory

python-version: '3.13'

# https://github.com/jiridanek/rhoai-in-kind/issues/10
# ERROR: very rarely, we end up with a full disk in mnt directory
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ERROR: very rarely, we end up with a full disk in mnt directory
# very rarely, GitHub Actions hosted runner begins with a completely full `/mnt` directory

python-version: '3.13'

# https://github.com/jiridanek/rhoai-in-kind/issues/10
# ERROR: very rarely, we end up with a full disk in mnt directory
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ERROR: very rarely, we end up with a full disk in mnt directory
# very rarely, GitHub Actions hosted runner begins with a completely full `/mnt` directory

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kind install runs out of disk space?

2 participants