#How to force inclusion of a projects .git folder

1 messages ยท Page 1 of 1 (latest)

hot epoch
#

I am trying to write a Dagger module for a tool I authored called nsv (https://github.com/purpleclay/nsv) (next semantic version). However, for this to work, it needs to read the project repository's Git log.

Looking within the Dagger source code, I see that the exclude pattern **/.git is mandated (https://github.com/dagger/dagger/blob/0e3afcaea9a2c33b7a7d5836315d3637fe682578/core/schema/modulesource.go#L650). I have experimented with the new Dagger views functionality, which has no impact.

Is there any intention to support modules that require access to the .git directory?

hot epoch
#

The only way I can think of doing it currently is to have the Dagger Module clone the repository.

red orbit
#

I think that exclusion is specific to loading module dirs and not necessarily input directories. So it could be an issue if you're trying to load the project with dag.ModuleSource or something.

For example, I have the function

func (g *Greetings) Ls(dir *Directory) *Container {
    return dag.Container().From("alpine").WithDirectory("/src", dir).WithExec([]string{"ls", "-la", "/src"})
}

and I call
dagger call ls --dir . stdout

total 88
drwxr-xr-x    8 root     root          4096 Mar 28 13:10 .
drwxr-xr-x    1 root     root          4096 Mar 28 13:10 ..
drwxr-xr-x    2 root     root          4096 Nov  2 21:49 .circleci
drwxr-xr-x    9 root     root          4096 Mar 28 13:08 .git
drwxr-xr-x    3 root     root          4096 Oct 18 15:20 .github
-rw-r--r--    2 root     root            84 Nov  2 18:26 .gitignore
-rw-r--r--    2 root     root             0 Nov  2 18:26 .gitmodules
-rw-r--r--    2 root     root          3800 Nov  7 16:06 DEMO.md
-rw-r--r--    2 root     root           250 Nov  2 21:53 Jenkinsfile
-rw-r--r--    2 root     root         11357 Oct 18 15:33 LICENSE
-rw-r--r--    2 root     root           243 Nov  6 05:19 README.md
...
hot epoch
#

I think I have been a fool... You are absolutely right

#

I just wrote another small test module using busybox and I got the same output as you ๐Ÿ˜„

#

I think I have been programming for too many hours straight. Time to take a break

red orbit
#

Happens to me all the time ๐Ÿ˜‚

hot epoch
#

I also just realised why my nsv dagger module was failing.... I was invoking it within a sub-directory of my monorepo. Hence there is no .git folder facepalm