Comments (5)
This is not specific to shellcheck but to any docker image - just in case you want to suggest using https://github.com/buildkite-plugins/shellcheck-buildkite-plugin for this particular problem: it also can't redirect the output and shellcheck doesn't have a first-class --out my.file
flag either.
from docker-buildkite-plugin.
I reckon this is probably outside the scope of what the docker plugin is supposed to do 🤔
I'd be happy to add support to the shellcheck plugin to write to a file? Alternately, perhaps it's easier to just call docker directly in a shellscript for this usecase?
from docker-buildkite-plugin.
I can definitely write a wrapper or something, but I think output redirection would be a responsibility of the plugin?
from docker-buildkite-plugin.
From what I can see, this would be expected (albeit quite annoying) behaviour.
The command docker run ... image arg1 arg2 arg3 > output_file
would redirect the output of the docker
command, not what is run inside of the container itself. As you are clearly specifying that the redirection character is part of the docker command, it needs to be escaped or it wouldn't be passed on to the command running in the container... which will error out or ignore it. This is mostly because output redirection is a feature of terminal shells, not docker nor the programs run in them.
The way to workaround this issue is to use a shell as the command being executed. For example:
- label: ':bash: Lint: SH'
command: ''
artifact_paths:
- web/target/shellcheck-*.xml
plugins:
- 'docker#v3.3.0':
image: 'koalaman/shellcheck:v0.7.0'
command:
- '/bin/sh'
- '-c'
- 'shellcheck -x a.sh --format checkstyle > web/target/shellcheck-42820572-83ee-4588-abf2-4f761754dba9.xml'
Which is exactly what happens when you specify the command to be run through the step's command
instead of the plugin's command
option:
- label: ':bash: Lint: SH'
command: 'shellcheck -x a.sh --format checkstyle > web/target/shellcheck-42820572-83ee-4588-abf2-4f761754dba9.xml'
artifact_paths:
- web/target/shellcheck-*.xml
plugins:
- 'docker#v3.3.0':
image: 'koalaman/shellcheck:v0.7.0'
Note that this assumes that the image you are using is not forcing a particular executable through entrypoints (in which case you may have to override it)
from docker-buildkite-plugin.
I believe there is nothing wrong with the plugin so I am closing this issue. Feel free to reply if you think it shouldn't have and we'll re-open it and continue the discussion
from docker-buildkite-plugin.
Related Issues (20)
- input from block steps not passed in env HOT 1
- Can't interpolate ENV vars in mount path HOT 3
- Docker on Docker support HOT 1
- Exit codes > 1 are not correctly propagated HOT 2
- Dependency Dashboard
- GPU parameters not passing in Docker Run {--gpus 1} HOT 3
- Allow setting config globally, instead of per step HOT 1
- Limitation with an array of commands at the step level
- Handling of parameters when shell is false HOT 4
- Changing the Docker Version from 20.10.9 to 20.10.22 HOT 1
- `.ssh/known_hosts` mounted in wrong location when both `mount-ssh-agent` and `user` are used HOT 3
- Documentation: expand-volume-vars expansion time HOT 2
- error pulling amazonlinux:latest HOT 6
- How to pass environment variable to command? HOT 2
- Support for other docker commands than docker run HOT 2
- Windows: docker: Error response from daemon: invalid volume specification HOT 1
- add `expand-workdir-vars` option HOT 2
- Next major version should support the 99% case HOT 1
- `mount-buildkite-agent` should mount `BUILDKITE_AGENT_JOB_API_SOCKET`
- Plugin doesn't correctly bubble up Docker Hub Rate Limiting Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-buildkite-plugin.