docker-compose-buildkite-plugin
docker-compose-buildkite-plugin copied to clipboard
[Need help] Command for buildkite annotate is being given as an input to docker-compose plugin
I am trying to execute the buildkite annotate command to display the artifacts created by the build as an annotation. I am also using the docker-compose plugin to execute my code through Docker. The issue is that the command is been given to the docker-compose as input and hence the build is failing with the following error:
Running /bin/sh -e -c 'buildkite-agent annotate --style “info” Read the <a href=“artifact://reports/jest-stare/index.html“> uploaded test report</a> | 2s
$ docker-compose -f docker-compose.yml -p buildkitec0a9070575a14d1dbb08c0a600932556 run --name buildkitec0a9070575a14d1dbb08c0a600932556_web-test_build_74 --rm web-test /bin/sh -e -c 'buildkite-agent annotate --style “info” Read the <a href=“artifact://reports/jest-stare/index.html“> uploaded test report</a>
Creating buildkitec0a9070575a14d1dbb08c0a600932556_web-test_run ... done
/bin/sh: 2: Syntax error: newline unexpected
⚠️ Failed to run command, exited with 2 | 0s
🚨 Error: The command exited with status 2
user command error: The plugin docker-compose command hook exited with status 2
Here are the pipeline steps that I am using:
steps:
- label: ':chrome: Testing web'
artifact_paths:
- "reports/**/*"
- "screenshots/**/*"
- "videos/**/*"
agents:
queue: <agent_name>
command: |
buildkite-agent annotate --style “info” Read the <a href=“artifact://reports/jest-stare/index.html“> uploaded test report</a>
plugins:
- 'docker-compose#v3.2.0':
run: web-test
config: docker-compose.yml
I want to run the buildkite annotate command after Docker has completed the execution.
@AkashD-Developer I was running into the same issue. So I've created a buildkite plugin to help,
https://github.com/phcyso/annotate-from-file-buildkite-plugin There is a example in the readme of using it with the docker-compose plugin.
The issue is that this plugin completely takes over the command
portion of a step. That means that whatever your use as command
(either in the step or as an option to this plugin) will be the one thing run inside of the application container and not after it. The suggestion by @phcyso is one of the ways to achieve what you want, the other would be to setup a more complicated script to be run in the step that does include the annotation.
That said, it is weird to see that error, as if there was a newline or strange character not being shown in the pipeline. If you are still experiencing the issue, let us know to further troubleshoot and track down the root cause