Repository navigation
Closed
Description
What is the issue?
I have a dagger module returns following struct
// Info represents a repository information.
type Info struct {
Owner string // Owner of the repository.
Name string // Name of the repository.
NameWithOwner string // NameWithOwner combined version of owner and name. Format: owner/name.
URL string // URL of the repository.
Ref string // Ref is the branch or tag ref that triggered the workflow
RefName string // RefName is the short name (without refs/heads/ prefix) of the branch or tag ref that triggered the workflow.
RefType string // RefType is the type of ref that triggered the workflow. Possible values are branch, tag, or empty, if neither
SHA string // SHA is the commit SHA that triggered the workflow. The value of this commit SHA depends on the event that
ShortSHA string // ShortSHA is the short commit SHA that triggered the workflow. The value of this commit SHA depends on the event that
IsRemote bool // IsRemote is true if the ref is a remote ref.
Source *Directory // Source is the directory containing the repository source.
}When I call the Source field from the struct I get a nil error
dir := dag.Repo().
Info(opts).
Source().
Directory(workflowsDir.GetOr(".github/workflows"))However, if I move Directory access to module functions, it works.
Workaround:
Caller:
dir := dag.Repo().Info(opts).WorkflowsDir(RepoInfoWorkflowsDirOpts{WorkflowsDir: workflowsDir.GetOr("")})Module:
func (ri *Info) WorkflowsDir(
// Path to the workflows' directory. (default: .github/workflows)
workflowsDir Optional[string],
) *Directory {
return ri.Source.Directory(workflowsDir.GetOr(".github/workflows"))
}Log output
dagger call workflows list --repo aweris/gale --branch main --workflows-dir examples/workflows
✘ dagger call workflows list ERROR [2.68s]
┃ Error: response from query: input:1: gale.workflows.list failed to call f
┃ unction "GaleWorkflows.list": failed to get function output directory: pr
┃ ocess "/runtime" did not complete successfully: exit code: 2
✘ list(workflowsDir: "ci/workflows", branch: "main", repo: "aweris/gale") ERROR [2.52s]
✘ exec /runtime ERROR [2.51s]
┃ input:1: repo.info.source expected string DirectoryID, got <nil>
• Cloud URL: https://dagger.cloud/runs/8f35a085-d01c-4cd7-bf52-7af26c9f1eac
• Engine: ffa533d4bb0d (version v0.9.3)
⧗ 5.05s ✔ 67 ∅ 21 ✘ 3workaround:
dagger call workflows list --repo aweris/gale --branch main --workflows-dir examples/workflows
✔ dagger call workflows list [4.56s]
┃ Workflow: examples/workflows/artifact-cache.yaml
┃ Jobs:
┃ - test
┃
┃ Workflow: matrices (path: examples/workflows/job-matrices.yaml)
┃ Jobs:
┃ - matrix
┃
┃ Workflow: outputs (path: examples/workflows/job-outputs.yaml)
┃ Jobs:
┃ - gen-outputs
┃ - use-outputs
┃
┃ Workflow: examples/workflows/lint.yaml
┃ Jobs:
┃ - golangci-lint
┃
┃ Workflow: examples/workflows/secret-printer.yaml
┃ Jobs:
┃ - test
┃
┃ Workflow: docker (path: examples/workflows/step-docker.yaml)
┃ Jobs:
┃ - test
┃
┃ Workflow: shell (path: examples/workflows/step-run.yaml)
┃ Jobs:
┃ - run
┃ - run-pwsh
┃
┃ Workflow: step (path: examples/workflows/step.yaml)
┃ Jobs:
┃ - action
┃ - run
┃ - docker
• Cloud URL: https://dagger.cloud/runs/17496087-901a-45f3-970c-3375f86de59a
• Engine: ce7dba41ceab (version v0.9.3)
⧗ 10.55s ✔ 330 ∅ 11
Steps to reproduce
Execute following command:
dagger call -m github.com/aweris/gale/daggerverse/gale@99fb1a64f5db25e75a6c91de2e220a70494a5d49 workflows list --repo aweris/gale --branch main --workflows-dir examples/workflowsSDK version
Go SDK v0.9.3
OS version
macOS 14.0
Metadata
Metadata
Assignees
Labels
No labels
Activity
jedevc commentedon Nov 14, 2023
@aweris I think I might have accidentally fixed this as part of #6057 - at least, I can't repro on the branch.
Specifically
expected string DirectoryID, got <nil>looks to me like maybe something related to a missingjsontag in the structs, or maybe it's related to nesting the IDable type? Regardless, it looks like it's fixed there.