Skip to content

Fix node-exporter build to not use unwanted env variables

Balasankar 'Balu' C requested to merge fix-node-exporter-build into master

Make node-exporter build process similar to other exporters. I am assuming Brian referred a general build process while writing this and not a Go specific ones.

Why Using env = with_standard_compiler_flags(with_embedded_path) in go builds will cause errors when using ccache, like in this job

 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 | Starting build
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 | Environment:
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   CC="ccache gcc"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   CCACHE_DIR="/builds/gitlab/omnibus-gitlab/ccache"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   CFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   CPPFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   CXXFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   GOPATH="/var/cache/omnibus/src/node-exporter"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   LDFLAGS="-Wl,-rpath,/opt/gitlab/embedded/lib -L/opt/gitlab/embedded/lib"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   LD_RUN_PATH="/opt/gitlab/embedded/lib"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   OMNIBUS_INSTALL_DIR="/opt/gitlab"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   PATH="/opt/gitlab/bin:/opt/gitlab/embedded/bin:/builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 |   PKG_CONFIG_PATH="/opt/gitlab/embedded/lib/pkgconfig"
 [Builder: node-exporter] I | 2018-01-17T08:03:25+00:00 | $ go build
 [Builder: node-exporter] W | 2018-01-17T08:03:26+00:00 | [1/2] Failed to execute command. Retrying in 10 seconds...
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 | Environment:
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   CC="ccache gcc"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   CCACHE_DIR="/builds/gitlab/omnibus-gitlab/ccache"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   CFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   CPPFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   CXXFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   GOPATH="/var/cache/omnibus/src/node-exporter"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   LDFLAGS="-Wl,-rpath,/opt/gitlab/embedded/lib -L/opt/gitlab/embedded/lib"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   LD_RUN_PATH="/opt/gitlab/embedded/lib"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   OMNIBUS_INSTALL_DIR="/opt/gitlab"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   PATH="/opt/gitlab/bin:/opt/gitlab/embedded/bin:/builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 |   PKG_CONFIG_PATH="/opt/gitlab/embedded/lib/pkgconfig"
 [Builder: node-exporter] I | 2018-01-17T08:03:36+00:00 | $ go build
 [Builder: node-exporter] W | 2018-01-17T08:03:36+00:00 | [2/2] Failed to execute command. Retrying in 20 seconds...
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 | Environment:
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   CC="ccache gcc"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   CCACHE_DIR="/builds/gitlab/omnibus-gitlab/ccache"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   CFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   CPPFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   CXXFLAGS="-I/opt/gitlab/embedded/include -O2"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   GOPATH="/var/cache/omnibus/src/node-exporter"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   LDFLAGS="-Wl,-rpath,/opt/gitlab/embedded/lib -L/opt/gitlab/embedded/lib"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   LD_RUN_PATH="/opt/gitlab/embedded/lib"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   OMNIBUS_INSTALL_DIR="/opt/gitlab"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   PATH="/opt/gitlab/bin:/opt/gitlab/embedded/bin:/builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 |   PKG_CONFIG_PATH="/opt/gitlab/embedded/lib/pkgconfig"
 [Builder: node-exporter] I | 2018-01-17T08:03:56+00:00 | $ go build
 [Builder: node-exporter] I | 2018-01-17T08:03:57+00:00 | Execute: `go build': 32.2296s
 [Builder: node-exporter] I | 2018-01-17T08:03:57+00:00 | Build node-exporter: 32.2307s
The following shell command exited with status 2:

    $ CC=ccache gcc CCACHE_DIR=/builds/gitlab/omnibus-gitlab/ccache CFLAGS=-I/opt/gitlab/embedded/include -O2 CPPFLAGS=-I/opt/gitlab/embedded/include -O2 CXXFLAGS=-I/opt/gitlab/embedded/include -O2 GOPATH=/var/cache/omnibus/src/node-exporter LDFLAGS=-Wl,-rpath,/opt/gitlab/embedded/lib -L/opt/gitlab/embedded/lib LD_RUN_PATH=/opt/gitlab/embedded/lib OMNIBUS_INSTALL_DIR=/opt/gitlab PATH=/opt/gitlab/bin:/opt/gitlab/embedded/bin:/builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PKG_CONFIG_PATH=/opt/gitlab/embedded/lib/pkgconfig go build

Output:

    (nothing)

Error:

    # net
ccache: invalid option -- 'E'
Usage:
    ccache [options]
    ccache compiler [compiler options]
    compiler [compiler options]          (via symbolic link)

Options:
    -c, --cleanup         delete old files and recalculate size counters
                          (normally not needed as this is done automatically)
    -C, --clear           clear the cache completely (except configuration)
    -F, --max-files=N     set maximum number of files in cache to N (use 0 for
                          no limit)
    -M, --max-size=SIZE   set maximum size of cache to SIZE (use 0 for no
                          limit); available suffixes: k, M, G, T (decimal) and
                          Ki, Mi, Gi, Ti (binary); default suffix: G
    -o, --set-config=K=V  set configuration key K to value V
    -p, --print-config    print current configuration options
    -s, --show-stats      show statistics summary
    -z, --zero-stats      zero statistics counters

    -h, --help            print this help text
    -V, --version         print version and copyright information

See also <http://ccache.samba.org>.


/builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/util.rb:139:in `rescue in shellout!'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/util.rb:135:in `shellout!'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:821:in `shellout!'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:84:in `block in command'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:1008:in `instance_eval'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:1008:in `run'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:839:in `block (3 levels) in execute'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:861:in `with_retries'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:838:in `block (2 levels) in execute'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/instrumentation.rb:23:in `measure'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:837:in `block in execute'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:911:in `with_clean_env'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:836:in `execute'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:728:in `block (2 levels) in build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:727:in `each'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:727:in `block in build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/instrumentation.rb:23:in `measure'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/builder.rb:726:in `build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/software.rb:1210:in `execute_build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/software.rb:1088:in `build_me'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/project.rb:1085:in `block (2 levels) in build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/project.rb:1084:in `each'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/project.rb:1084:in `block in build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/licensing.rb:62:in `block in create_incrementally'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/licensing.rb:57:in `tap'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/licensing.rb:57:in `create_incrementally'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/project.rb:1083:in `build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/cli.rb:84:in `build'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/cli/base.rb:33:in `dispatch'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/lib/omnibus/cli.rb:42:in `execute!'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bundler/gems/omnibus-5ded24c3ba80/bin/omnibus:16:in `<top (required)>'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bin/omnibus:23:in `load'
  /builds/gitlab/omnibus-gitlab/gems/ruby/2.3.0/bin/omnibus:23:in `<top (required)>'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `load'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:332:in `exec'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:20:in `dispatch'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:11:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:34:in `block in <top (required)>'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:26:in `<top (required)>'
  /usr/local/bin/bundle:23:in `load'
  /usr/local/bin/bundle:23:in `<main>'
rake aborted!
Build failed
/builds/gitlab/omnibus-gitlab/lib/gitlab/tasks/build.rake:12:in `block (2 levels) in <top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => build:project
(See full trace by running task with --trace)
Edited by Balasankar 'Balu' C

Merge request reports