#can't use Annotated[Secret, Doc("AZURE_DEVOPS_TOKEN")] in constructor

1 messages · Page 1 of 1 (latest)

hearty mulch
#

⬢ [Docker] ❯ dagger call format --source=services/ingest --azure-devops-token=env:AZURE_DEVOPS_TOKEN

! required flag(s) "azure-devops-token" not set

ebon tulip
#

Hello @hearty mulch
Have you tried
dagger call --azure-devops-token=env:AZURE_DEVOPS_TOKEN format --source=services/ingest
?

hearty mulch
#

omg 🙂 it works, ok so constructor args should be passed before function call?

#

sorry, dagger noob here 🙂 docs are confusing

hearty mulch
#

right now I am also struggling with with_directory()... I passed --source=hello, and that hello dir has (dir1, dir2)... so the problem what I am trying to do is to mount them into 2 different places

#

dir1 should be at /src

#

dir2 should be at /src2

#

source.with_new_directory ?

#

or I need to use exclude / include?

#

I understand that I should probably take 2 dirs as args (--dir1, --dir2)

#

but I want to unify the pipeline

#
        path.```
#

¯_(ツ)_/¯

#

so confusing

#

@ebon tulip if you have a second 🙂 would appreciate it

#

just loosing my mind here

#

testing with terminal --cmd=bash each variation

ebon tulip
#

Can you show the module you are writing, so that I can get a better understanding?

hearty mulch
#
    def build_datasets(self, source: Directory) -> Container:
        base = self._build_base()
        base = self._with_poetry(base, poetry_home="/root/.poetry")
            
        # add models
        base = base.with_directory(
            "/models", self.models, exclude=["**/.venv", "**/tests"]
        )

        return base.with_workdir("/workdir") \
                    .with_directory(".", source.with_new_directory("dagster/**"))```
#

I give source directory, that has 2 folders "dagster" and "dbt"

#

dagster should be linked to /workdir

#

dbt should be linked to /dbt

#

.with_directory(".", source.with_new_directory("dagster/**"))

#

that's what I had in my dockerfile COPY datasets/dagster . COPY datasets/dbt /dbt

#

I run dagger call build_datasets --source datasets

#

so i should play with include / exclude?

ebon tulip
#

Not really used to python SDK, but this should do the trick

@function
    def build_datasets(self, source: Directory) -> Container:
        base = self._build_base()
        base = self._with_poetry(base, poetry_home="/root/.poetry")
            
        # add models
        base = base.with_directory(
            "/models", self.models, exclude=["**/.venv", "**/tests"]
        )

        return base.with_directory("/workdir", source.directory("/dagster")) \
                   .with_directory(".", source.directory("/dbt")) \
                   .with_workdir("/workdir")

Sorry for the delay 🙂

hearty mulch
#

omg! I have no idea how I miss that .directory()...

#

thanks @ebon tulip

#

why then have that .with_directory?

ebon tulip
hearty mulch
#

that description is very confusing

#

with_directory still works with directory context, right?

#

or it means I can get "more" from host?

#

I will play around with it

#

yesterday for example, I was trying to get --source (directory) .. path 🙂

#

¯_(ツ)_/¯