Skip to content

Commit d509459

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

6 files changed

Lines changed: 64 additions & 6 deletions

File tree

.lighthouse/jenkins-x/lint.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: PipelineRun
3+
metadata:
4+
creationTimestamp: null
5+
name: lint
6+
spec:
7+
pipelineSpec:
8+
tasks:
9+
- name: jx-gitops-lint
10+
resources: {}
11+
taskSpec:
12+
metadata: {}
13+
stepTemplate:
14+
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go/pullrequest.yaml@versionStream
15+
name: ""
16+
resources:
17+
requests:
18+
cpu: 400m
19+
memory: 600Mi
20+
workingDir: /workspace/source
21+
steps:
22+
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream
23+
name: ""
24+
resources: {}
25+
- name: make-lint
26+
resources: {}
27+
podTemplate: {}
28+
serviceAccountName: tekton-bot
29+
timeout: 30m0s
30+
status: {}

.lighthouse/jenkins-x/pullrequest.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ spec:
2626
resources: {}
2727
- name: build-make-linux
2828
resources: {}
29-
- name: make-lint
30-
resources: {}
3129
- name: build-make-test
3230
resources: {}
3331
- name: build-container-build

.lighthouse/jenkins-x/triggers.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ spec:
66
context: "pr"
77
always_run: true
88
optional: false
9-
trigger: "/test"
10-
rerun_command: "/retest"
9+
trigger: (?m)^/test( all| pr),?(s+|$)
10+
rerun_command: /test pr
1111
source: "pullrequest.yaml"
12+
- name: lint
13+
context: "lint"
14+
always_run: true
15+
optional: false
16+
trigger: (?m)^/test( all| lint),?(s+|$)
17+
rerun_command: /test lint
18+
source: "lint.yaml"
1219
postsubmits:
1320
- name: release
1421
context: "release"
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)