Merge pull request #788 from grouville/fix-git-package

git package - add keepGitDir option
This commit is contained in:
Andrea Luzzardi 2021-07-28 18:32:22 +02:00 committed by GitHub
commit 04d8e25e4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 11 deletions

View File

@ -11,19 +11,25 @@ import (
#Repository: { #Repository: {
// Git remote. // Git remote.
// Example: `"https://github.com/dagger/dagger"` // Example: `"https://github.com/dagger/dagger"`
remote: string @dagger(input) remote: string & dagger.#Input
// Git ref: can be a commit, tag or branch. // Git ref: can be a commit, tag or branch.
// Example: "main" // Example: "main"
ref: string @dagger(input) ref: string & dagger.#Input
// (optional) Subdirectory // (optional) Subdirectory
subdir: string | *null @dagger(input) subdir: *null | string & dagger.#Input
// (optional) Keep .git directory
keepGitDir: *false | bool
#up: [ #up: [
op.#FetchGit & { op.#FetchGit & {
"remote": remote "remote": remote
"ref": ref "ref": ref
if (keepGitDir) {
keepGitDir: true
}
}, },
if subdir != null { if subdir != null {
op.#Subdir & { op.#Subdir & {

View File

@ -6,18 +6,19 @@ import (
"alpha.dagger.io/git" "alpha.dagger.io/git"
"alpha.dagger.io/alpine" "alpha.dagger.io/alpine"
"alpha.dagger.io/os" "alpha.dagger.io/os"
"alpha.dagger.io/dagger/op"
) )
repo: git.#Repository & { repo: git.#Repository & {
remote: "https://github.com/blocklayerhq/acme-clothing.git" remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "master" ref: "master"
#up: [
op.#FetchGit & {
keepGitDir: true keepGitDir: true
}, }
]
repoSubDir: git.#Repository & {
remote: "https://github.com/dagger/examples.git"
ref: "main"
subdir: "todoapp"
keepGitDir: true
} }
branch: git.#CurrentBranch & { branch: git.#CurrentBranch & {
@ -40,6 +41,18 @@ TestRepository: os.#Container & {
""" """
} }
TestSubRepository: os.#Container & {
image: alpine.#Image & {
package: bash: "=5.1.0-r0"
package: git: true
}
mount: "/repo1": from: repoSubDir
dir: "/repo1"
command: """
[ -d src ]
"""
}
TestCurrentBranch: os.#Container & { TestCurrentBranch: os.#Container & {
image: alpine.#Image & { image: alpine.#Image & {
package: bash: "=5.1.0-r0" package: bash: "=5.1.0-r0"