jenkins-x / jx

Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
https://jenkins-x.io/
Apache License 2.0
4.58k stars 788 forks source link

quickstarts with "_" in name fail due to jx converting the "_" to a "-" #3181

Closed mikecirioli closed 5 years ago

mikecirioli commented 5 years ago

Summary

If you create a quickstart and use an _ in the name, it will be subsequently converted to a - in later operations and the quickstart will fail to build. This is because the git repo is being created with the name you specified (ie. bad_build_1), but later operations want to transform it to bad-build-1)

Steps to reproduce the behavior

Create a quickstart with a name that contains _ characters (ie. bad_build_1). Accept the defaults for the rest of the quickstart prompts.

Expected behavior

My quickstart would build successfully

Actual behavior

quickstart fails to build due to being unable to pull the source from github:

>$ jx create quickstart
Using Git provider GitHub at https://github.com
? Do you wish to use jenkinsx-dev-mikec-bot as the Git user name? No
? Git user name? mikecirioli
? GitHub user name: mikecirioli
To be able to create a repository on GitHub we need an API Token
Please click this URL https://github.com/settings/tokens/new?scopes=repo,read:user,read:org,user:email,write:repo_hook,delete_repo

Then COPY the token and enter in into the form below:

? API Token: ****************************************

About to create repository  on server https://github.com with user mikecirioli
? Enter the new repository name:  bad_build_2

Creating repository jx-dev-org-mikec/bad_build_2
? select the quickstart you wish to create golang-http
Generated quickstart at /export/cloudbees/git/jx_playground/bad_build_2
### NO charts folder /export/cloudbees/git/jx_playground/bad_build_2/charts/golang-http
Created project at /export/cloudbees/git/jx_playground/bad_build_2

The directory /export/cloudbees/git/jx_playground/bad_build_2 is not yet using git
? Would you like to initialise git now? Yes
? Commit message:  Initial import

Git repository created

====  current import settings Jenkinsfile
performing pack detection in folder /export/cloudbees/git/jx_playground/bad_build_2
--> Draft detected Go (65.746753%)
selected pack: /Users/mcirioli/.jx/draft/packs/github.com/jenkins-x-buildpacks/jenkins-x-kubernetes/packs/go
replacing placeholders in directory /export/cloudbees/git/jx_playground/bad_build_2
app name: bad-build-2, git server: github.com, org: jx-dev-org-mikec, Docker registry org: jx-dev-org-mikec
skipping directory "/export/cloudbees/git/jx_playground/bad_build_2/.git"
Pushed Git repository to https://github.com/jx-dev-org-mikec/bad_build_2

Automatically adding the pipeline user: jenkinsx-dev-mikec-bot as a collaborator.
Creating GitHub webhook for jx-dev-org-mikec/bad_build_2 for url https://hook.jx.xdevnull.co/hook

Watch pipeline activity via:    jx get activity -f bad_build_2 -w
Browse the pipeline log via:    jx get build logs jx-dev-org-mikec/bad_build_2/master
Open the Jenkins console via    jx console
You can list the pipelines via: jx get pipelines
When the pipeline is complete:  jx get applications

For more help on available commands see: https://jenkins-x.io/developing/browsing/

Note that your first pipeline may take a few minutes to start while the necessary images get downloaded!

k8s:(core-dev-1|mikec-dev|jx)
[mcirioli@lagavulin] /export/cloudbees/git/jx_playground
>$ jx get build logs jx-dev-org-mikec/bad_build_2/master
Build logs for jx-dev-org-mikec/bad_build_2/master #1
getting the log for pod d7b87d76-3529-11e9-83e7-6a0003553450-pod-6580c4 and init container build-step-credential-initializer
{"level":"warn","ts":1550678945.5268788,"logger":"fallback-logger","caller":"logging/config.go:65","msg":"Fetch GitHub commit ID from kodata failed: \"ref: refs/heads/test\" is not a valid GitHub commit ID"}
{"level":"info","ts":1550678945.5272734,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized."}
getting the log for pod d7b87d76-3529-11e9-83e7-6a0003553450-pod-6580c4 and init container build-step-git-source-0
{"level":"warn","ts":1550678946.3962216,"logger":"fallback-logger","caller":"logging/config.go:65","msg":"Fetch GitHub commit ID from kodata failed: \"ref: refs/heads/test\" is not a valid GitHub commit ID"}
{"level":"info","ts":1550678947.5925417,"logger":"fallback-logger","caller":"git-init/main.go:92","msg":"Successfully cloned \"https://github.com/jx-dev-org-mikec/bad_build_2.git\" @ \"master\" in path \"/workspace\""}
getting the log for pod d7b87d76-3529-11e9-83e7-6a0003553450-pod-6580c4 and init container build-step-jenkins
Picked up _JAVA_OPTIONS: -Xmx400m
Started
Running in Durability level: PERFORMANCE_OPTIMIZED
  20.002 [id=31]    WARNING i.f.k.c.i.VersionUsageUtils#alert: The client is using resource type 'customresourcedefinitions' with unstable version 'v1beta1'
[Pipeline] node
Running on Jenkins in /tmp/jenkinsTests.tmp/jenkins6622797099540314226test/workspace/job
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
[Pipeline] }
[Pipeline] // stage
[Pipeline] withCredentials
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (CI Build and push snapshot)
Stage "CI Build and push snapshot" skipped due to when conditional
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build Release)
[Pipeline] dir
Running in /home/jenkins/go/src/github.com/jx-dev-org-mikec/bad-build-2
[Pipeline] {
[Pipeline] git
Cloning the remote Git repository
Cloning repository https://github.com/jx-dev-org-mikec/bad-build-2.git
 > git init /home/jenkins/go/src/github.com/jx-dev-org-mikec/bad-build-2 # timeout=10
Fetching upstream changes from https://github.com/jx-dev-org-mikec/bad-build-2.git
 > git --version # timeout=10
 > git fetch --tags --progress https://github.com/jx-dev-org-mikec/bad-build-2.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress https://github.com/jx-dev-org-mikec/bad-build-2.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Repository not found.
fatal: repository 'https://github.com/jx-dev-org-mikec/bad-build-2.git/' not found

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1990)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1709)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:400)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:609)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1083)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
    at hudson.security.ACL.impersonate(ACL.java:290)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Promote to Environments)
Stage "Promote to Environments" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
k8s:(core-dev-1|mikec-dev|jx)

Jx version

The output of jx version is:

NAME               VERSION
jx                 1.3.905
jenkins x platform 0.0.3402
Kubernetes cluster v1.11.6-gke.2
kubectl            v1.12.2
helm client        v2.11.0+g2e55dbe
helm server        v2.12.2+g7d2b0c7
git                git version 2.16.0
Operating System   Mac OS X 10.14.3 build 18D109

Jenkins type

Kubernetes cluster

Operating system / Environment

jenkins-x-bot commented 5 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Provide feedback via https://jenkins-x.io/community. /lifecycle stale

jenkins-x-bot commented 5 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with /close. Provide feedback via https://jenkins-x.io/community. /lifecycle rotten

jenkins-x-bot commented 5 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten. Provide feedback via https://jenkins-x.io/community. /close

jenkins-x-bot commented 5 years ago

@jenkins-x-bot: Closing this issue.

In response to [this](https://github.com/jenkins-x/jx/issues/3181#issuecomment-517975605): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. >Provide feedback via https://jenkins-x.io/community. >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.