Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Version error when building web app (Cloud Shell) #15

Open
Korath opened this issue Oct 25, 2018 · 6 comments
Open

Version error when building web app (Cloud Shell) #15

Korath opened this issue Oct 25, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@Korath
Copy link

Korath commented Oct 25, 2018

Expected Behaviour

Running bash deployments/deploy.sh web prod would build and deploy application. Running it from CloudShell after configuring based on the wiki.

Actual Behaviour

ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [admin_-20181002]: May only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.

Doesn't seem to like the following in deploy_impl.py

_else:
  cmds = [
      'gcloud', 'app', 'deploy', '--no-promote', '--project={}'.format(
          self.project_id), '--version={}'.format(self.version)]_

If you change to '--version=1' it works fine.

Steps to Reproduce

Build from Cloudshell?

@helfrichmichael
Copy link
Member

Out of curiosity does your username start with admin_? If so, that would explain the issue since it has an underscore which is not permitted according to that error. If this is the case, we might be able to look into simplifying/stripping non-approved characters from usernames.

@Korath
Copy link
Author

Korath commented Oct 26, 2018

Ah so I've tried it logged in on 2 accounts.

admin@domain
first.last@domain

I assume admin is reserved by system so it changes it to admin_@cloudshell and it doesn't like . so changes that one to first_last@cloudshell

@ericwhiteau
Copy link

I had the same issue, using the compute engine vm, as gcp account names are eric_white.

Did the build as root without issue.

@helfrichmichael helfrichmichael added the bug Something isn't working label Dec 19, 2018
@CoreyGriffin
Copy link

I noticed this is still open, and I'm currently running into the same issue with the first.last username setup.

Is there a workaround other than running the build as root or is that the suggested route to take?

@helfrichmichael
Copy link
Member

helfrichmichael commented Feb 19, 2019

So for what it's worth, this is defined here https://github.com/google/loaner/blob/master/loaner/deployments/deploy_impl.py#L272.

@CoreyGriffin and others - to get around this, you can add the following flag to your deployment script --version="name". You'll replace name with your name or something that meets the criteria for the versioning.

I.E. bash deployments/deploy.sh --version="testing" web prod.

@CoreyGriffin
Copy link

Thanks @helfrichmichael

Kinda jank...but I ended up adjusting the logic in deploy_impl.py to account for a symbol as needed

@property
    def version(self, name_separator="."):
        """Returns the version string for the App Engine services as a string.

           name_sparator: Optional argument to be set if you need to split
                          username on symbol. Default: None
                          
                          ex: ".", "-", "_"
                          
                          Orginal: first.last-20190219
                          New: firstlast-20190219

           https://github.com/google/loaner/issues/15
        """
        user = getpass.getuser()
        if name_separator is not None:
            split_username = user.split(name_separator)
            user = split_username[0] + split_username[1]
        if self._version:
            return self._version
        return "{user}-{date}".format(
            user=user,
            date=datetime.datetime.strftime(datetime.datetime.now(), "%Y%m%d"),
        )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants