#Expose the functions as http requests

6 messages · Page 1 of 1 (latest)

torn vault
#

Hello Dagger Team, We are tryng use the dagger to our main ci using dagger engine on kubernetes, so, I to my flows I need call the functions with a microservice write in go, How I can expose my functions of my module as Rest Http requests with json body?

marble sedge
# torn vault Hello Dagger Team, We are tryng use the dagger to our main ci using dagger engin...

@torn vault what you're trying to achieve is possible via an undocumented feature called client generators. Here's an example on how to use it.

Supose you have the following Go Code.

func main() {
   // I want to call a dagger fucntion here
}

what you can do to achieve this by using the hello module as an example is the following:

dagger install github.com/shykes/hello
dagger client install go # this actually generates the SDK code

Once you run that, you can go ahead and change your Go code as follows:

import (
    "context"
    "fmt"

    "gotest/dagger/dag" // this will be your Go project's import.
)

func main() {
    fmt.Println(dag.Hello().Hello(context.Background()))
}

^ as you can see, the client generators generated the dag.Hello function for me to call it automatically 🙏

torn vault
#

Other question, do you know if I could just return telemetry url and not wait the complete executation?

marble sedge
brittle star
#

hey guys

I'm kind of building the same thing but using the python sdk (Im fine switching to go tho)

So the tdlr is I built an agentic workflow (yes, I know, everybody doing it) usfor each stageing dagger functions (context, coding, testing, etc) but I couldn't find a way to call it other than through the dagger cli, shell

I read the docs, asked the LLMs, couldn't find a way of getting to work where dagger is sitting still and I can call the functions other than cli/shell