Is it possible to use the output from a shell command as the input for a CircleCI command?
EG, something like this:
commands:
build-package:
description: "Build package"
parameters:
version:
type: string
steps:
- run: ./build << parameters.version >>
jobs:
build:
steps:
build-package:
version: $(./version.sh)
I don’t think directly, since the config is compiled before the job runs.
The community is pretty creative though, let’s see if anyone has come up with a workaround.
If not, this would be a good feature request for https://ideas.circleci.com
Hmm… I just ran into this exact issue. Bummer to hear it’s not supported. Would storing the result in a variable and then passing that to the parameter work? Or does that run into the same issue?
@apeschel Did you ever figure out a workaround? Did you make an idea for it? I can’t find it to add my vote.
@drazisil Are the steps in commands fixed as well? I tried moving the output to be directly a part of the command but it’s still not interpreting it:
- run: gcloud app deploy --quiet -v "v$(php artisan app:version --plain)" <<# parameters.no-promote >> --no-promote <</ parameters.no-promote >>
This gets run literally as:
gcloud app deploy --quiet -v "v$(php artisan app:version --plain)"
Your best bet here is probably to populate an env var or use a workspace and pass the name of that variable or workspace path to the next command.
Thanks @ndintenfass!
Turns out my particular issue was actually a the gcloud
command not wanting periods in the version (I mean, periods in a version, how crazy is that?).
It would still be very cool to be able to pass output as a parameter!