cloud-builders icon indicating copy to clipboard operation
cloud-builders copied to clipboard

Substitution $REPO_NAME is misleading

Open subk opened this issue 9 years ago • 3 comments

$REPO_NAME substitution is misleading as you expect to only get repository name instead of the more verbose {SOURCE}-{ORG}-{REPOSITORY} (eg: github-my-org-hello-world-repo)

maybe a $REPO_SHORTNAME could be added ?

subk avatar Mar 15 '17 21:03 subk

If I understand your request, your pb is that you get a $REPO_NAME like : github-my-organisation-user-service and you would like $REPO_NAME to equals user-service.

This name is generated when you create a build trigger. But you can choose the name you want if you create the repository by your own.

1 - create a repository in the google console (Menu "Source repositories" -> "Repositories" -> "Create repository"), you choose the name of the repository (like user-service) and select the github repository you want. 2 - Create the build trigger using the repository you've just created. 3 - The $REPO_NAME should have the user-servicevalue.

cedrelek avatar Apr 03 '18 11:04 cedrelek

This GitHub issue tracker is intended for bugs with the officially supported builder images specifically. Please report issues and feature requests regarding the GCB service to our public issue tracker at https://issuetracker.google.com/issues/new?component=190802&template=1162743

bendory avatar Jun 14 '19 18:06 bendory

$REPO_NAME substitution is misleading as you expect to only get repository name instead of the more verbose {SOURCE}-{ORG}-{REPOSITORY} (eg: github-my-org-hello-world-repo)

maybe a $REPO_SHORTNAME could be added ?

It sounds like you have a reposync (mirroring) trigger. Google Cloud Build does support Bash parameter expansion. You should be able to get what you need using that. See: https://cloud.google.com/build/docs/configuring-builds/use-bash-and-bindings-in-substitutions#bash_parameter_expansions

In the case above, just create a new user defined substitution like: $_REPO_SHORTNAME --> ${REPO_NAME/#github-my-org-}

should remove the prefix"github-my-org-" from the repo name.

car409 avatar Feb 17 '21 00:02 car409