nicholasjackson / minke

Tools for building Microservices with Docker
http://nicholasjackson.github.io/minke
MIT License
45 stars 2 forks source link

During Build Image undefined method `chomp' for nil:NilClass #53

Closed bblitzer closed 7 years ago

bblitzer commented 7 years ago

On Mac OS Sierra/Go version 1.8/Docker For Mac 17.03.0-ce-mac1 (15587)

When running ./minke build_image I get this output

Version: 1.14.2

registered minke-generator-go

INFO: ### Fetching dependencies INFO: Running command: ["/bin/sh", "-c", "glide install"] .................................. INFO: ## Build application . INFO: Running command: ["/bin/sh", "-c", "go build -a -installsuffix cgo -ldflags '-s' -o myservice"] .. INFO: ## Test application INFO: Running command: ["/bin/sh", "-c", "go test $(go list ./... | grep -v /vendor/)"] ... INFO: ## Build image Step 1/10 : FROM nicholasjackson/microservice-basebox\n ERROR: Error: undefined method `chomp' for nil:NilClass (NoMethodError)

neophiliac commented 7 years ago

I got the same error on Ubuntu 16:04/Docker 17.03.0-ce.

nicholasjackson commented 7 years ago

Sorry I thought I had fixed this, I will push an update tonight,

nicholasjackson commented 7 years ago

Seems like a classic case on my machine, the problem is in the logger when there is a nil message passed to it however it should never get a nil message. It seems like there might have been an API change in the output for docker 17.03-ce from 1.13.0 which triggers this bug however when I updated my docker version I could not replicate the same problem.

Version 1.14.4 has a fix for the underlying bug in the logger, you can upgrade your project by performing the following steps, I do have upgrades on my roadmap but not yet implemented unfortunately.

Update _minke/minke to change line 1 MINKE_VERSION="1.14.2" to MINKE_VERSION="1.14.4"

Delete _minke/Gemfile.sha to force a re-bundle of the dependencies

Would you mind giving this a test and letting me know, if this still does not work could you zip your project and send it over so I can do some further investigation please?

I have attached the project which build successfully from my machine.

Kind regards,

Nic tester.zip

bblitzer commented 7 years ago

Still seems to be stuck to version 1.14.2 as it outputs after the acsii art. I took the steps mentioned above. updated minke to version 1.14.4 and removed .sha.

nicholasjackson commented 7 years ago

Could you trash the _minke/vendor folder and the .sha again please, seems like the cached gem is still being used. I need to pin the Gem version in the gem file.

bblitzer commented 7 years ago

Same Result. Here is the output and attached the minke script file as well: | => ./minke build_image Running command: minke build_image Fetching gem metadata from https://rubygems.org/........ Fetching version metadata from https://rubygems.org/. Installing rake 10.5.0 Installing public_suffix 2.0.5 Installing builder 3.2.3 Installing colorize 0.8.1 Installing unf_ext 0.0.7.2 with native extensions Installing mime-types 2.99.3 Installing netrc 0.11.0 Installing gherkin 4.0.0 Installing cucumber-wire 0.0.1 Installing diff-lcs 1.3 Installing multi_json 1.12.1 Installing multi_test 0.1.2 Installing excon 0.55.0 Installing json 2.0.3 with native extensions Installing mini_portile2 2.1.0 Installing sshkey 1.9.0 Installing minke-generator-go 0.9.2 Using bundler 1.13.6 Installing addressable 2.5.0 Installing unf 0.1.4 Installing cucumber-core 1.5.0 Installing jsonpath 0.5.8 Installing docker-api 1.33.2 Installing nokogiri 1.7.0.1 with native extensions Installing json-schema 2.8.0 Installing domain_name 0.5.20170223 Installing cucumber 2.4.0 Installing http-cookie 1.0.3 Installing rest-client 1.8.0 Installing consul_loader 1.0.0 Installing cucumber-api 0.4 Installing minke 1.14.2 Updating files in vendor/cache Bundle complete! 5 Gemfile dependencies, 32 gems now installed. Bundled gems are installed into ./vendor.

888b d888 d8b 888 8888b d8888 Y8P 888 88888b.d88888 888 888Y88888P888 888 88888b. 888 888 .d88b. 888 Y888P 888 888 888 "88b 888 .88P d8P Y8b 888 Y8P 888 888 888 888 888888K 88888888 888 " 888 888 888 888 888 "88b Y8b. 888 888 888 888 888 888 888 "Y8888

Version: 1.14.2

registered minke-generator-go

INFO: ### Fetching dependencies INFO: Running command: ["/bin/sh", "-c", "glide install"] .................................. INFO: ## Build application . INFO: Running command: ["/bin/sh", "-c", "go build -a -installsuffix cgo -ldflags '-s' -o myservice"] .. INFO: ## Test application INFO: Running command: ["/bin/sh", "-c", "go test $(go list ./... | grep -v /vendor/)"] .. INFO: ## Build image Step 1/10 : FROM nicholasjackson/microservice-basebox\n ERROR: Error: undefined method `chomp' for nil:NilClass (NoMethodError)


| ~/playground/go/src/github.com/bblitzer/myservice/_minke

//Here is the first portion of script file

!/bin/bash

MINKE_VERSION="1.14.4"

DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock" NEW_UUID=$(base64 /dev/urandom | tr -d '/+' | head -c 32 | tr '[:upper:]' '[:lower:]') DOCKER_IMAGE="nicholasjackson/minke:${MINKE_VERSION}" COMMAND=$* GEM_VOLUMES="" SSH_AUTH=""

nicholasjackson commented 7 years ago

Thanks,

I have just cleared all my docker images and I can now replicate the problem it seems to be caused when the docker registry is timing out, I'm going to get some code in to fix this. Just out of interest if you run. docker pull nicholasjackson/microservice-basebox then try a build again does this work for you?

BTW really appreciate your help

bblitzer commented 7 years ago

Success! That does the trick

nicholasjackson commented 7 years ago

Ok cool, I have found where I need to change the code, I will push an updated version 1.15 in an hour or so. I will also add the upgrade capability to this version so you can do ./minke -v upgrade to save all the messing about.

bblitzer commented 7 years ago

Sounds good. Thanks for the help.

nicholasjackson commented 7 years ago

I have pushed a new version 1.14.5 as I am not really satisfied with this still, the error message will now be gone as I have fixed the bug which was raising an error when the docker API times out. The main problem I am struggling with is why it is timing out. Anecdotally it feels like that since I have updated to 17.03.0-ce pulling docker images seems much slower.

neophiliac commented 7 years ago

Works for me also. Thanks!