خرید بک لینک

Vote count: 0

I've the following setup:

Jenkins environment ruing docker-compose but I need to pass environment variables to the yml file:

sample docker-compose.yml

version: '2'

services:  
  logon_server:
    build: .
    image: my_server:0.0.1
    ports:
      - "9200:9200"
    command: ${DOCKER_CMD_EXEC}
    networks:
      - my_ntwrk

networks:
  my_ntwrk:

When I run the following script from a shell prompt on my mac, I can pass different commands to be executed and everything works:

exec-tests.sh

#!/bin/bash

chmod 755 docker/exec-*.sh

# Setup env variables
export DOCKER_CMD_EXEC=/ci_e2e.sh

# Optional: record current versions
docker -v && docker-compose -v

echo `whoami` 

echo `sudo -E -u admin printenv`

# Build, deploy and run E2E test cases
sudo -E -u admin docker-compose up --no-color --abort-on-container-exit

When I run the script inside of my jenkins job, under 'Build Environment' -> 'Execute Shell' -> 'Command', here is an image of what I'm talking about:

Example of shell command

I get the following error:

The DOCKER_CMD_EXEC variable is not set. Defaulting to a blank string

I've tried ruing this as root and as the default user 'admin' which is what jenkins is run as. I've tried to make the environment variables inheritable, tried printing the env's and everything looks good.

I can re-produce the error on my mac by just unsetting the DOCKER_CMD_EXEC but I cant figure out why this happening in jenkins!

Any help would be appreciated!

Thanks.

J

asked 56 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 1 ارديبهشت 1395 ساعت: 3:43

صفحه بندی