Skip to content

Commit

Permalink
fix: valid app name for docker registry
Browse files Browse the repository at this point in the history
Signed-off-by: ankitm123 <[email protected]>
  • Loading branch information
ankitm123 committed Dec 27, 2021
1 parent 523c2a4 commit dd7793a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
20 changes: 20 additions & 0 deletions pkg/cmd/variables/test_data/tests/nested/expected.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# generated by: jx gitops variables
export APP_NAME='mygroup-myrepo'
export BRANCH_NAME='PR-23'
export BUILD_NUMBER='5'
export DOCKERFILE_PATH='Dockerfile'
export DOCKER_REGISTRY='my-registry.com'
export DOCKER_REGISTRY_ORG='myowner'
export DOMAIN='mydomain.com'
export GIT_BRANCH='mybranch'
export JENKINS_X_URL='https://dashboard-mydomain.com/MyOwner/mygroup/myrepo/PR-23/5'
export JX_CHART_REPOSITORY='http://bucketrepo/bucketrepo/charts/'
export KANIKO_FLAGS='cheese'
export MINK_AS='tekton-bot'
export MINK_IMAGE='my-registry.com/myowner/mygroup/myrepo:1.2.3'
export PIPELINE_KIND='pullrequest'
export PUSH_CONTAINER_REGISTRY='localhost:5000'
export REPO_NAME='mygroup/myrepo'
export REPO_OWNER='MyOwner'
export VERSION='1.2.3'
2 changes: 1 addition & 1 deletion pkg/cmd/variables/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (o *Options) Validate() error {
{
Name: "APP_NAME",
Function: func() (string, error) {
return o.Options.Repository, nil
return naming.ToValidName(o.Options.Repository), nil
},
},
{
Expand Down
5 changes: 4 additions & 1 deletion pkg/cmd/variables/variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestCmdVariables(t *testing.T) {
o.GitBranch = "mybranch"
o.DashboardURL = "https://dashboard-mydomain.com"

if name == "empty" {
if name == "empty" || name == "nested" {
o.Requirements = &requirements.Spec
}

Expand All @@ -107,6 +107,9 @@ func TestCmdVariables(t *testing.T) {
)
o.Options.Owner = "MyOwner"
o.Options.Repository = "myrepo"
if name == "nested" {
o.Options.Repository = "mygroup/myrepo"
}
o.Options.Branch = "PR-23"
o.Options.SourceURL = "https://github.com/" + o.Options.Owner + "/" + o.Options.Repository
o.Options.ScmClient = scmFake
Expand Down

0 comments on commit dd7793a

Please sign in to comment.