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.57k stars 789 forks source link

`jx import` does not create `charts` directory #7258

Closed stepanselyuk closed 3 years ago

stepanselyuk commented 4 years ago

Summary

I used jx import to import a GitHub repo (with Dockerfile already in the repo). Used command:

jx import --url https://github.com/orgname/reponame --pack docker-helm

Well, I've run it a few times before I figured out the CICD user need to have admin rights on the repo. And I did not get what difference between docker-helm and docker pack - better to have some documentation regarding it.

The import process created files OWNERS, OWNERS_ALIASES, jenkins-x.yml, skaffold.yaml, but charts directory has not been added. In skaffold.yaml path contains charts mentioned:

deploy:
    helm:
      releases:
      - name: test-project-for-cicd
        chartPath: charts/test-project-for-cicd
        setValueTemplates:
          image.repository: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}'
          image.tag: '{{.DIGEST_HEX}}'

Is there a way to create the charts directory (by using some jx command)?

Steps to reproduce the behavior

Expected behavior

charts directory with default templates will be created among other files.

Actual behavior

charts directory not created.

Jx version

The output of jx version is:

NAME               VERSION
jx                 2.1.45
Kubernetes cluster v1.15.11
kubectl            v1.13.2
helm client        2.12.2
git                2.25.1
Operating System   Ubuntu 20.04 LTS

Kubernetes cluster

Ubuntu 20.04, Microk8s with enabled addons: storage, rbac, dns, ingress

Operating system / Environment

Ubuntu 20.04

stepanselyuk commented 4 years ago

Reimported using docker pack, same thing. Reimported using go pack and charts/ created.

deanesmith commented 4 years ago

Hi @stepanselyuk, Thank you for the issue report. It does appear there may be a regression. Can you supply any logs and/or verbose tracing on the command to help us better understand what the issue is.

stepanselyuk commented 4 years ago

Hi @deanesmith, ok in this example I'm importing jx-quickstart (golang flavor) project, with removed related to Jenkins files:

cat tree-before-import.txt
.
├── Dockerfile
├── Makefile
├── README.md
├── curlloop.sh
├── main.go
└── tree-before-import.txt

0 directories, 6 files

I used this command to import:

jx import --url https://github.com/myorg/jx-quickstart --pack docker --verbose

Got this output:

jx import --url https://github.com/myorg/jx-quickstart --pack docker --verbose
? Do you wish to use myorg-cicd as the Git user name: Yes
DEBUG: JX_LOG_LEVEL=error LC_ALL=C git init
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git remote add origin https://myorg-cicd:e61c76aa36c858291718dfdf8908c4fb54ab60e0@github.com/myorg/jx-quickstart.git
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git fetch origin master
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git reset --hard origin/master
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git branch --set-upstream-to origin/master master
Cloned Git repository from https://myorg-cicd:e61c76aa36c858291718dfdf8908c4fb54ab60e0@github.com/myorg/jx-quickstart.git
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git fetch origin master
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git checkout master
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git branch --set-upstream-to origin/master master
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git pull
trying to use draft pack: docker
selected pack: /root/.jx/draft/packs/github.com/jenkins-x-buildpacks/jenkins-x-kubernetes/packs/docker
replacing placeholders in directory /root/jx-quickstart
app name: jx-quickstart, git server: github.com, org: myorg, Docker registry org: myorg
skipping directory "/root/jx-quickstart/.git"
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git add *
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git status -s
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git commit -m Draft create
Draft pack docker added
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git push origin HEAD
Pushed Git repository to https://myorg-cicd:e61c76aa36c858291718dfdf8908c4fb54ab60e0@github.com/myorg/jx-quickstart.git
DEBUG: Finding service url for hook in namespace jx
DEBUG: Couldn't find service url, attempting to look up via ingress
DEBUG: found service url https://hook-jx.k8s.myorg.cloud
Creating GitHub webhook for myorg/jx-quickstart for url https://hook-jx.k8s.myorg.cloud/hook
DEBUG: have SourceRepository: myorg-jx-quickstart
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git config --get user.name
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git config --get user.email
DEBUG: ForkAndPullRepo gitURL: https://github.com/myorg/jx-environment-vanessa-dev.git dir: /tmp/create-pr030677123 baseRef: master branchName: myorg-jx-quickstart forkName:
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git init
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git commit -a -m initial commit --allow-empty
DEBUG: setting git config to: --local credential.helper /usr/local/bin/jx step git credentials --credential-helper --repo-owner myorg
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git config --local credential.helper /usr/local/bin/jx step git credentials --credential-helper --repo-owner myorg
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git remote add origin https://myorg-cicd@github.com/myorg/jx-environment-vanessa-dev.git
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git fetch origin myorg-jx-quickstart:0741cecc-cdc5-4957-bbc4-c4125cd0997d
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git fetch origin master:a567f28c-2522-4339-bd07-344ceeeeee38
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git branch
DEBUG: JX_LOG_LEVEL=error LC_ALL=C git branch myorg-jx-quickstart
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git checkout myorg-jx-quickstart
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git reset --hard a567f28c-2522-4339-bd07-344ceeeeee38
DEBUG: LC_ALL=C JX_LOG_LEVEL=error git add -A
DEBUG: JX_LOG_LEVEL=error LC_ALL=C git status -s
WARNING: No changes made to the source code in /tmp/create-pr030677123. Code must be up to date!
created pull request  on the development git repository https://github.com/myorg/jx-environment-vanessa-dev.git
regenerated Prow configuration
DEBUG: creating meta pipeline client
DEBUG: cloning version stream url: https://github.com/jenkins-x/jenkins-x-versions.git ref: v1.0.477 into /tmp/jx-version-repo-028918790
DEBUG: creating meta pipeline CRDs
DEBUG: meta pipeline env variables
DEBUG: creating pipeline steps for extending apps
DEBUG: meta pipeline env variables
PipelineActivity for myorg-jx-quickstart-master-1
upserted PipelineResource meta-myorg-jx-quickstart-m-cq6hh for the git repository https://github.com/myorg/jx-quickstart.git
upserted Task meta-myorg-jx-quickstart-m-cq6hh-meta-pipeline-1
upserted Pipeline meta-myorg-jx-quickstart-m-cq6hh-1
created PipelineRun meta-myorg-jx-quickstart-m-cq6hh-1
created PipelineStructure meta-myorg-jx-quickstart-m-cq6hh-1
DEBUG: applied tekton CRDs

Watch pipeline activity via:    jx get activity -f jx-quickstart -w
Browse the pipeline log via:    jx get build logs myorg/jx-quickstart/master
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!

Then checked the repo:

git pull
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 1), reused 6 (delta 1), pack-reused 0
Unpacking objects: 100% (6/6), 811 bytes | 405.00 KiB/s, done.
From https://github.com/myorg/jx-quickstart
   c675394..21be8e8  master     -> origin/master
Updating c675394..21be8e8
Fast-forward
 OWNERS         |  4 ++++
 OWNERS_ALIASES |  6 ++++++
 jenkins-x.yml  |  1 +
 skaffold.yaml  | 28 ++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+)
 create mode 100644 OWNERS
 create mode 100644 OWNERS_ALIASES
 create mode 100755 jenkins-x.yml
 create mode 100644 skaffold.yaml

So the tree after import:

.
├── Dockerfile
├── Makefile
├── OWNERS
├── OWNERS_ALIASES
├── README.md
├── curlloop.sh
├── jenkins-x.yml
├── main.go
├── skaffold.yaml
├── tree-after-import.txt
└── tree-before-import.txt

0 directories, 11 files
deanesmith commented 4 years ago

@stepanselyuk, if you omit the -pack flag, what behavior is demonstrated?

stepanselyuk commented 4 years ago

@deanesmith if I omit the --pack flag, the system detects Golang and use go pack, and charts directory created.

--> Draft detected Go (42.319749%)
selected pack: /root/.jx/draft/packs/github.com/jenkins-x-buildpacks/jenkins-x-kubernetes/packs/go
replacing placeholders in directory /root/jx-quickstart
app name: jx-quickstart, git server: github.com, org: myorg, Docker registry org: myorg
skipping directory "/root/jx-quickstart/.git"
stepanselyuk commented 4 years ago

It is possible somewhere near here https://sourcegraph.com/github.com/jenkins-x/jx@c4ceaafff340da8630788ca8de86c927ea1383e2/-/blob/pkg/cmd/opts/buildpacks.go#L197

deanesmith commented 4 years ago

Thanks for the follow-up @stepanselyuk. It is entirely possible those flags might have not have ever worked properly. Not sure. If you'd care to take a stab at it, your contribution would be quite valuable.

jenkins-x-bot commented 4 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 4 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 3 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 3 years ago

@jenkins-x-bot: Closing this issue.

In response to [this](https://github.com/jenkins-x/jx/issues/7258#issuecomment-719960843): >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 [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository.