Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/actions/warm-go-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
name: 'Warm Go build cache'
description: 'Set GOCACHE and optionally warm from EFS-backed PV'
description: 'Set GOCACHE via fuse-overlayfs over the EFS-backed PV or a writable fallback'
runs:
using: composite
steps:
- shell: bash
run: |
echo "GOCACHE=/tmp/go-build-cache" >> "$GITHUB_ENV"
if [ -d /cache/go-build ]; then
mkdir -p /tmp/go-build-cache && \
mkdir -p /tmp/go-build-cache
mounted=false
if [ -d /cache/go-build ] && command -v fuse-overlayfs >/dev/null 2>&1 && [ -e /dev/fuse ]; then
mkdir -p /tmp/go-cache-upper /tmp/go-cache-work
if fuse-overlayfs -o lowerdir=/cache/go-build,upperdir=/tmp/go-cache-upper,workdir=/tmp/go-cache-work /tmp/go-build-cache; then
mounted=true
else
echo "::warning::fuse-overlayfs mount failed, falling back to copy"
fi
Comment on lines +10 to +16

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the correct syntax for fuse-overlayfs mount command with lowerdir, upperdir, and workdir options?

💡 Result:

The correct syntax for the fuse-overlayfs mount command is [1][2]: fuse-overlayfs -o lowerdir=DIR1[:DIR2...],upperdir=UPPER,workdir=WORK MOUNTPOINT Options explanation: -o lowerdir=DIR1[:DIR2...]: A colon-separated list of directories to be merged as the read-only base layers [1][3][4]. -o upperdir=UPPER: The directory where all write changes to the filesystem will be stored [1][3][4]. -o workdir=WORK: An internal working directory required by the filesystem, which must reside on the same filesystem as the upperdir [1][3][4]. MOUNTPOINT: The target directory where the merged filesystem will be accessible [1][3]. Example: fuse-overlayfs -o lowerdir=lower1:lower2,upperdir=upper,workdir=work merged_dir [2] Note that workdir must be an empty directory on the same filesystem as the upperdir [1][3]. If you omit upperdir and workdir, the filesystem will be mounted in a read-only state [5].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,120p' .github/actions/warm-go-cache/action.yaml

Repository: openshift/hypershift

Length of output: 1045


Confirm fuse-overlayfs mount syntax and tighten workdir requirements.

  • The command fuse-overlayfs -o lowerdir=/cache/go-build,upperdir=/tmp/go-cache-upper,workdir=/tmp/go-cache-work /tmp/go-build-cache matches fuse-overlayfs’ documented -o lowerdir=...,upperdir=...,workdir=... MOUNTPOINT syntax, and /tmp/go-build-cache is created before the mount call.
  • To maximize mount success, ensure /tmp/go-cache-work is an empty directory before mounting (the current mkdir -p doesn’t guarantee emptiness per fuse-overlayfs’ requirement).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/actions/warm-go-cache/action.yaml around lines 10 - 16, Ensure the
fuse-overlayfs mount uses a truly empty workdir and that the mountpoint is
created before mounting: before invoking the fuse-overlayfs command referenced
in the script (the line with "fuse-overlayfs -o
lowerdir=/cache/go-build,upperdir=/tmp/go-cache-upper,workdir=/tmp/go-cache-work
/tmp/go-build-cache"), recreate/empty /tmp/go-cache-work (e.g., remove any
contents or rm -rf and then mkdir) so it is guaranteed empty per fuse-overlayfs
requirements, and explicitly mkdir -p /tmp/go-build-cache before the mount
attempt; keep the existing mount invocation and the mounted=true fallback logic
intact.

fi
if [ "$mounted" = "false" ] && [ -d /cache/go-build ]; then
timeout 120 cp -a /cache/go-build/. /tmp/go-build-cache/ || \
echo "::warning::Failed to copy EFS cache, proceeding without cache"
echo "::warning::Failed to copy EFS cache, proceeding without cache"
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
echo "GOCACHE=/tmp/go-build-cache" >> "$GITHUB_ENV"
1 change: 1 addition & 0 deletions Dockerfile.github-actions-runner
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update && \
curl \
ca-certificates \
python3-pip \
fuse-overlayfs \
&& rm -rf /var/lib/apt/lists/*

ARG TARGETARCH
Expand Down
Loading