Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build hadolint locally on Ubuntu 20.04. #506

Open
hongyi-zhao opened this issue Dec 5, 2020 · 8 comments
Open

Failed to build hadolint locally on Ubuntu 20.04. #506

hongyi-zhao opened this issue Dec 5, 2020 · 8 comments

Comments

@hongyi-zhao
Copy link

On Ubuntu 2.04, I try to build hadolint from the latest git master source code locally as shown below:

$ sudo apt-get install haskell-platform
$ curl -x socks5://127.0.0.1:18888 -fsSL https://get.haskellstack.org/ | all_proxy=socks5h://127.0.0.1:18888 sh -s - -f
$ haskell-compiler --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
$ stack --version
Version 2.5.1, Git revision d6ab861544918185236cf826cb2028abb266d6d5 x86_64 hpack-0.33.0
$ git clone https://github.com/hadolint/hadolint.git hadolint/hadolint.git
$ cd hadolint/hadolint.git/
$ stack install
Exception while reading snapshot from https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/18.yaml:
HttpExceptionRequest Request {
  host                 = "raw.githubusercontent.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("User-Agent","Haskell pantry package")]
  path                 = "/commercialhaskell/stackage-snapshots/master/lts/16/18.yaml"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (InternalException (HostCannotConnect "raw.githubusercontent.com" [Network.Socket.connect: <socket: 13>: does not exist (Connection refused)]))

Any hints for solving this problem?

Regards,
HY

@lorenzo
Copy link
Member

lorenzo commented Dec 5, 2020

I would recommend you try again. Seem like you just got. Transient network issue

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Dec 5, 2020

Really. I confirmed your assertion based on subsequent testings. But I still can't figure out why the stack install command doesn't respect the proxy setting by environment variable as shown below:

# https://docs.haskellstack.org/en/stable/install_and_upgrade/#using-an-http-proxy
$ env http_proxy=127.0.0.1:8080 stack install
Not cryptographic hash found for Hackage package megaparsec-9.0.0, updating
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading timestamp
Downloading snapshot
Downloading mirrors
Cannot update index (no local copy)
Downloading index
                              
$ sudo tcpdump -i any port 8080 -w - | pv >/dev/null 
tcpdump: listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes
0.00 B 0:06:06 [0.00 B/s] [<=>                                                 ]

@nvtkaszpir
Copy link
Contributor

you may need to export both HTTP_PROXY and HTTPS_PROXY.
also see https://docs.haskellstack.org/en/stable/install_and_upgrade/#china-based-users

@hongyi-zhao
Copy link
Author

See below:

$ env http_proxy=127.0.0.1:8080 https_proxy=127.0.0.1:8080 stack install
Downloading lts-17.5 build plan ...
RedownloadInvalidResponse Request {
  host                 = "raw.githubusercontent.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/fpco/lts-haskell/master//lts-17.5.yaml"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 "/home/werner/.stack/build-plan/lts-17.5.yaml" (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Connection","keep-alive"),("Content-Length","14"),("Content-Security-Policy","default-src 'none'; style-src 'unsafe-inline'; sandbox"),("Strict-Transport-Security","max-age=31536000"),("X-Content-Type-Options","nosniff"),("X-Frame-Options","deny"),("X-XSS-Protection","1; mode=block"),("Content-Type","text/plain; charset=utf-8"),("X-GitHub-Request-Id","79A0:0A9C:3BCBF:7FC78:60500D9C"),("Accept-Ranges","bytes"),("Date","Tue, 16 Mar 2021 01:45:00 GMT"),("Via","1.1 varnish"),("X-Served-By","cache-hkg17928-HKG"),("X-Cache","MISS"),("X-Cache-Hits","0"),("X-Timer","S1615859100.009184,VS0,VE286"),("Vary","Authorization,Accept-Encoding"),("Access-Control-Allow-Origin","*"),("X-Fastly-Request-ID","00307b2b35729fbab31af3ed6cfe0181e98967f3"),("Expires","Tue, 16 Mar 2021 01:50:00 GMT"),("Source-Age","0")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose})

@nvtkaszpir
Copy link
Contributor

either way this is an issue with stack and not with hadolint.
Please see commercialhaskell/stack#5449

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Mar 16, 2021

Thank you for your reminder. The above issue is indeed fired by myself some time ago. But it really has nothing to do with the problem reported there. In fact, the problem here is due to the staled version of stack, and after upgrading via stack upgrade (This operation may also require a proxy.), everything works as expected. See here for more discussion.

@nvtkaszpir
Copy link
Contributor

So are you saying that

$ cd hadolint/hadolint.git/
$ stack install

should be actually replaced with

$ stack upgrade
$ cd hadolint/hadolint.git/
$ stack install

?

@hongyi-zhao
Copy link
Author

Yep. See the final compiled/installed working versions of stack and hadolint for my case:

$ stack --version
Version 2.5.1, Git revision d6ab861544918185236cf826cb2028abb266d6d5 x86_64 hpack-0.33.0
$ hadolint --version
Haskell Dockerfile Linter v1.23.0-4-g4db396c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants