`coder_agent` METADATA not working in Coder API
When using coder agent metadata, the behaviour is correct in the UI (the value is displayed based on the script definition), but when calling
curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacename}
. The instance that has the agent assigned has a json parameter agents
, but there is no corresponding metadata to the one defined in the coder agent. How to access coder agent metadata?12 Replies
<#1310568772058480661>
Category
Bug report
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
for the context - my template creates openstack resources, runs code using
coder_script
and then i need to extract some value that is result of this coder_script
and then share it as metadatacoder_agent
metadata
blocks are streamed on api/v2/workspaceagents/{id}/watch-metadata
though judging by the // @x-apidocgen {"skip": true}
in the code, that looks like an undocumented route :(would it be possible to add these blocks to the workspace info as well?
The latest instance of the metadata is stored in the DB, so it could be easy to just add it to
codersdk.WorkspaceAgent
🤔
which is the agents
parameter you mentionedthat would help a lot
It'd definitely be worth making a brief issue for it on
coder/coder
do you mean i should write it?
Yeah, I can write it if need be, but I thought it'd be good for you to mention your use-case along with the request
GitHub
feat: Add coder_agent metadata to codersdk.WorkspaceAgent · Issue #...
Context My template creates (openstack)resources, runs code using coder_script and then i need to extract some value that is result of this coder_script and then share it as metadata. I tried using...
@zounce is there any path that returns metadata but not via stream? and what's the chance of my issue being implemented in near future?
Unfortunately not. I recall at the time going through the code and seeing we have a DB query for fetching the agent metadata, but the only place it’s used is in that stream