Skip to content

Swarming: Avoids mounting volume#5213

Merged
IvanBM18 merged 4 commits intomasterfrom
feature/swarming/docker-mount
Mar 24, 2026
Merged

Swarming: Avoids mounting volume#5213
IvanBM18 merged 4 commits intomasterfrom
feature/swarming/docker-mount

Conversation

@IvanBM18
Copy link
Collaborator

@IvanBM18 IvanBM18 commented Mar 20, 2026

Overview

Swarming, as well as K8S has issues when trying to mount this volume to the container.

mount /mnt/scratch0 -o remount,exec,suid,dev

So we added a validation to not mount when we are either in K8S or in swarming.

Note: Uses SWARMING_BOT env var as its the one we already use in the swarming request

Tests performed

I created a custom bash script to test this:

is_truthy() {
  [[ "$1" =~ ^([Tt]rue|1)$ ]]
}

should_mount() {
  if is_truthy "$IS_K8S_ENV" || is_truthy "$SWARMING_BOT"; then
    return 1
  fi
  return 0
}

test_mount() {
  unset IS_K8S_ENV SWARMING_BOT
  [[ "$1" != "unset" ]] && export IS_K8S_ENV=$1
  [[ "$2" != "unset" ]] && export SWARMING_BOT=$2
  printf "IS_K8S_ENV=%-5s | SWARMING_BOT=%-5s  =>" "$1" "$2"
  if should_mount; then echo " [MOUNT EXECUTED]"; else echo " [MOUNT SKIPPED]"; fi
}
'

Against multiple inputs:

echo "=== DRY RUN OUTPUT USING is_truthy() ==="
test_mount "unset" "unset"
test_mount "1"     "unset"
test_mount "true"  "unset"
test_mount "false" "unset"
test_mount "False" "unset"
test_mount "0"     "unset"
test_mount "unset" "True"
test_mount "unset" "1"
test_mount "unset" "false"
test_mount "false" "false"

And got this results:

=== DRY RUN OUTPUT USING is_truthy() ===
IS_K8S_ENV=unset | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=1     | SWARMING_BOT=unset  => [MOUNT SKIPPED]
IS_K8S_ENV=true  | SWARMING_BOT=unset  => [MOUNT SKIPPED]
IS_K8S_ENV=false | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=False | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=0     | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=unset | SWARMING_BOT=True   => [MOUNT SKIPPED]
IS_K8S_ENV=unset | SWARMING_BOT=1      => [MOUNT SKIPPED]
IS_K8S_ENV=unset | SWARMING_BOT=false  => [MOUNT EXECUTED]
IS_K8S_ENV=false | SWARMING_BOT=false  => [MOUNT EXECUTED]

@IvanBM18 IvanBM18 self-assigned this Mar 20, 2026
@IvanBM18 IvanBM18 requested a review from a team as a code owner March 20, 2026 23:21
@IvanBM18 IvanBM18 added the swarming Changes related to the clusterfuzz-swarming integration label Mar 20, 2026
@IvanBM18 IvanBM18 force-pushed the feature/swarming/docker-mount branch from 63d4a39 to 0015431 Compare March 20, 2026 23:29
@jardondiego
Copy link
Collaborator

We have a failing check, is that failure related to this change?

@javanlacerda
Copy link
Collaborator

/gcbrun

Copy link
Collaborator

@javanlacerda javanlacerda left a comment

Choose a reason for hiding this comment

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

LGTM. I'm just afraid we would need to generate a new base image and update it for the clusterfuzz instances for applying this change, and it seems the pipeline for building the base images is broken.

You think running the swarming containers with IS_K8S_ENV=True would mitigate it for now?

@IvanBM18
Copy link
Collaborator Author

LGTM. I'm just afraid we would need to generate a new base image and update it for the clusterfuzz instances for applying this change, and it seems the pipeline for building the base images is broken.

You think running the swarming containers with IS_K8S_ENV=True would mitigate it for now?

Sure we can work with that till the main issue is fixed

@IvanBM18 IvanBM18 merged commit ce73154 into master Mar 24, 2026
10 checks passed
@IvanBM18 IvanBM18 deleted the feature/swarming/docker-mount branch March 24, 2026 18:53
IvanBM18 added a commit that referenced this pull request Mar 24, 2026
## Overview
Swarming, as well as K8S has issues when trying to mount this volume to
the container.
```bash
mount /mnt/scratch0 -o remount,exec,suid,dev
```
So we added a validation to not mount when we are either in K8S or in
swarming.

Note: Uses SWARMING_BOT env var as its the one we [already use in the
swarming
request](https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/swarming/__init__.py#L134)

## Tests performed
I created a custom bash script to test this:
```bash
is_truthy() {
  [[ "$1" =~ ^([Tt]rue|1)$ ]]
}

should_mount() {
  if is_truthy "$IS_K8S_ENV" || is_truthy "$SWARMING_BOT"; then
    return 1
  fi
  return 0
}

test_mount() {
  unset IS_K8S_ENV SWARMING_BOT
  [[ "$1" != "unset" ]] && export IS_K8S_ENV=$1
  [[ "$2" != "unset" ]] && export SWARMING_BOT=$2
  printf "IS_K8S_ENV=%-5s | SWARMING_BOT=%-5s  =>" "$1" "$2"
  if should_mount; then echo " [MOUNT EXECUTED]"; else echo " [MOUNT SKIPPED]"; fi
}
'
```
Against multiple inputs:
```bash
echo "=== DRY RUN OUTPUT USING is_truthy() ==="
test_mount "unset" "unset"
test_mount "1"     "unset"
test_mount "true"  "unset"
test_mount "false" "unset"
test_mount "False" "unset"
test_mount "0"     "unset"
test_mount "unset" "True"
test_mount "unset" "1"
test_mount "unset" "false"
test_mount "false" "false"
```
And got this results:
```bash
=== DRY RUN OUTPUT USING is_truthy() ===
IS_K8S_ENV=unset | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=1     | SWARMING_BOT=unset  => [MOUNT SKIPPED]
IS_K8S_ENV=true  | SWARMING_BOT=unset  => [MOUNT SKIPPED]
IS_K8S_ENV=false | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=False | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=0     | SWARMING_BOT=unset  => [MOUNT EXECUTED]
IS_K8S_ENV=unset | SWARMING_BOT=True   => [MOUNT SKIPPED]
IS_K8S_ENV=unset | SWARMING_BOT=1      => [MOUNT SKIPPED]
IS_K8S_ENV=unset | SWARMING_BOT=false  => [MOUNT EXECUTED]
IS_K8S_ENV=false | SWARMING_BOT=false  => [MOUNT EXECUTED]

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

Labels

swarming Changes related to the clusterfuzz-swarming integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants