jx preview erroring out for wrong github url

Created on 13 Oct 2019  路  14Comments  路  Source: jenkins-x/jx

Summary

Preview deployment comment is not getting posted back to pull requests but getting a github error for a wrong post url sent by Jx

Steps to reproduce the behavior

dir('./charts/preview'){
... make preview ....
added to helm repo
....
Jx Preview --namespace=myns --app=myapp --dir=../..
}

Expected behavior

First of all , it shouldn't throw an error for posting a wrong url and secondly pull request should have the preview build comment with preview app urls.

Actual behavior

Jenkin build is successful all the way till preview deployment and the below is what you get

>
Preview application is now available at: http://myapp-url..........
DEBUG: merging pipeline secrets with local secrets
WARNING: Failed to comment on the Pull Request with owner repo 609: POST https://api.github.com/repos//609/issues/609/comments: 404 Not Found []

Jx version

The output of jx version is:

jx                 2.0.858
jenkins x platform 2.0.1441
Kubernetes cluster v1.13.10-eks-5ac0f1
kubectl            v1.13.4
helm client        Client: v2.14.1+g5270352
git                2.20.1 (Apple Git-117)
Operating System   Mac OS X 10.14.3 build 18D109

Jenkins type

  • [ ] Serverless Jenkins X Pipelines (Tekton + Prow)
  • [x] Classic Jenkins

Kubernetes cluster

Operating system / Environment

Amazon Linux

arejenkins kinbug lifecyclrotten prioritimportant-longterm

Most helpful comment

I could not find anyone run into this issue before so I left with no clue anywhere in google. So I just debugged the Jx source

The problem is with this function: ParseGitURL(text string) (*GitRepository, error)
returns pull number instead of the repo name hence the preview options having gitInfo.Name wrong repo name for preview.go

for example my PR request Url is: https://github.com/qamatic/mintleaf/pull/279 so the function is returning 279 instead of mintleaf!

Another potential problem here:
found that when you specify --dir option , there is a piece of code is not handling it right, step_create_values.go line #197 so what would it do if gitOps is false in this case?

So the work around for this issue if anyone run into this issue just add in your jx preview command: --source-url=

All 14 comments

I could not find anyone run into this issue before so I left with no clue anywhere in google. So I just debugged the Jx source

The problem is with this function: ParseGitURL(text string) (*GitRepository, error)
returns pull number instead of the repo name hence the preview options having gitInfo.Name wrong repo name for preview.go

for example my PR request Url is: https://github.com/qamatic/mintleaf/pull/279 so the function is returning 279 instead of mintleaf!

Another potential problem here:
found that when you specify --dir option , there is a piece of code is not handling it right, step_create_values.go line #197 so what would it do if gitOps is false in this case?

So the work around for this issue if anyone run into this issue just add in your jx preview command: --source-url=

@senips --source-url= hack does not work for me.

In the logs I see this:

[Pipeline] sh
+ jx preview --app cdp-web --dir ../.. --namespace cdp-web-pr-15 --source-url=
Creating a preview
WARNING: issue getting pull request mycorp-corp, 15, 15: GET https://api.github.com/repos/mycorp-corp/15/pulls/15: 404 Not Found []
WARNING: Unable to get commits: GET https://api.github.com/repos/mycorp-corp/15/pulls/15/commits: 404 Not Found []
WARNING: Unable to get statuses for PR 15
Namespace cdp-web-pr-15 created 
expose:
  Annotations:
    helm.sh/hook: post-install,post-upgrade
    helm.sh/hook-delete-policy: hook-succeeded
  config:
    domain: mycorpcdp-dev.com
    exposer: Ingress
    http: "true"
preview:
  image:
    repository: REDACTED.dkr.ecr.us-west-2.amazonaws.com/mycorp-corp/cdp-web
    tag: 0.0.0-SNAPSHOT-PR-15-15
Updating PipelineActivities mycorp-corp-cdp-web-pr-15-15 which has status Running
Preview application is now available at: http://cdp-web.cdp-web-pr-15.mycorpcdp-dev.com
WARNING: Failed to comment on the Pull Request with owner mycorp-corp repo 15: POST https://api.github.com/repos/mycorp-corp/15/issues/15/comments: 404 Not Found []
[Pipeline] sh
+ jx version -b
NAME               VERSION
jx                 2.0.912
jenkins x platform 2.0.1520
Kubernetes cluster v1.14.7-eks-e9b1d0
kubectl            v1.16.1
helm client        v2.14.3+g0e7f3b6
helm server        v2.14.3+g0e7f3b6
git                2.21.0
Operating System   "CentOS Linux release 7.7.1908 (Core)"

Hi @Stepan, I see that you specified source url but you should also provide value to it. Meaning it should have been set like --source-url=https://github.com/rmycorp-corp

So try like that and let me know

@senips should I specify URL with the repo and the org name, or just with the org name?

Full url of your actual repo like you see in browser. So yes this might have org name before repo name usually if you are setup like that. So the repo name should be at the end of the url anyway

@senips it works, thank you!

@stepanselyuk Awesome, great. Thanks for letting me know.

It worked great in here! Thank you!

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

/remove-lifecycle stale

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

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

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: Closing this issue.

In response to this:

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. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository.

Was this page helpful?
0 / 5 - 0 ratings