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 786 forks source link

`jx create quickstart` fails with invalid source.zip #2385

Closed garethjevans closed 5 years ago

garethjevans commented 5 years ago

Summary

During a workshop we noticed that one user was unable to create a quickstart, the user couldn't download the source.zip, instead and source.zip file was created that just contained the text Not Found

Steps to reproduce the behavior

Nofars-MacBook-Pro:workspace blue$ jx create quickstart --verbose=true
Searching for repositories in Git server https://github.com owner jenkins-x-quickstarts includes *excludes WIP-* as user nofarb
? select the quickstart you wish to create golang-http
? Project name yada
Downloading Quickstart source zip from https://github.com/jenkins-x-quickstarts/golang-http/archive/master.zip with basic auth for user: nofarb
error: failed to unzip new project file /Users/blue/workspace/source.zip due to zip: not a valid zip file
Nofars-MacBook-Pro:workspace blue$

jx create quickstart --verbose=true

Jx version

The output of jx version is:

1.3.612

Kubernetes cluster

What kind of Kubernetes cluster are you using & how did you create it?

Shared cluster using prow

Operating system / Environment

Mac

rawlingsj commented 5 years ago

/priority important-longterm

rawlingsj commented 5 years ago

Would love to know if there are more cases of this, if so.. were there any environment specific factors that could help narrow down why this happend?

aweis89 commented 5 years ago

Experiencing the same issue here on my Mac. Initially it was with version 1.3.371 but now I'm also experiencing it after upgrading to 1.3.640 (as well as 1.3.559). Would love to know if there's a workaround for this. Let me know if there's any other info I could provide that may be helpful

aweis89 commented 5 years ago

I noticed the issue is with download prior to to the unzip: cat ./source.zip => Not Found% Also using jx create quickstart --verbose=true shows the following output: Downloading Quickstart source zip from https://github.com/jenkins-x-quickstarts/android-quickstart/archive/master.zip with basic auth for user: aweis89 But when I curl that url I get a redirect url. Is it possible that the jx cli is not following the redirect?

garethjevans commented 5 years ago

Possibly, could you try running curl -vvv https://github.com/jenkins-x-quickstarts/android-quickstart/archive/master.zip -o master.zip to see what happens?

aweis89 commented 5 years ago

Sure @garethjevans, I get a redirect response (outputed to the master.zip file): <html><body>You are being <a href="https://codeload.github.com/jenkins-x-quickstarts/android-quickstart/zip/master">redirected</a>.</body></html> Notably when I curl that redirect url, I get a valid zip with the repo content (which is why I was thinking there's an issue with jx following redirects).

And in case you wanted the full std output of the curl command:

*   Trying 192.30.255.113...
* TCP_NODELAY set
* Connected to github.com (192.30.255.113) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [216 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [108 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3085 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: businessCategory=Private Organization; jurisdictionCountryName=US; jurisdictionStateOrProvinceName=Delaware; serialNumber=5157550; C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=github.com
*  start date: May  8 00:00:00 2018 GMT
*  expire date: Jun  3 12:00:00 2020 GMT
*  subjectAltName: host "github.com" matched cert's "github.com"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
*  SSL certificate verify ok.
> GET /jenkins-x-quickstarts/android-quickstart/archive/master.zip HTTP/1.1
> Host: github.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Mon, 10 Dec 2018 16:28:23 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Server: GitHub.com
< Status: 302 Found
< Cache-Control: no-cache,
< Vary: X-PJAX
< Location: https://codeload.github.com/jenkins-x-quickstarts/android-quickstart/zip/master
< Set-Cookie: has_recent_activity=1; path=/; expires=Mon, 10 Dec 2018 17:28:23 -0000
< Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Fri, 10 Dec 2038 16:28:23 -0000; secure; HttpOnly
< Set-Cookie: _gh_sess=REFhVHN0d000VGVKYlZGTW9SSTlmLzNGcE41anRIa3VtcFBHZkNlWFZWTzFPWDZnOGdyYkU1bVl0WEIzamR4T2hJeTV3Q1RSMitnZzgvamZiZjNPTjBaUnFqYkJDSEluSkwrbTFwTGhUay9DZXZoY2pRczNOOFpHZk12Rkg4RUp6QWVLcWJvbG96T1R6OWYxYU5IOWtXSktsdmJyanVDdDlUdGJOV3V6bml3Z0JrajcwNFdub1FHak9iK1Q4MkVGMUszdHMrZUJYVmNFZXpQd3Yzd1ZYUGswTzFOSTJ4Y1R3Q042T25kZFJPRT0tLTUwbHQ5UzFKR0FBQVBaRkFjZXJmSUE9PQ%3D%3D--d81df2d265ddc8cb60151e97b01720e0fdbd9abc; path=/; secure; HttpOnly
< X-Request-Id: 995cb0f8-db81-4c3e-9b72-2b13ed1d57a1
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Frame-Options: deny
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Expect-CT: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
< Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com status.github.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src assets-cdn.github.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.github.com
< Vary: Accept-Encoding
< X-GitHub-Request-Id: 89A3:0B25:16D8774:22AF3CA:5C0E9426
<
{ [156 bytes data]
* Connection #0 to host github.com left intact
ishantanu commented 5 years ago

Facing this issue while trying quickstarts.

error: Failed to unzip new project file /Users/xyz/xyz/a.zip due to zip: not a valid zip file

Any idea what might be wrong?