#Dagger setup/init lifecycle hook

1 messages · Page 1 of 1 (latest)

quiet stag
#

Hello Folks 🙂
I have unique usecase where i would like to do some initial setup configuration for dagger before running dagger cli. This could be a setup logic to decide which server will be used for _EXPERIMENTAL_DAGGER_RUNNER_HOST and to set _EXPERIMENTAL_DAGGER_CLI_BIN and after setup is done dagger cli should create create session. I can do that setup outside dagger process, may be writting a shell script or in go code and executing that process before dagger cli cmd.
I was wondering if this is something already supported in some way or best way to do such thing or may be a good feature to have it in dagger?
Let me know your thoughts 🙂

rapid timber
#

You just need to export the env variable, I'm not sure there's a specific setup to do.

Do you have a specific use case in mind?

quiet stag
#

my use case is to do some intial setup before dagger create a session and I actually want it to be part of lifecycle. For eg: dagger run go run main.go --start-hook=go run init.go
Doing so few advatanges i see

  1. i do not need to maintain orchestration my self, it will done by dagger
  2. starup executor can set env. vars and pass to main cmd within same process or any other pre exection step

I have logic that find out which server will be picked for incmoing user request, this is as sort of consitent hash ring like algorithm, once i get server url, i then set it as env. var _EXPERIMENTAL_DAGGER_RUNNER_HOST