Skip to content

CI: Properly namespace directors#2742

Merged
selzoc merged 1 commit into
mainfrom
fix-bats-cleanup
Jun 4, 2026
Merged

CI: Properly namespace directors#2742
selzoc merged 1 commit into
mainfrom
fix-bats-cleanup

Conversation

@selzoc
Copy link
Copy Markdown
Member

@selzoc selzoc commented Jun 4, 2026

The cleanup-leftover-environemnts task in the bats job was unintentionally targeting directors from other jobs that run concurrently, leading to failures of those jobs or the cleanup.

This happened because each job shared the same deploy-director script, which named the director "bats-director", and the leftover filter used was just "bats". Instead, use the name of the environment to name the director.

As an additional upside, now all the other *-cleanup-leftovers jobs will correctly clean up their own directors as well.

The cleanup-leftover-environemnts task in the bats job was
unintentionally targeting directors from other jobs that run concurrently,
leading to failures of those jobs or the cleanup.

This happened because each job shared the same deploy-director script,
which named the director "bats-director", and the leftover filter used
was just "bats".  Instead, use the name of the environment to name the
director.

As an additional upside, now all the other *-cleanup-leftovers jobs will
correctly clean up their own directors as well.

ai-assisted=yes
[TNZ-88995]
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4a4a1707-d855-456c-9b78-3863b242df6d

📥 Commits

Reviewing files that changed from the base of the PR and between ad09ae6 and 6513c34.

📒 Files selected for processing (1)
  • ci/bats/tasks/deploy-director.sh

Walkthrough

The deploy-director script now dynamically derives the director name from the environment metadata's network field using jq, defaulting to bats-director when metadata is unavailable. The bosh-cli interpolate invocation passes this computed director_name as a variable argument instead of hard-coding the value, allowing per-environment network naming to propagate through BOSH deployment configurations.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. While it explains the problem and solution, it lacks critical sections from the template: contextual links, comprehensive test results, release notes guidance, breaking change assessment, and team tags. Add missing template sections: contextual information/links, test results, release notes description for operators, breaking change assessment, and team tags for follow-up.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'CI: Properly namespace directors' directly and clearly summarizes the main change: implementing proper namespacing for directors by using environment names instead of hard-coded values.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-bats-cleanup

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@selzoc
Copy link
Copy Markdown
Member Author

selzoc commented Jun 4, 2026

Example: https://bosh.ci.cloudfoundry.org/teams/main/pipelines/bosh-director/jobs/bats/builds/519

7 errors occurred:
	* [Compute Instance: vm-efba1606-3185-426f-41bc-93cf58902e84 (upgrade-postgres, bats-director, bats-director-zookeeper, bats-director-zookeeper-zookeeper, bosh-director, zookeeper, zookeeper-zookeeper)] Set Disk Auto Delete: Do request: googleapi: Error 409: Resource 'projects/((redacted))/zones/europe-west2-a/instances/vm-efba1606-3185-426f-41bc-93cf58902e84' has an ongoing conflicting operation: '[projects/((redacted))/zones/europe-west2-a/operations/operation-1780602214867-65372c280e0e7-57b2aae7-c66adc42]'., conflict
	* [Compute Instance: vm-acf484e0-8903-4e0b-7f91-dde5c02ec79d (upgrade-postgres, bats-director, bats-director-zookeeper, bats-director-zookeeper-zookeeper, bosh-director, zookeeper, zookeeper-zookeeper)] Set Disk Auto Delete: Do request: googleapi: Error 409: Resource 'projects/((redacted))/zones/europe-west2-a/instances/vm-acf484e0-8903-4e0b-7f91-dde5c02ec79d' has an ongoing conflicting operation: '[projects/((redacted))/zones/europe-west2-a/operations/operation-1780602214000-65372c273a73c-61c7e1d0-92e518cd]'., conflict
	* [Compute Instance: vm-130de81a-27f0-41a7-4c1e-f7896cf1eaff (upgrade-mysql, bats-director, bats-director-zookeeper, bats-director-zookeeper-zookeeper, bosh-director, zookeeper, zookeeper-zookeeper)] Set Disk Auto Delete: Do request: googleapi: Error 409: Resource 'projects/((redacted))/zones/europe-west2-a/instances/vm-130de81a-27f0-41a7-4c1e-f7896cf1eaff' has an ongoing conflicting operation: '[projects/((redacted))/zones/europe-west2-a/operations/operation-1780602212354-65372c25a8a78-5f774271-c91d9649]'., conflict
	* [Compute Instance: vm-d71a8a93-e573-4790-70f1-f4998cc56a5d (upgrade-mysql, bats-director, bats-director-zookeeper, bats-director-zookeeper-zookeeper, bosh-director, zookeeper, zookeeper-zookeeper)] Set Disk Auto Delete: Do request: googleapi: Error 409: Resource 'projects/((redacted))/zones/europe-west2-a/instances/vm-d71a8a93-e573-4790-70f1-f4998cc56a5d' has an ongoing conflicting operation: '[projects/((redacted))/zones/europe-west2-a/operations/operation-1780602212329-65372c25a29df-703ec566-9aad7028]'., conflict
	* [Compute Instance: vm-8f2a28b4-946b-4d4d-61db-e118b671b53c (upgrade-mysql, bats-director, bats-director-zookeeper, bats-director-zookeeper-zookeeper, bosh-director, zookeeper, zookeeper-zookeeper)] Set Disk Auto Delete: Do request: googleapi: Error 409: Resource 'projects/((redacted))/zones/europe-west2-a/instances/vm-8f2a28b4-946b-4d4d-61db-e118b671b53c' has an ongoing conflicting operation: '[projects/((redacted))/zones/europe-west2-a/operations/operation-1780602213133-65372c2666d1f-d3c004dd-2b480df1]'., conflict
	* [Compute Instance: vm-0daecb09-b9de-43eb-4452-4b9fc845897a (upgrade-postgres, bats-director, bats-director-zookeeper, bats-director-zookeeper-zookeeper, bosh-director, zookeeper, zookeeper-zookeeper)] Set Disk Auto Delete: Do request: googleapi: Error 409: Resource 'projects/((redacted))/zones/europe-west2-a/instances/vm-0daecb09-b9de-43eb-4452-4b9fc845897a' has an ongoing conflicting operation: '[projects/((redacted))/zones/europe-west2-a/operations/operation-1780602213343-65372c269a18c-83fa61bc-e7ee6f83]'., conflict
	* [Compute Instance: vm-291d3155-bef4-4471-7d30-145cac2fd25b (fips-director, bat, bat-batlight, batlight, bats-director, bats-director-bat, bats-director-bat-batlight, bosh-director)] Delete: Operation error: The resource 'projects/((redacted))/zones/europe-west2-a/instances/vm-291d3155-bef4-4471-7d30-145cac2fd25b' was not found

@selzoc
Copy link
Copy Markdown
Member Author

selzoc commented Jun 4, 2026

It also unintentionally deleted bats vms from the stemcell pipeline, working on a fix for that as well:

[Compute Instance: vm-a3960639-3734-4736-536a-0041b41dfcf5 (bosh-concourse, test-stemcells-bats)] Deleted!

@selzoc selzoc merged commit 0e28e23 into main Jun 4, 2026
22 checks passed
@selzoc selzoc deleted the fix-bats-cleanup branch June 4, 2026 22:07
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.

2 participants