When exporting a directory to a runtime container, we are seeing that the runtime container results don't match the results of other regular steps that follow the directory in the DAG.
Setup
We have a custom git module which uses go-git to parse and read information from a git repo. It is called git-repo. To test this module we set up a temporary git repository using the git cli, we then pass the .git directory to our git module and test that the HEAD commit hashes match. This is done using the container API (aka .WithExec())`. It should be noted that the temp git repo is slightly different every test run (when not cached), because the commit hash is dependent on the time.
A picture illustrating the setup is attached.
The basic flow is:
- git-tests module creates a temporary repo (files added and commit is made)
- repo is passed by the
dagger.Directorytype to the git-repo module - git-repo module does
.Export()to export the directory to it's runtime container - git-repo module analyses the git repo with go-git
- git-tests module calls the
git-repo's.versionInfo().commit()method to obtain the commit hash of the HEAD commit - git-tests module compares this commit with the result obtained by running
git rev-parse --short HEADon the temporary git repo.