Skip to content

Commit dd7793a

Browse files
committed
fix: valid app name for docker registry
Signed-off-by: ankitm123 <ankitmohapatra123@gmail.com>
1 parent 523c2a4 commit dd7793a

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
# generated by: jx gitops variables
3+
export APP_NAME='mygroup-myrepo'
4+
export BRANCH_NAME='PR-23'
5+
export BUILD_NUMBER='5'
6+
export DOCKERFILE_PATH='Dockerfile'
7+
export DOCKER_REGISTRY='my-registry.com'
8+
export DOCKER_REGISTRY_ORG='myowner'
9+
export DOMAIN='mydomain.com'
10+
export GIT_BRANCH='mybranch'
11+
export JENKINS_X_URL='https://dashboard-mydomain.com/MyOwner/mygroup/myrepo/PR-23/5'
12+
export JX_CHART_REPOSITORY='http://bucketrepo/bucketrepo/charts/'
13+
export KANIKO_FLAGS='cheese'
14+
export MINK_AS='tekton-bot'
15+
export MINK_IMAGE='my-registry.com/myowner/mygroup/myrepo:1.2.3'
16+
export PIPELINE_KIND='pullrequest'
17+
export PUSH_CONTAINER_REGISTRY='localhost:5000'
18+
export REPO_NAME='mygroup/myrepo'
19+
export REPO_OWNER='MyOwner'
20+
export VERSION='1.2.3'

pkg/cmd/variables/variables.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func (o *Options) Validate() error {
197197
{
198198
Name: "APP_NAME",
199199
Function: func() (string, error) {
200-
return o.Options.Repository, nil
200+
return naming.ToValidName(o.Options.Repository), nil
201201
},
202202
},
203203
{

pkg/cmd/variables/variables_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestCmdVariables(t *testing.T) {
8888
o.GitBranch = "mybranch"
8989
o.DashboardURL = "https://dashboard-mydomain.com"
9090

91-
if name == "empty" {
91+
if name == "empty" || name == "nested" {
9292
o.Requirements = &requirements.Spec
9393
}
9494

@@ -107,6 +107,9 @@ func TestCmdVariables(t *testing.T) {
107107
)
108108
o.Options.Owner = "MyOwner"
109109
o.Options.Repository = "myrepo"
110+
if name == "nested" {
111+
o.Options.Repository = "mygroup/myrepo"
112+
}
110113
o.Options.Branch = "PR-23"
111114
o.Options.SourceURL = "https://github.com/" + o.Options.Owner + "/" + o.Options.Repository
112115
o.Options.ScmClient = scmFake

0 commit comments

Comments
 (0)