#Support for common libraries access dagger monorepo?

1 messages ยท Page 1 of 1 (latest)

lavish owl
#

Hey team

I am trying to understand if its possible to refer some common library(at root of monorepo project), directly from dagger modules?
libraries are not released so looking for way to directly get dependecies from dagger module somehow using relative path

lets say project structure like this

*monorepo
-dagger modules
---module 1
---refer libraries/lib1
---refer libraries/lib2
---module 2
-libraries
---lib1
---lib2
---go.mod

lavish owl
#

@modest spruce can you help me with this?

modest spruce
#

yes, you can use those libraries in your module but you won't be able to return any types defined by those libraries in your module functions

#

that's by design in Dagger

lavish owl
#

Not sure if I understood fully, do you have any hello world example of that ๐Ÿ™‚

fossil flame
#

@lavish owl return types are important in dagger functions.

please check out this section in the docs on custom types

https://docs.dagger.io/api/custom-types

You can use any type you want inside of a function, but you cannot return an arbitrary type in a public dagger function, so its just something to keep in mind.

A Dagger module can have multiple object types defined. It's important to understand that they are only accessible through chaining, starting from a function in the main object.

granite dew
#

so like in that example, lev, what happens if "Organization" is from another package? what happens if you dagger call dagger-organization?

#

(im smelling a doc improvement to be made here)

#

https://docs.dagger.io/api/return-values has a little info too,

If a function doesn't have a return type annotation, it'll be translated to the dagger.Void type in the API.

(presumably that's the case for 3rd-party-lib types)

In addition to returning basic types (string, boolean, ...), Dagger Functions can also return any of Dagger's core types, such as Directory, Container, Service, Secret, and many more.

fossil flame
#

That is a good question, I want to say this works but I have not tried this ๐Ÿ˜‚

@ancient parrot - do you have any ideas in that scenario?

modest spruce