-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub Action + Docker tag suffix #16
GitHub Action + Docker tag suffix #16
Conversation
The composite action didn't work as expected (the action's `action.sh` and `build.sh` weren't accessible), so I replaced the shell script with a tiny JavaScript bootstrap, that will properly collect the action inputs and generate a simple local build.sh and calls it. Note that we couldn't use a Docker container action, because we couldn't access the host docker ending, and would need to add both docker cli and docker server to the docker container...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been quite a while, but I've just got to review this one.
Generating the script (and running it) looks scary, but I think we're good.
I'm updating some stuff regarding the now-removed latest
flag - we're good to merge after that 👍
// generate a local build.sh script: | ||
fs.writeFileSync("build.sh", `#! bash | ||
source ${__dirname}/build.sh | ||
dockerSetup ${setupOpts.join(" ")} | ||
echo $VERSION > VERSION | ||
dockerBuildAndPush ${buildOpts.join(" ")} | ||
`) | ||
|
||
// execute it: | ||
const build = spawn("bash", ["build.sh"], { maxBuffer: 100 * 1024 * 1024 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woa. Wasn't expecting that.
Don't we need more escaping here? We can discover that along the way, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that:
- someone can sneak something like
$SOME_SECRET
intobuild.sh
which might be a security issue (but might be legit); - we should quote the params (probably not possible for
build-options
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's mostly fear (with no concrete issue spotted) of generating a bash script and executing it.
I'm wondering if the __dirname
could be abused to source
another script, or somthing like that.
But maybe not think that much about an attacker (it should be trusted people the ones that could configure the Action), but about accidental issues with corner values (a directory name with a whitespace?).
But, once again: it's mostly unfounded fear. I'd say we merge 👍
The old one was depracted due to its base NodeJS version
Rebased from the new
main
branch and updated with tests for the new-t
and-o
build options.-t 'suffix'
allows to set an optional suffix to the docker image tag (but not tolatest
). For example-t '-next'
will create & push atag-next
image instead oftag
.-o 'options'
will pass custom options to thedocker build
command. For example-o "--build-args gemfile=Gemfile.next"
.Both arguments are require to build alternate images when we dual boot a Ruby on Rails application for example: we can build a regular image
build.sh
as well as an alternate image using updated dependencies withbuild.sh -t '-next' -o '--build-arg gemfile=Gemfile.next'
and then deploy the version we want.Also provides a GitHub action, that will install
ci-docker-builder
and build the docker image with the options we want right from a GHA workflow. For example:Supersedes #13