Skip to content

Update slurm_cluster_name regex#5261

Merged
saara-tyagi27 merged 1 commit intoGoogleCloudPlatform:developfrom
saara-tyagi27:update-slurm-cluster-name-regex
Feb 20, 2026
Merged

Update slurm_cluster_name regex#5261
saara-tyagi27 merged 1 commit intoGoogleCloudPlatform:developfrom
saara-tyagi27:update-slurm-cluster-name-regex

Conversation

@saara-tyagi27
Copy link
Contributor

Summary

Update slurm_cluster_name regex to match in upfront and TF Validations and address a bug in TF validations as it took 21 instead of 20 chars max.

Submission Checklist

NOTE: Community submissions can take up to 2 weeks to be reviewed.

Please take the following actions before submitting this pull request.

  • Fork your PR branch from the Toolkit "develop" branch (not main)
  • Test all changes with pre-commit in a local branch #
  • Confirm that "make tests" passes all tests
  • Add or modify unit tests to cover code changes
  • Ensure that unit test coverage remains above 80%
  • Update all applicable documentation
  • Follow Cluster Toolkit Contribution guidelines #

@saara-tyagi27 saara-tyagi27 added the release-bugfix Added to release notes under the "Bug fixes" heading. label Feb 19, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @saara-tyagi27, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an inconsistency and a bug in the validation logic for the slurm_cluster_name variable across the codebase. The changes ensure that both upfront Terraform validations and backend Go validations correctly enforce a maximum length of 20 characters and allow hyphens, providing a unified and accurate validation experience for users.

Highlights

  • Regex Correction for slurm_cluster_name: The regular expression used for validating slurm_cluster_name in Terraform configurations has been updated to correctly enforce a maximum length of 20 characters. Previously, the regex allowed for 21 characters (one initial character plus up to 20 subsequent characters), which was an off-by-one error.
  • Go Backend Validation Update: The Go backend validation for slurm_cluster_name (matchSlurmClusterNameExp) has been modified to align with the new 20-character maximum length and to permit hyphens, matching the updated Terraform validation rules.
  • Test Case and Error Message Adjustments: Unit tests in config_test.go were updated to reflect the new 20-character limit and the allowance of hyphens. Corresponding error messages in errors.go were also revised to accurately describe the updated validation requirements for the cluster name.
  • Example Documentation Clarification: Comments in example deployment YAML files have been updated to correctly state the slurm_cluster_name requirements, now specifying a maximum of 20 characters and including hyphens as allowed characters.
Changelog
  • community/modules/compute/gke-nodeset/variables.tf
    • Updated slurm_cluster_name validation regex to enforce a maximum of 20 characters instead of 21.
  • community/modules/internal/slurm-gcp/instance_template/variables.tf
    • Adjusted slurm_cluster_name validation regex to correctly limit the length to 20 characters.
  • community/modules/scheduler/schedmd-slurm-gcp-v6-controller/modules/slurm_files/variables.tf
    • Modified slurm_cluster_name validation regex to ensure a maximum length of 20 characters.
  • community/modules/scheduler/schedmd-slurm-gcp-v6-controller/variables.tf
    • Updated slurm_cluster_name validation regex to correctly enforce a 20-character maximum.
  • examples/machine-learning/a3-highgpu-8g/a3high-slurm-deployment.yaml
    • Updated comment for slurm_cluster_name to reflect the new 20-character limit and inclusion of hyphens.
  • examples/machine-learning/a3-megagpu-8g/a3mega-slurm-deployment.yaml
    • Revised comment for slurm_cluster_name to indicate the updated 20-character limit and allowed hyphens.
  • pkg/config/config.go
    • Updated matchSlurmClusterNameExp regex to allow hyphens and extend the maximum length to 20 characters.
  • pkg/config/config_test.go
    • Updated valid slurm_cluster_name examples to include hyphens and a 20-character length.
    • Adjusted invalid slurm_cluster_name test case to check for lengths greater than 20 characters.
    • Modified test cases for special characters to align with the updated regex allowing hyphens.
  • pkg/config/errors.go
    • Updated errMsgSlurmClusterNameReqs to reflect the new 20-character limit and allowance of hyphens.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses inconsistencies in the slurm_cluster_name validation across Terraform modules and the Go backend. The changes correctly update the regular expression to allow for a maximum of 20 characters (starting with a lowercase letter, followed by lowercase letters, numbers, or hyphens) and ensure that all associated error messages and documentation reflect these new requirements. The updates to the Go test file config_test.go are comprehensive and accurately validate the new regex and length constraints. Overall, these changes improve the correctness and maintainability of the codebase by standardizing the slurm_cluster_name validation logic.

@saara-tyagi27 saara-tyagi27 marked this pull request as ready for review February 19, 2026 18:55
@saara-tyagi27 saara-tyagi27 requested review from a team and samskillman as code owners February 19, 2026 18:55
@saara-tyagi27 saara-tyagi27 merged commit bd7d176 into GoogleCloudPlatform:develop Feb 20, 2026
16 of 83 checks passed
@saara-tyagi27 saara-tyagi27 deleted the update-slurm-cluster-name-regex branch February 20, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-bugfix Added to release notes under the "Bug fixes" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants