Skip to content

[Swarming] Skip GCE detection on Swarming bots - #5535

Merged
IvanBM18 merged 1 commit into
masterfrom
fix/is-gce-skip-swarming
Oct 8, 2026
Merged

IvanBM18 merged 1 commit into
masterfrom
fix/is-gce-skip-swarming

Conversation

@IvanBM18

@IvanBM18 IvanBM18 commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Bug: b/571127789

Background

Since #5479, is_gce() uses GCE_METADATA_HOST and treats any TCP connection to it as "on GCE".

Swarming's uses a cli tool: luci-auth context which sets GCE_METADATA_HOST to a server that mints tokens so that swarming bots can connect to gcp services, but seems that luci-auth emulator is so good that it fools CF to believe that is running on a GCE bot, hence causing failures in swarming when:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://127.0.0.1:36755/computeMetadata/v1/instance/zone

This change only affects Swarming bots. A broader option (probe instance/id instead of a TCP connect) is on a separate branch, because it changes behaviour on every bot.

Changes

  • compute_metadata.is_gce() now returns False right away when environment.is_running_on_swarming() is true.

Test

  • Add test_is_gce_on_swarming: with SWARMING_BOT=True, is_gce() returns False even when the metadata host is reachable.

@IvanBM18
IvanBM18 requested a review from a team as a code owner October 7, 2026 23:35
@IvanBM18 IvanBM18 changed the title [Metrics] Skip GCE detection on Swarming bots [Swarming] Skip GCE detection on Swarming bots Oct 7, 2026
@IvanBM18
IvanBM18 requested a review from dylanjew October 7, 2026 23:39
@IvanBM18 IvanBM18 added the swarming Changes related to the clusterfuzz-swarming integration label Oct 7, 2026
@IvanBM18
IvanBM18 added this pull request to stack #5537 October 7, 2026 23:50

@dylanjew dylanjew left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this behavior change something we can catch in the new integration tests you're setting up?

Yes!

On Swarming, luci-auth context exports GCE_METADATA_HOST pointing to its
local token-only metadata emulator. Since #5479, is_gce() honours that
variable and only checks for a TCP connection, so Swarming bots were
treated as GCE and crashed fetching instance/zone (404).

Bug: b/571127789
@IvanBM18
IvanBM18 force-pushed the fix/is-gce-skip-swarming branch from 5e50a7c to feffa50 Compare October 8, 2026 17:05
@IvanBM18
IvanBM18 merged commit 8473191 into master Oct 8, 2026
15 checks passed
@IvanBM18
IvanBM18 deleted the fix/is-gce-skip-swarming branch October 8, 2026 17:24
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.

2 participants