Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deploy][XXS] Ensure Container Names Adhere to GCP Restrictions #45

Open
3 tasks
amrutha97 opened this issue Jan 20, 2025 · 1 comment
Open
3 tasks

Comments

@amrutha97
Copy link
Member

amrutha97 commented Jan 20, 2025

Description
Currently, our container names may not fully comply with Google Cloud Platform's (GCP) naming restrictions. To prevent deployment issues and ensure compatibility, we need to enforce that all container names meet the following GCP constraints:

  • Must be lowercase
  • Can only include alphanumeric characters and dashes (-)
  • No leading or trailing dashes

Expected Behavior

  • All container names generated during deployment should strictly follow the GCP naming rules.

Steps to Reproduce

  1. Deploy a container with a name that violates GCP restrictions (e.g., contains uppercase letters, underscores, or invalid characters).
  2. Observe any errors or warnings during deployment.

Tasks

  • Validate container names before deployment.
  • Add automated checks to enforce lowercase alphanumeric and dash-only naming.
  • Make sure no leading or trailing dashes are allowed.

Resources

Code Pointers

preswald/cli.py Link
preswald/deploy.py Link

@danlm
Copy link

danlm commented Feb 6, 2025

def get_container_name(script_path: str) -> str:
"""Generate a consistent container name for a given script"""
return f"preswald-app-{Path(script_path).stem}"

Using regular expressions:

import re
def get_container_name(script_path: str) -> str: 
    """Generate a consistent container name for a given script""" 
    container_name = f"preswald-app-{Path(script_path).stem}" 
    container_name = container_name.lower()
    container_name = re.sub(r"[^a-z0-9-]", "", container_name)
    container_name = container_name.strip('-')
    return container_name

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

No branches or pull requests

2 participants