Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
- Loading branch information
Showing
40 changed files
with
1,202 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# dagger state | ||
state/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package eks | ||
|
||
import ( | ||
"dagger.io/aws" | ||
"dagger.io/aws/eks" | ||
"dagger.io/kubernetes" | ||
"dagger.io/dagger/op" | ||
) | ||
|
||
TestConfig: awsConfig: aws.#Config & { | ||
region: "us-east-2" | ||
} | ||
|
||
TestCluster: eks.#KubeConfig & { | ||
config: TestConfig.awsConfig | ||
clusterName: *"dagger-example-eks-cluster" | string | ||
} | ||
|
||
TestEks: { | ||
#GetPods: | ||
""" | ||
kubectl get pods -A | ||
""" | ||
|
||
#up: [ | ||
op.#Load & { | ||
from: kubernetes.#Kubectl | ||
}, | ||
|
||
op.#WriteFile & { | ||
dest: "/kubeconfig" | ||
content: TestCluster.kubeconfig | ||
}, | ||
|
||
op.#WriteFile & { | ||
dest: "/getPods.sh" | ||
content: #GetPods | ||
}, | ||
|
||
op.#Exec & { | ||
always: true | ||
args: [ | ||
"/bin/bash", | ||
"--noprofile", | ||
"--norc", | ||
"-eo", | ||
"pipefail", | ||
"/getPods.sh", | ||
] | ||
env: KUBECONFIG: "/kubeconfig" | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
plan: | ||
module: .dagger/env/aws-eks/plan | ||
name: aws-eks | ||
inputs: | ||
TestConfig.awsConfig.accessKey: | ||
secret: ENC[AES256_GCM,data:ZiNdgkTZlOyWht2CDpmYKN+ViTE=,iv:wdRiBw65BgSia9z//tUDirkkhw9O29ZoerX6eZnYx9k=,tag:S/0i/fRtQJg4Qp7tmUK4ag==,type:str] | ||
TestConfig.awsConfig.secretKey: | ||
secret: ENC[AES256_GCM,data:ywvQiDE4gmM6KasYWOvX1FY/Lerg5TghgoYTq1AlXDRHNGzZtY3ClQ==,iv:HCXweaSKHLwEA8Mq4up/TUaV7YDtsRpBpwYD19Jh4iw=,tag:l2hmI9BsGiRyulh4yDn/hw==,type:str] | ||
sops: | ||
kms: [] | ||
gcp_kms: [] | ||
azure_kv: [] | ||
hc_vault: [] | ||
age: | ||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk | ||
enc: | | ||
-----BEGIN AGE ENCRYPTED FILE----- | ||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBVdWE4VlRMWGJ3WDExWkNl | ||
S1dqU21uVXFjaXU5eWdKRmRCUXFCd2ZaTjNrCjlkNXI3WUdnRGVibmZkbXJYaEV4 | ||
SXIveGNDNnZ6dDM4SjdrMmZIZVhyVzAKLS0tIGkzK0tMTTdHU2lacmtvakUwbGFE | ||
M3U4UFV5REQzYko3QjlXVE02Z0J4WUkK8uHC67Mutls4drXbCi8AwuFqbRXeb69P | ||
ZnOFZEB4NoayoOojr1mY9ssDTywHF4KwR4E9ZmJ3V3hlEAgMkqfvSA== | ||
-----END AGE ENCRYPTED FILE----- | ||
lastmodified: "2021-06-17T18:46:34Z" | ||
mac: ENC[AES256_GCM,data:B+WtEMOKXy8AT/YTUaKZ9aA8fQRt2pJp3IaABpj0oYI1vCG953MnDCIxj0j2bTQN5gyaFPF8UQ1o/pRJzCKhm26wbCByUrVdHxHTwoJ7arDqQGwcNKYAuQjLtMG7gsl0BqjCg0oKO5YEa24BqHVf1dEo9AcXd6LBwqvxVjmd98g=,iv:aWxj1Oq6wmUYuWnGOc2zIpzOYJVyXV9qSzBgF+iGsHI=,tag:Bx1A8UxghYq97wEdUxbmdg==,type:str] | ||
pgp: [] | ||
encrypted_suffix: secret | ||
version: 3.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# dagger state | ||
state/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package docker | ||
|
||
import ( | ||
"dagger.io/dagger" | ||
"dagger.io/dagger/op" | ||
"dagger.io/docker" | ||
) | ||
|
||
TestSourceBuild: dagger.#Artifact @dagger(input) | ||
|
||
TestBuild: { | ||
image: docker.#Build & { | ||
source: TestSourceBuild | ||
} | ||
|
||
verify: #up: [ | ||
op.#Load & { | ||
from: image | ||
}, | ||
|
||
op.#Exec & { | ||
always: true | ||
args: [ | ||
"sh", "-c", """ | ||
grep -q "test" /test.txt | ||
""", | ||
] | ||
}, | ||
] | ||
} | ||
|
||
TestSourceImageFromDockerfile: dagger.#Artifact @dagger(input) | ||
|
||
TestImageFromDockerfile: { | ||
image: docker.#ImageFromDockerfile & { | ||
dockerfile: """ | ||
FROM alpine | ||
COPY test.txt /test.txt | ||
""" | ||
context: TestSourceImageFromDockerfile | ||
} | ||
|
||
verify: #up: [ | ||
op.#Load & { | ||
from: image | ||
}, | ||
|
||
op.#Exec & { | ||
always: true | ||
args: [ | ||
"sh", "-c", """ | ||
grep -q "test" /test.txt | ||
""", | ||
] | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
plan: | ||
module: .dagger/env/docker-build/plan | ||
name: docker-build | ||
inputs: | ||
TestSourceBuild: | ||
dir: | ||
path: ./docker/testdata/build | ||
TestSourceImageFromDockerfile: | ||
dir: | ||
path: ./docker/testdata/dockerfile | ||
sops: | ||
kms: [] | ||
gcp_kms: [] | ||
azure_kv: [] | ||
hc_vault: [] | ||
age: | ||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk | ||
enc: | | ||
-----BEGIN AGE ENCRYPTED FILE----- | ||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA0TXlFYWNvUldMdlRtWkEz | ||
SlBEYUY1Q0thbFdSZGpaT00xQ2Jkc1J2WkdJClBXUGVTamdmZU1KNUdjam9HN0Zl | ||
RjRQbVRHVjR6S3RCWlJLaElaM2ZWVG8KLS0tIDJJejFkQkxYeDdHcWdPS0p0QmJ0 | ||
Mm5vT1dHbFViK2ZIakNnVkZTd2lhUHMK63jJsJVLJMbQE2NkAB8qv8JnPHpvcNes | ||
z17EJgl0lCLqeNHtfrTfSiIP4wq8gNLK4avCKK+WGDOIMsXPzK6RNw== | ||
-----END AGE ENCRYPTED FILE----- | ||
lastmodified: "2021-06-17T20:14:11Z" | ||
mac: ENC[AES256_GCM,data:hlc0Bnfeoor/WKMbQRgTalkxngL0YXTwHAys/moXZ4ZMGd2lt+j4l4EkKSjb3QrJfPllCeqroohLKtN+lP4K9fSCMcfYzic2DTEP68rPwufmrgxys1snOHHgIEfqogL8p55fJdXn91x+WHhPNkbWaaH0WcboYsy0zemUIkjb+xc=,iv:8oUeR1dfT4lrVWyJpGPPFa/jlPgWA/ld3UM9Cw2znxk=,tag:59RyiXwzJ5j+c5faxs9U3w==,type:str] | ||
pgp: [] | ||
encrypted_suffix: secret | ||
version: 3.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# dagger state | ||
state/** |
44 changes: 44 additions & 0 deletions
44
stdlib/.dagger/env/kubernetes-deployment/plan/kubernetes.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/yaml" | ||
"dagger.io/kubernetes" | ||
"dagger.io/random" | ||
) | ||
|
||
// We assume that a kinD cluster is running locally | ||
// To deploy a local KinD cluster, follow this link : https://kind.sigs.k8s.io/docs/user/quick-start/ | ||
TestKubeconfig: string @dagger(input) | ||
|
||
TestKubeApply: { | ||
suffix: random.#String & { | ||
seed: "" | ||
} | ||
|
||
// Pod spec | ||
kubeSrc: { | ||
apiVersion: "v1" | ||
kind: "Pod" | ||
metadata: name: "kube-test-\(suffix.out)" | ||
spec: { | ||
restartPolicy: "Never" | ||
containers: [{ | ||
name: "test" | ||
image: "hello-world" | ||
}] | ||
} | ||
} | ||
|
||
// Apply deployment | ||
apply: kubernetes.#Resources & { | ||
kubeconfig: TestKubeconfig | ||
namespace: "dagger-test" | ||
manifest: yaml.Marshal(kubeSrc) | ||
} | ||
|
||
// Verify deployment | ||
verify: #VerifyApply & { | ||
podname: kubeSrc.metadata.name | ||
namespace: apply.namespace | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package main | ||
|
||
import ( | ||
"dagger.io/dagger/op" | ||
"dagger.io/kubernetes" | ||
) | ||
|
||
#VerifyApply: { | ||
podname: string | ||
|
||
namespace: string | ||
|
||
// Verify that pod exist | ||
#GetPods: | ||
""" | ||
kubectl get pods --namespace "$KUBE_NAMESPACE" \( podname ) | ||
""" | ||
|
||
// Clear that pod for future test | ||
#DeletePods: | ||
""" | ||
kubectl delete pods --namespace "$KUBE_NAMESPACE" \( podname ) | ||
""" | ||
|
||
#up: [ | ||
op.#Load & { | ||
from: kubernetes.#Kubectl | ||
}, | ||
|
||
op.#WriteFile & { | ||
dest: "/kubeconfig" | ||
content: TestKubeconfig | ||
mode: 0o600 | ||
}, | ||
|
||
op.#WriteFile & { | ||
dest: "/getPods.sh" | ||
content: #GetPods | ||
}, | ||
|
||
// Check pods | ||
op.#Exec & { | ||
always: true | ||
args: [ | ||
"/bin/bash", | ||
"--noprofile", | ||
"--norc", | ||
"-eo", | ||
"pipefail", | ||
"/getPods.sh", | ||
] | ||
env: { | ||
KUBECONFIG: "/kubeconfig" | ||
KUBE_NAMESPACE: namespace | ||
} | ||
}, | ||
|
||
op.#WriteFile & { | ||
dest: "/deletePods.sh" | ||
content: #DeletePods | ||
}, | ||
|
||
op.#Exec & { | ||
always: true | ||
args: [ | ||
"/bin/bash", | ||
"--noprofile", | ||
"--norc", | ||
"-eo", | ||
"pipefail", | ||
"/deletePods.sh", | ||
] | ||
env: { | ||
KUBECONFIG: "/kubeconfig" | ||
KUBE_NAMESPACE: namespace | ||
} | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
plan: | ||
module: .dagger/env/kubernetes-deployment/plan | ||
name: kubernetes-deployment | ||
sops: | ||
kms: [] | ||
gcp_kms: [] | ||
azure_kv: [] | ||
hc_vault: [] | ||
age: | ||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk | ||
enc: | | ||
-----BEGIN AGE ENCRYPTED FILE----- | ||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBIQ2hZZ3ZRVzRseXZyVW1h | ||
L01WYkNrTzdHSEN5WTlyQzVDTm9FbzRENzFFCjdrcVhKa1ZwaGNyYmo3ditDR1hC | ||
cStzcmVjUXY3V3FUZElRNUIzQlQzL0UKLS0tIHlmWTlUdFVOczM0TTF5RHFTUXps | ||
SVVkOUtuWTJneE45em5iQ3JvbnIwWlkKgdJC5IzvVDxbWSfU41Xg/UGPxuVBSOGY | ||
eqenr07uWppNaHuLuo9A+znQa2RQ0L2clcB2d+ka+6z5tQyHOfx1nA== | ||
-----END AGE ENCRYPTED FILE----- | ||
lastmodified: "2021-06-18T15:41:02Z" | ||
mac: ENC[AES256_GCM,data:R3DuHLEyfehKe1nCWHdKB9jyOs5TXI+r2BmQDMiwI8v0xfZdOZWfwGw3NAFGDZHbaLNTajQkzviDsMhaXg5bxvmK7P8PiJOOmnm/LnDRfnJirGRGpWA7bmsHH/QZL1lb75+cwUrwRZflkKoPy2bQyoC5Rze6/oNhPIUTCwQWaMo=,iv:73ZjXAcazCND3JhC94TjUOlcMbwfTz8YDFP1BPo8yUw=,tag:wUVcfyjtf4KzpU0jDrxleQ==,type:str] | ||
pgp: [] | ||
encrypted_suffix: secret | ||
version: 3.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# dagger state | ||
state/** |
Oops, something went wrong.