Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

ruby example fails during build (waypoint up) Installing node-v12.16.2-linux-x64 #69

Closed
sven-agnew opened this issue Jun 10, 2021 · 4 comments

Comments

@sven-agnew
Copy link

macOS Catalina 10.15.7

waypoint --version
CLI: v0.4.0 (3b3dd831)
Server: v0.4.0

waypoint-examples commit 55b8678

Issue is with example docker/ruby

waypoint.hcl for the example is as follows:

project = "example-ruby"

app "example-ruby" {
  labels = {
    "service" = "example-ruby",
    "env"     = "dev"
  }

  build {
    use "pack" {}
  }

  deploy {
    use "docker" {
      static_environment = {
        GEM_PATH = "/layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0"
        PATH     = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:bin:/layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/bin"
      }
    }
  }
}

Describe the bug
The waypoint up command produces an error, and the example fails to progress beyond this point.

The error backtrace is as follows:

 | [builder] -----> Installing node-v12.16.2-linux-x64
 │ [builder]        Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-del
 │ ay 1 --connect-timeout 3 --max-time 30 https://s3.amazonaws.com/heroku-nodebin/n
 │ ode/release/linux-x64/node-v12.16.2-linux-x64.tar.gz -s -o - | tar zxf - node-v1
 │ 2.16.2-linux-x64/bin/node' failed on attempt 1 of 3.
 │ [builder]        Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-del
 │ ay 1 --connect-timeout 3 --max-time 30 https://s3.amazonaws.com/heroku-nodebin/n
 │ ode/release/linux-x64/node-v12.16.2-linux-x64.tar.gz -s -o - | tar zxf - node-v1
 │ 2.16.2-linux-x64/bin/node' failed on attempt 2 of 3.
 │ [builder]
 │ [builder]  !
 │ [builder]  !     Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-del
 │ ay 1 --connect-timeout 3 --max-time 30 https://s3.amazonaws.com/heroku-nodebin/n
 │ ode/release/linux-x64/node-v12.16.2-linux-x64.tar.gz -s -o - | tar zxf - node-v1
 │ 2.16.2-linux-x64/bin/node' failed unexpectedly:
 │ [builder]  !
 │ [builder]  !     gzip: stdin: invalid compressed data--format violated
 │ [builder]  !     tar: Unexpected EOF in archive
 │ [builder]  !     tar: Unexpected EOF in archive
 │ [builder]  !     tar: Error is not recoverable: exiting now
 │ [builder]  !
 │ [builder] /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/shell_helpers.rb:9
 │ 6:in block in run!': Command: 'set -o pipefail; curl -L --fail --retry 5 --retry
 │ -delay 1 --connect-timeout 3 --max-time 30 https://s3.amazonaws.com/heroku-nodeb
 │ in/node/release/linux-x64/node-v12.16.2-linux-x64.tar.gz -s -o - | tar zxf - nod
 │ e-v12.16.2-linux-x64/bin/node' failed unexpectedly: (LanguagePack::Fetcher::Fetc
 │ hError)
 │ [builder]
 │ [builder] gzip: stdin: invalid compressed data--format violated
 │ [builder] tar: Unexpected EOF in archive
 │ [builder] tar: Unexpected EOF in archive
 │ [builder] tar: Error is not recoverable: exiting now
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/shell_h
 │ elpers.rb:90:in times'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/shell_h
 │ elpers.rb:90:in run!'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/fetcher
 │ .rb:31:in fetch_untar'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/helpers
 │ /node_installer.rb:24:in block (2 levels) in install'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/helpers
 │ /node_installer.rb:23:in chdir'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/helpers
 │ /node_installer.rb:23:in block in install'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/vendor/ruby/heroku-18/lib
 │ /ruby/2.6.0/tmpdir.rb:93:in mktmpdir'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/helpers
 │ /node_installer.rb:20:in install'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :766:in block in install_binary'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :764:in chdir'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :764:in install_binary'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :752:in block (2 levels) in install_binaries'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :752:in each'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :752:in block in install_binaries'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:18:in block (2 levels) in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:40:in yield_with_block_depth'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:17:in block in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/vendor/ruby/heroku-18/lib
 │ /ruby/2.6.0/benchmark.rb:308:in realtime'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:16:in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb
 │ :50:in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb
 │ :46:in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :751:in install_binaries'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :170:in block in build'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :1127:in allow_git'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/ruby.rb
 │ :151:in build'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/rails2.
 │ rb:69:in build'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/bin/support/ruby_build:26
 │ :in block (2 levels) in <main>'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/base.rb
 │ :190:in log'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/bin/support/ruby_build:25
 │ :in block in <main>'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:35:in block in trace'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:18:in block (2 levels) in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:40:in yield_with_block_depth'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:17:in block in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/vendor/ruby/heroku-18/lib
 │ /ruby/2.6.0/benchmark.rb:308:in realtime'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:16:in instrument'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/lib/language_pack/instrum
 │ ent.rb:35:in trace'
 │ [builder]       from /cnb/buildpacks/heroku_ruby/0.0.1/bin/support/ruby_build:21
 │ :in <main>'
 │ [builder] ERROR: failed to build: exit status 1
! executing lifecycle. This may be the result of using an untrusted builder:
  failed with status code: 145

Steps to Reproduce
After following the exact steps documented at https://learn.hashicorp.com/tutorials/waypoint/get-started-docker?in=waypoint/get-started-docker invoke waypoint up and wait for the build stage to fail.

Expected behavior
waypoint up completes successfully as per the documented example in the tutorial.

@krantzinator
Copy link
Contributor

I was not able to reproduce this issue, however I am on Ubuntu 20.04 so it may be something that is present on Mac/Docker. What version of Docker Desktop are you running? Does a system/volume prune help at all?

@sven-agnew
Copy link
Author

sven-agnew commented Jun 11, 2021

Hello,

Thank you for your response.

I no longer believe this is an issue with waypoint-examples specifically but rather with the archive files being downloaded during the build process - in particular the node archive.

The specific failure (for me) can be reproduced if we invoke the curl for node directly like so:

curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3.amazonaws.com/heroku-nodebin/node/release/linux-x64/node-v12.16.2-linux-x64.tar.gz -s -o node-v12.16.20-linux-x64.tar.gz

I get a gzipped file on my local filesystem which, when I attempt to decompress it, results in:

tar zxvf node-v12.16.2-linux-x64.tar.gz 
x node-v12.16.2-linux-x64/
x node-v12.16.2-linux-x64/bin/
x node-v12.16.2-linux-x64/bin/node: truncated gzip input
tar: Error exit delayed from previous errors.

It's possible the archive is not being downloaded correctly and the unzip portion of the pipe is failing - leading to the build-stage failure.

If I download the tarball using my chrome-browser I can unpack it perfectly well. Something about the download in the context of the waypoint build is resulting in a malformed archive download.

Is there a way for me to add some verbosity or debugging to that particular stage of the build ?

EDIT:

I am using Docker desktop v3.3.3 (64133).
volume pruning does not alter the behaviour.

@krantzinator
Copy link
Contributor

krantzinator commented Jun 11, 2021

You can use bash verbosity flags with any Waypoint command (e.g. waypoint build -vvv), which will give surrounding Waypoint context but I don't think it will help dive into this issue.
The pack builder uses buildpacks/pack to run the build (see here)
This may be an upstream issue there.

@briancain
Copy link
Member

Hey there @sven-agnew - for now, I recommend adding any additional context to the upstream Waypoint repo. We have an issue currently tracking this over there: hashicorp/waypoint#1826

I don't think this is an issue with the example project itself, so it would be best to move the conversation over there. Thank you!

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

No branches or pull requests

3 participants