docs: git package uniformization + tests implementation
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
parent
e29cf4f4ff
commit
407ee6e9ee
2
stdlib/.dagger/env/git/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/git/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# dagger state
|
||||||
|
state/**
|
63
stdlib/.dagger/env/git/plan/git.cue
vendored
Normal file
63
stdlib/.dagger/env/git/plan/git.cue
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package git
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"dagger.io/git"
|
||||||
|
"dagger.io/alpine"
|
||||||
|
"dagger.io/os"
|
||||||
|
"dagger.io/dagger/op"
|
||||||
|
)
|
||||||
|
|
||||||
|
repo: git.#Repository & {
|
||||||
|
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||||
|
ref: "master"
|
||||||
|
|
||||||
|
#up: [
|
||||||
|
op.#FetchGit & {
|
||||||
|
keepGitDir: true
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
branch: git.#CurrentBranch & {
|
||||||
|
repository: repo
|
||||||
|
}
|
||||||
|
|
||||||
|
tagsList: git.#Tags & {
|
||||||
|
repository: repo
|
||||||
|
}
|
||||||
|
|
||||||
|
TestRepository: os.#Container & {
|
||||||
|
image: alpine.#Image & {
|
||||||
|
package: bash: "=5.1.0-r0"
|
||||||
|
package: git: true
|
||||||
|
}
|
||||||
|
mount: "/repo1": from: repo
|
||||||
|
dir: "/repo1"
|
||||||
|
command: """
|
||||||
|
[ -d .git ]
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
TestCurrentBranch: os.#Container & {
|
||||||
|
image: alpine.#Image & {
|
||||||
|
package: bash: "=5.1.0-r0"
|
||||||
|
package: git: true
|
||||||
|
}
|
||||||
|
env: BRANCH_NAME: branch.name
|
||||||
|
command: """
|
||||||
|
[ $BRANCH_NAME = "master" ]
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
TestCurrentTags: os.#Container & {
|
||||||
|
image: alpine.#Image & {
|
||||||
|
package: bash: "=5.1.0-r0"
|
||||||
|
package: git: true
|
||||||
|
}
|
||||||
|
env: TAGS: strings.Join([ for k, v in tagsList.tags {"\(k)=\(v)"}], "\n")
|
||||||
|
command: """
|
||||||
|
[ $TAGS = "0=master" ]
|
||||||
|
"""
|
||||||
|
}
|
21
stdlib/.dagger/env/git/values.yaml
vendored
Normal file
21
stdlib/.dagger/env/git/values.yaml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
name: git
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBRVm9VbnZLQzl0LzBjYUkw
|
||||||
|
cXBwTlJWeXpCellCenJFcEFBejVGREpIaVdZCkV1U3BMK1BUOStvUThUd09DVUNK
|
||||||
|
OXJ4Yjl4WEtSMHlpeG5TVUNwQU5iMXcKLS0tIE1HS0U0YWxYS3V5UXFmUUxTVGlk
|
||||||
|
TmhJNisyamw3d244aGVJSEVFVUVLZGsKvd+nowA0CLXQbdvyI4J0lBjs9vdISWlo
|
||||||
|
gGvR49uul3Z8raVWXFUzsyQ8xTvYNg0ovynFG2KdagSKr1DlhKMBEQ==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2021-06-15T14:34:51Z"
|
||||||
|
mac: ENC[AES256_GCM,data:phQpRQlHv9c3VRcqZ7OkSfW4a9oPnTD2ucsB8TJatgzLrbP1+erj9x2jrPex0T2MExIFFzNynSAiWwueLYqCzUvuG2DfIokvM9erNfdpbIBTtJeWO9+hVIkzoQ6xeKg1wLb0q3U7Cbbe6GBFA3oabPN2kyzGbgS2LO2Ou77NMLk=,iv:sS0MRNEGBWos6XNAQEYK2UmaK9g0rd+Nx1xBNeh6w+M=,tag:DIcqzBvChde/C7T/yAhn+w==,type:str]
|
||||||
|
pgp: []
|
||||||
|
encrypted_suffix: secret
|
||||||
|
version: 3.7.1
|
@ -9,7 +9,6 @@ import (
|
|||||||
|
|
||||||
// A git repository
|
// A git repository
|
||||||
#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)
|
||||||
@ -36,14 +35,12 @@ import (
|
|||||||
|
|
||||||
// Get the name of the current checked out branch or tag
|
// Get the name of the current checked out branch or tag
|
||||||
#CurrentBranch: {
|
#CurrentBranch: {
|
||||||
|
|
||||||
// Git repository
|
// Git repository
|
||||||
repository: dagger.#Artifact @dagger(input)
|
repository: dagger.#Artifact @dagger(input)
|
||||||
|
|
||||||
// Git branch name
|
// Git branch name
|
||||||
name: {
|
name: {
|
||||||
string
|
string
|
||||||
@dagger(output)
|
|
||||||
|
|
||||||
#up: [
|
#up: [
|
||||||
op.#Load & {
|
op.#Load & {
|
||||||
@ -74,19 +71,17 @@ import (
|
|||||||
format: "string"
|
format: "string"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
} @dagger(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
// List tags of a repository
|
// List tags of a repository
|
||||||
#Tags: {
|
#Tags: {
|
||||||
|
|
||||||
// Git repository
|
// Git repository
|
||||||
repository: dagger.#Artifact @dagger(input)
|
repository: dagger.#Artifact @dagger(input)
|
||||||
|
|
||||||
// Repository tags
|
// Repository tags
|
||||||
tags: {
|
tags: {
|
||||||
[...string]
|
[...string]
|
||||||
@dagger(output)
|
|
||||||
|
|
||||||
#up: [
|
#up: [
|
||||||
op.#Load & {
|
op.#Load & {
|
||||||
@ -118,5 +113,5 @@ import (
|
|||||||
format: "json"
|
format: "json"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
} @dagger(output)
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ setup() {
|
|||||||
dagger -e netlify up
|
dagger -e netlify up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "git" {
|
||||||
|
dagger -e git up
|
||||||
|
}
|
||||||
|
|
||||||
@test "aws: ecr" {
|
@test "aws: ecr" {
|
||||||
dagger -e aws-ecr up
|
dagger -e aws-ecr up
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user