Add auth to Git.#Repository

Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
Guillaume de Rouville
2021-08-26 16:12:14 +02:00
parent 3b0e3f6919
commit 08f395b70d
9 changed files with 55 additions and 43 deletions

View File

@@ -3,8 +3,9 @@ package git
import (
"strings"
"alpha.dagger.io/git"
"alpha.dagger.io/alpine"
"alpha.dagger.io/dagger"
"alpha.dagger.io/git"
"alpha.dagger.io/os"
)
@@ -74,3 +75,25 @@ TestCurrentTags: os.#Container & {
[ $TAGS = "0=master" ]
"""
}
// Test fetching a private repo
TestPAT: dagger.#Input & {dagger.#Secret}
privateRepo: git.#Repository & {
remote: "https://github.com/dagger/dagger.git"
ref: "main"
keepGitDir: true
authToken: TestPAT
}
TestPrivateRepository: os.#Container & {
image: alpine.#Image & {
package: bash: "=5.1.0-r0"
package: git: true
}
mount: "/repo1": from: privateRepo
dir: "/repo1"
command: """
[ -d .git ]
"""
}