package git
import (
"strings"
"alpha.dagger.io/alpine"
"alpha.dagger.io/dagger"
"alpha.dagger.io/git"
"alpha.dagger.io/os"
)
repo: git.#Repository & {
remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "master"
keepGitDir: true
}
repoSubDir: git.#Repository & {
remote: "https://github.com/dagger/examples.git"
ref: "main"
subdir: "todoapp"
branch: git.#CurrentBranch & {
repository: repo
tagsList: git.#Tags & {
TestRepository: os.#Container & {
image: alpine.#Image & {
package: bash: "=5.1.0-r0"
package: git: true
mount: "/repo1": from: repo
dir: "/repo1"
command: """
[ -d .git ]
"""
TestSubRepository: os.#Container & {
mount: "/repo1": from: repoSubDir
[ -d src ]
TestCurrentBranch: os.#Container & {
env: BRANCH_NAME: branch.name
[ $BRANCH_NAME = "master" ]
TestCurrentTags: os.#Container & {
env: TAGS: strings.Join([ for k, v in tagsList.tags {"\(k)=\(v)"}], "\n")
[ $TAGS = "0=master" ]
// Test fetching a private repo
TestPAT: dagger.#Input & {dagger.#Secret}
privateRepo: git.#Repository & {
remote: "https://github.com/dagger/dagger.git"
authToken: TestPAT
TestPrivateRepository: os.#Container & {
mount: "/repo1": from: privateRepo