C
Coder.com•2mo ago
Andrej

`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
Codercord
Codercord•2mo ago
<#1310568772058480661>
Category
Bug report
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Andrej
AndrejOP•2mo ago
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 metadata
zounce
zounce•2mo ago
coder_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 :(
Andrej
AndrejOP•2mo ago
would it be possible to add these blocks to the workspace info as well?
zounce
zounce•2mo ago
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 mentioned
Andrej
AndrejOP•2mo ago
that would help a lot
zounce
zounce•2mo ago
It'd definitely be worth making a brief issue for it on coder/coder
Andrej
AndrejOP•2mo ago
do you mean i should write it?
zounce
zounce•2mo ago
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
Andrej
AndrejOP•2mo ago
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...
Andrej
AndrejOP•4w ago
@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?
zounce
zounce•4w ago
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

Did you find this page helpful?