Hey all, I am currently developing a dagger module to be exposed through mcp, but right now I am confused with the way dagger (or maybe my python knowledge), that somehow updating attributes doesn't work
@object_type
class Agent:
start: Annotated[dagger.Directory, DefaultPath(".")]
ctr: Annotated[dagger.Container, Doc("Spacelift container for managing Terraform operations")] = field(default=(dag.container()
.from_("alpine")))
@function
async def init(self, token : Annotated[dagger.Secret, Doc("Token")]) -> Self:
self.ctr = self.ctr.with_secret_variable("SECRET_TOKEN", token).with_directory("/work", self.start).with_workdir("/work")
return self
@function
async def check(self) -> str:
return await (self.ctr.with_exec(["env"]).stdout())
when I call init, then check, the output doesnt contains SECRET_TOKEN. It seems like the self.ctr assignment doesnt work. Did I misunderstand the behavior here? I saw this pattern multiple times especially when create a workspace module to be used in LLM.
But when I chain the command like init env://SECRET_TOKEN | check it works as expected. Did I misunderstand the way it works ?