https://garden.io logo
#🌱|help-and-getting-started
Unable to reference action outputs with bonsai
# 🌱|help-and-getting-started
i

icy-furniture-17516

05/20/2023, 12:39 PM
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

calm-family-29323

05/20/2023, 1:43 PM
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

icy-furniture-17516

05/20/2023, 1:45 PM
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

calm-family-29323

05/20/2023, 1:45 PM
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

icy-furniture-17516

05/20/2023, 1:49 PM
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

calm-family-29323

05/20/2023, 1:53 PM
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

icy-furniture-17516

05/20/2023, 1:55 PM
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

calm-family-29323

05/20/2023, 1:58 PM
gimme a sec, this should work. I'll debug a bit and get back to ya
i

icy-furniture-17516

05/20/2023, 1:59 PM
thanks!
maybe the whole deploy action is wrong
c

calm-family-29323

05/20/2023, 2:09 PM
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

icy-furniture-17516

05/20/2023, 2:12 PM
but the variables are outside of spec
I would like to pass those vars to my manifests
c

calm-family-29323

05/20/2023, 2:14 PM
You can use the string templates directly in the manifests
i

icy-furniture-17516

05/20/2023, 2:14 PM
ah, okay will give it a try
works just fine, thanks for the help!
and sorry to bug you in the weekend!
c

calm-family-29323

05/20/2023, 2:20 PM
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