Unable to reference action outputs with bonsai
# 🌱|help-and-getting-started
i
In this example I can't access action outputs https://github.com/pepov/kcp-playground/blob/actionref/kcp.garden.yml#L14 Based on the docs I would expect this to work: https://docs.garden.io/v/bonsai-release/using-garden/actions#text-action-kinds
Copy code
garden deploy kcp
Garden Bonsai (0.13) is in beta. Please report any issues here:
https://github.com/garden-io/garden/issues/new?labels=0.13&template=0-13-issue-template.md&title=0.13%3A+%5BBug%5D%3A
Deploy 🚀

ℹ garden                    → Running in namespace default in environment default
ℹ providers                 → Getting status...
✔ providers                 → Cached (in 2.1 sec)
ℹ providers                 → Run with --force-refresh to force a refresh of provider statuses.
ℹ graph                     → Resolving actions and modules...
âś–
Error processing config for Deploy action kcp:
Invalid template string (${actions.build.kcpctl.outputs.dep…): Could not find key actions. Available keys: command, datetime, environment, git, inputs, local, parent, project, secrets, template, var and variables.

See .garden/error.log for detailed error message
c
hey @icy-furniture-17516, glad to see you trying out Bonsai! It seems your installation is a bit out of date. Try running
garden self-update edge-bonsai --force
and report back! You'll also need to add
apiVersion: garden.io/v1
to your project config. Note: that deployment you have doesn't look quite right,
build
should just be a single string and some fields should be under the
spec
. See the new action reference here: https://github.com/garden-io/garden/blob/0.13/docs/reference/action-types/Deploy/kubernetes.md
i
Love your respoinse time! Running from 0.13.0-0 gives me this, I guess I should run it from a stable version:
Copy code
garden self-update edge-bonsai --force
Garden Bonsai (0.13) is in beta. Please report any issues here:
https://github.com/garden-io/garden/issues/new?labels=0.13&template=0-13-issue-template.md&title=0.13%3A+%5BBug%5D%3A
Update Garden 🗞️

Checking for target and latest versions...
âś– Unable to detect the latest Garden version greater or equal than 0.13.0 for the scope: patch
c
ah that looks like a bug ):
I think you'll need to reinstall to get rid of it, thanks for bringing it to our attention
i
Copy code
curl -L https://download.garden.io/core/edge-bonsai/garden-edge-bonsai-macos-amd64.tar.gz -o garden-edge-bonsai-macos-amd64.tar.gz
tar -xzf garden-edge-bonsai-macos-amd64.tar.gz
./macos-amd64/garden version
0.12.51
is this correct?
c
yep, ignore the
0.12.51
version, that's just been left hardcoded since we made the branch. Will be a proper 0.13 on Tuesday once we release it
i
okey, it asked for the apiVersion, I added it, but the issue is still the same, although with a slightly extended error message:
Copy code
~/Downloads/macos-amd64/garden deploy kcp
Deploy 🚀

âš  Garden v0.13 (Bonsai) is a major release with significant changes. Please help us improve it by reporting any issues/bugs here:
https://go.garden.io/report-bonsai
→ Run garden util hide-warning 0.13-bonsai to disable this warning.
ℹ garden               → Running in Garden environment default.default
ℹ providers            → Getting status...
✔ providers            → Cached (in 1.9 sec)
ℹ providers            → Run with --force-refresh to force a refresh of provider statuses.
ℹ graph                → Resolving actions and modules...
âś–
Error processing config for Deploy action kcp:
Invalid template string (${actions.build.kcpctl.outputs.dep…): Could not find key actions. Available keys: command, datetime, environment, git, inputs, local, parent, project, secrets, template, var and variables.

Error:
Error processing config for Deploy action kcp:
Invalid template string (${actions.build.kcpctl.outputs.dep…): Could not find key actions. Available keys: command, datetime, environment, git, inputs, local, parent, project, secrets, template, var and variables.
    at /snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/graph/actions.ts:162:13
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Copy code
Error Details:

config:
  kind: Deploy
  description: kcp.io deployment
  name: kcp
  type: kubernetes
  files:
    - manifests/kcp.yaml
  include:
    - manifests/kcp.yaml
  serviceResource:
    kind: Deployment
    name: kcp
    containerName: kcp
  variables:
    image: ${actions.build.kcpctl.outputs.deployment-image-id}
    version: ${actions.build.kcpctl.version}
  build:
    dependencies:
      - kcpctl
  internal:
    basePath: /Users/peterwilcsinszky/src/github.com/pepov/kcp-playground
    configFilePath: /Users/peterwilcsinszky/src/github.com/pepov/kcp-playground/kcp.garden.yml
I can create an issue using the bonsai issue template
c
gimme a sec, this should work. I'll debug a bit and get back to ya
i
thanks!
maybe the whole deploy action is wrong
c
okay I figured it out, the actions template context is only available in the
spec
field as of right now. The deploy is wrong but due to how garden works it first tries to resolve template strings and only then validate the configs so it isn't complaining right now. You can fix this by moving the templates directly into the spec block much like in our example.
i
but the variables are outside of spec
I would like to pass those vars to my manifests
c
You can use the string templates directly in the manifests
i
ah, okay will give it a try
works just fine, thanks for the help!
and sorry to bug you in the weekend!
c
nah no problem, glad I could be of help! I was not aware that the action template context is that narrow and we'll look into the possibility of spreading it to the action level itself so the variables block you had would work.
6 Views