import { argument, dag, Directory, func, object } from "@dagger.io/dagger";
export type RequiredInput = {
cleanGitRepo: Directory
}
@object()
export class First {
requiredInput: RequiredInput;
constructor(@argument({ defaultPath: "/.git" }) gitRoot: Directory) {
console.log("CBO Root constructor");
this.requiredInput = {
cleanGitRepo: dag.container()
.from("alpine:latest")
.withExec(["apk", "update"])
.withExec(["apk", "add", "git"])
.withDirectory("/mnt/.git", gitRoot)
.withWorkdir("/mnt")
.withExec(["git", "config", "--global", "--add", "safe.directory", "/mnt"])
.withExec(["git", "checkout", "-f"])
.directory("/mnt")
};
console.log("CBO Root constructor ends");
}
@func()
getCleanGitRepo(): Directory {
console.log("CBO First getCleanGitRepo");
return this.requiredInput.cleanGitRepo;
}
}
This code fails when I execute dag call get-clean-git-repo
error is failed to convert return value: expected string, got map[string]interface {}