I've created a dagger module which I've tested locally for remote invocation scenarios. It works fine, however I've run into an unexpected problem while trying to consume it using github actions:
- name: Hello
uses: dagger/dagger-for-github@v8.2.0
with:
module: git@github.com/{org}/{repository}@refs/tags/v0.0.1
call: build --source=${{ !inputs.Directory }} --auto-apply
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
version: "v0.19.6"
The problem manifests itself during workflow execution. I'll be attaching the log in the next post.
It appears that dagger fails to authenticate with github to clone the remote repository (which is a part of my org). What is the recommended approach here?
The module code is:
import {
dag,
Changeset,
Container,
Directory,
object,
func,
argument
} from "@dagger.io/dagger"
@object()
export class CloudTekDotNet {
/**
* Executes the local build the using nuke.build dotnet tool
* @param source source directory
* @param base optional base image
* @param target NUKE target
* @returns the Changeset containing all changes
*/
@func()
async build(
@argument({ defaultPath: "." }) source: Directory,
base?: Container,
target: string = "All",
): Promise<Changeset> {
const container = (base ?? dag.container().from("mcr.microsoft.com/dotnet/sdk:10.0").withWorkdir("/app"))
.withDirectory(".", source)
const before = container.directory(".")
const after = container
.withExec(["dotnet", "tool", "restore"])
.withExec(["dotnet", "tool", "run", "nuke", "--target", target])
.directory(".")
return after.changes(before)
}
}