buildkite-plugins/docker-buildkite-plugin

support -p to allow exposing ports

joscha opened this issue · 3 comments

I tried using the shell option , but unfortunately the constructed command is still invalid:

[...] --label com.buildkite.job-id=c691aa38-56e7-4abb-8acc-8546b863420d my/image0 -p 80:8080 /bin/sh -e -c my/script.sh

it needs to be:

[...] --label com.buildkite.job-id=c691aa38-56e7-4abb-8acc-8546b863420d -p 80:8080 my/image0 /bin/sh -e -c my/script.sh

interestingly it looks like

# Handle shell being provided as a string or list
elif plugin_read_list_into_result BUILDKITE_PLUGIN_DOCKER_SHELL ; then
shell_disabled=''
for arg in "${result[@]}" ; do
shell+=("$arg")
done
fi
# Add the job id as meta-data for reference in pre-exit
args+=("--label" "com.buildkite.job-id=${BUILDKITE_JOB_ID}")
# Add the image in before the shell and command
args+=("${BUILDKITE_PLUGIN_DOCKER_IMAGE}")
should allow this if I do:

      - 'docker#v3.3.0':
          image: 'my/image'
          debug: false
          shell:
            - '-p'
            - '80:8080'
            - /bin/sh
            - '-e'
            - '-c'
          workdir: /workdir

ah no, the shell args are added later on to the args array:

args+=("$shell_arg")
- how about a raw_args option for the plugin?

lox commented

Am I right in understanding you basically want a ports property supported?