Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

Override service name instead of REPO_NAME(Gist support) #4

Closed
apstndb opened this issue May 4, 2019 · 4 comments
Closed

Override service name instead of REPO_NAME(Gist support) #4

apstndb opened this issue May 4, 2019 · 4 comments

Comments

@apstndb
Copy link

apstndb commented May 4, 2019

Currently, cloud-run-button uses REPO_NAME as container image repository and Cloud Run service name. It seems not to be configurable.
Because Cloud Run forbids service name which starts with a number, cloud-run-button is not compatible with some GitHub Gist repository.

ERROR: (gcloud.beta.run.deploy) INVALID_ARGUMENT: The request has errors
- '@type': type.googleapis.com/google.rpc.BadRequest
  fieldViolations:
  - description: Service name must use only letters, numbers and '-'. Must begin with
      a letter and cannot end with a '-'. Maximum length is 63 characters.
    field: metadata.name
If it is configurable, cloud-run-button become GitHub Gist compatible.

Ref: https://gist.github.com/apstndb/63022c10ca5e94ed6e7c1dff9d5dbeaf

@apstndb
Copy link
Author

apstndb commented May 4, 2019

If service name is prefixed, it will be happy enough.

@jamesward
Copy link
Owner

Here is how the SERVICE_NAME is created:

SERVICE_NAME=$(echo $REPO_NAME | sed -e 's/[^a-z0-9\-]//g')

It won't be too hard to deal with REPO_NAME's that start with a number. And I also need to deal with the max chars. I'll get this done asap.

@jamesward
Copy link
Owner

Sorry for the delay. This should be fixed now.

@apstndb
Copy link
Author

apstndb commented May 10, 2019

Thanks!

It works well and I have noticed SERVICE_NAME is prefixed by x in some cases.
I want to confirm SERVICE_NAME generation rule.
Is SERVICE_NAME created as like below?

SERVICE_NAME=$(echo $REPO_NAME | sed -e 's/[^a-z0-9\-]//g' | sed -E 's/^([0-9])/x\1/')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants