node.js - Pass environment variable from Gitlab docker executor to image -
in test setup, use docker executor run builds. our projects run on 1 of official node images (ie node:6
).
by default, these official images come logging level set output quite abit.
according official documentation, can disabled https://github.com/nodejs/docker-node/blob/master/readme.md#verbosity
verbosity default node.js docker image has npm log verbosity set info instead of default warn. because of way docker isolated host operating system , not guaranteed able retrieve npm-debug.log file when npm fails. when npm fails, writes it's verbose log log file inside container. if npm fails during install when building docker image docker build command, log file become inaccessible when docker exits. docker working group have chosen overly verbose during build provide easy audit trail when install fails. if prefer npm less verbose can reset verbosity of npm using following techniques: dockerfile if create own dockerfile inherits node image can use env override npm_config_loglevel. node env npm_config_loglevel warn ... docker run if run node image using docker run can use -e flag override npm_config_loglevel. $ docker run -e npm_config_loglevel=warn node ... npm run if running npm commands can use --loglevel control verbosity of output. $ docker run node npm --loglevel=warn ...
but when reference docker image gitlab-ci.yml
file, so:
image: node:6 test: script: - npm install
how can pass environment variable, set logging level, docker executor?
as listed in gitlab-ci reference, can specify environment variables in configuration file variables
keyword. in case be
image: node:6 test: variables: npm_config_loglevel: warn script: - npm install
alternatively add --loglevel=warn
node
commands in script part of ci configuration.
wiki
Comments
Post a Comment