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 d509459
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 6 deletions.
30 changes: 30 additions & 0 deletions .lighthouse/jenkins-x/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
creationTimestamp: null
name: lint
spec:
pipelineSpec:
tasks:
- name: jx-gitops-lint
resources: {}
taskSpec:
metadata: {}
stepTemplate:
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go/pullrequest.yaml@versionStream
name: ""
resources:
requests:
cpu: 400m
memory: 600Mi
workingDir: /workspace/source
steps:
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream
name: ""
resources: {}
- name: make-lint
resources: {}
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 30m0s
status: {}
2 changes: 0 additions & 2 deletions .lighthouse/jenkins-x/pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ spec:
resources: {}
- name: build-make-linux
resources: {}
- name: make-lint
resources: {}
- name: build-make-test
resources: {}
- name: build-container-build
Expand Down
11 changes: 9 additions & 2 deletions .lighthouse/jenkins-x/triggers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ spec:
context: "pr"
always_run: true
optional: false
trigger: "/test"
rerun_command: "/retest"
trigger: (?m)^/test( all| pr),?(s+|$)
rerun_command: /test pr
source: "pullrequest.yaml"
- name: lint
context: "lint"
always_run: true
optional: false
trigger: (?m)^/test( all| lint),?(s+|$)
rerun_command: /test lint
source: "lint.yaml"
postsubmits:
- name: release
context: "release"
Expand Down
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 d509459

Please sign in to comment.