Simplify tests

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau 2021-06-25 15:40:49 +02:00
parent e4ac04c98c
commit aaa6f8f351
25 changed files with 131 additions and 509 deletions

View File

@ -12,7 +12,7 @@
- [dagger](./dagger/README.md) - Dagger core types
- [dagger/op](./dagger/op.md) - op: low-level operations for Dagger processing pipelines
- [docker](./docker/README.md) - Docker container operations
- [docker/compose](./docker/compose.md) - -
- [docker/compose](./docker/compose.md) - Docker-compose operations
- [gcp](./gcp/README.md) - Google Cloud Platform
- [gcp/gcr](./gcp/gcr.md) - Google Container Registry
- [gcp/gke](./gcp/gke.md) - Google Kubernetes Engine

View File

@ -1,105 +0,0 @@
---
sidebar_label: docker
---
# alpha.dagger.io/docker
Docker container operations
```cue
import "alpha.dagger.io/docker"
```
## docker.#Build
Build a Docker image from source, using included Dockerfile
### docker.#Build Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*source* | `dagger.#Artifact` |- |
### docker.#Build Outputs
_No output._
## docker.#Command
A container image that can run any docker command
### docker.#Command Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*command* | `string` |Command to execute |
### docker.#Command Outputs
_No output._
## docker.#ImageFromDockerfile
Build a Docker image from the provided Dockerfile contents
### docker.#ImageFromDockerfile Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*dockerfile* | `string` |Dockerfile passed as a string |
|*context* | `dagger.#Artifact` |Build context |
### docker.#ImageFromDockerfile Outputs
_No output._
## docker.#Pull
Pull a docker container
### docker.#Pull Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*from* | `string` |Remote ref (example: "index.docker.io/alpine:latest") |
### docker.#Pull Outputs
_No output._
## docker.#Push
Push a docker image
### docker.#Push Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*ref* | `string` |Remote ref (example: "index.docker.io/alpine:latest") |
|*source* | `dagger.#Artifact` |Image |
### docker.#Push Outputs
_No output._
## docker.#Run
### docker.#Run Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*ssh.host* | `string` |ssh host |
|*ssh.user* | `string` |ssh user |
|*ssh.port* | `*22 \| int` |ssh port |
|*ssh.key* | `dagger.#Secret` |private key |
|*ref* | `string` |Image reference (e.g: nginx:alpine) |
|*run.ssh.host* | `string` |ssh host |
|*run.ssh.user* | `string` |ssh user |
|*run.ssh.port* | `*22 \| int` |ssh port |
|*run.ssh.key* | `dagger.#Secret` |private key |
|*run.command* | `"""\n # Run detach container\n OPTS=""\n \n if [ ! -z "$CONTAINER_NAME" ]; then\n \tOPTS="$OPTS --name $CONTAINER_NAME"\n fi\n \n docker container run -d $OPTS "$IMAGE_REF"\n """` |Command to execute |
|*run.env.IMAGE_REF* | `string` |- |
### docker.#Run Outputs
_No output._

View File

@ -4,10 +4,27 @@ sidebar_label: compose
# alpha.dagger.io/docker/compose
Docker-compose operations
```cue
import "alpha.dagger.io/docker/compose"
```
## compose.#App
### compose.#App Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*registries* | `[]` |Image registries |
|*run.command* | `"""\n if [ -n "$DOCKER_HOSTNAME" ]; then\n \tssh -i /key -fNT -o "StreamLocalBindUnlink=yes" -L "$(pwd)"/docker.sock:/var/run/docker.sock -p "$DOCKER_PORT" "$DOCKER_USERNAME"@"$DOCKER_HOSTNAME"\n \texport DOCKER_HOST="unix://$(pwd)/docker.sock"\n fi\n \n # Extend session duration\n echo "Host *\\nServerAliveInterval 240" \>\> "$HOME"/.ssh/config\n chmod 600 "$HOME"/.ssh/config\n \n # Move compose\n if [ -d "$SOURCE_DIR" ]; then\n \tif [ -f docker-compose.yaml ]; then\n \t\tcp docker-compose.yaml "$SOURCE_DIR"/docker-compose.yaml\n \tfi\n \tcd "$SOURCE_DIR"\n fi\n \n docker-compose build\n docker-compose up -d\n """` |Command to execute |
|*run.package."docker-compose"* | `true` |- |
|*run.registries* | `[]` |Image registries |
### compose.#App Outputs
_No output._
## compose.#Client
A container image to run the docker-compose client
@ -19,18 +36,3 @@ _No input._
### compose.#Client Outputs
_No output._
## compose.#Up
### compose.#Up Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*registries* | `[]` |Image registries |
|*run.command* | `"""\n if [ -n "$DOCKER_HOSTNAME" ]; then\n \tssh -i /key -fNT -o "StreamLocalBindUnlink=yes" -L "$(pwd)"/docker.sock:/var/run/docker.sock -p "$DOCKER_PORT" "$DOCKER_USERNAME"@"$DOCKER_HOSTNAME"\n \texport DOCKER_HOST="unix://$(pwd)/docker.sock"\n fi\n \n # Extend session duration\n echo "Host *\\nServerAliveInterval 240" \>\> "$HOME"/.ssh/config\n chmod 600 "$HOME"/.ssh/config\n \n # Move compose\n if [ -d "$SOURCE_DIR" ]; then\n \tif [ -f docker-compose.yaml ]; then\n \t\tcp docker-compose.yaml "$SOURCE_DIR"/docker-compose.yaml\n \tfi\n \tcd "$SOURCE_DIR"\n fi\n \n docker-compose build\n docker-compose up -d\n """` |Command to execute |
|*run.package."docker-compose"* | `true` |- |
|*run.registries* | `[]` |Image registries |
### compose.#Up Outputs
_No output._

View File

@ -1,89 +0,0 @@
package compose
import (
"strconv"
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
)
#CleanupCompose: {
// docker-compose up context
context: dagger.#Artifact
ssh: {
// ssh host
host: string @dagger(input)
// ssh user
user: string @dagger(input)
// ssh port
port: *22 | int @dagger(input)
// private key
key: dagger.#Secret @dagger(input)
// fingerprint
fingerprint?: string @dagger(input)
// ssh key passphrase
keyPassphrase?: dagger.#Secret @dagger(input)
}
#code: #"""
# Export host
export DOCKER_HOST="unix://$(pwd)/docker.sock"
# Start ssh agent
eval $(ssh-agent) > /dev/null
ssh-add /key > /dev/null
ssh -i /key -o "StreamLocalBindUnlink=yes" -fNT -L "$(pwd)"/docker.sock:/var/run/docker.sock -p "$DOCKER_PORT" "$DOCKER_USERNAME"@"$DOCKER_HOSTNAME" || true
# Down
if [ -d source ]; then
cd /source
fi
docker-compose down -v
"""#
#up: [
op.#Load & {from: context},
op.#WriteFile & {
content: #code
dest: "/entrypoint.sh"
},
op.#Exec & {
always: true
args: [
"/bin/sh",
"--noprofile",
"--norc",
"-eo",
"pipefail",
"/entrypoint.sh",
]
env: {
DOCKER_HOSTNAME: ssh.host
DOCKER_USERNAME: ssh.user
DOCKER_PORT: strconv.FormatInt(ssh.port, 10)
if ssh.keyPassphrase != _|_ {
SSH_ASKPASS: "/get_passphrase"
DISPLAY: "1"
}
}
mount: {
if ssh.key != _|_ {
"/key": secret: ssh.key
}
if ssh.keyPassphrase != _|_ {
"/passphrase": secret: ssh.keyPassphrase
}
}
},
]
}

View File

@ -1,31 +0,0 @@
package compose
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/docker"
"alpha.dagger.io/docker/compose"
)
repo: dagger.#Artifact @dagger(input)
TestCompose: {
up: compose.#Up & {
ssh: {
host: "143.198.64.230"
user: "root"
}
source: repo
}
verify: docker.#Command & {
ssh: up.run.ssh
command: #"""
docker container ls | grep "api" | grep "Up"
"""#
}
cleanup: #CleanupCompose & {
context: up.run
ssh: verify.ssh
}
}

View File

@ -1,29 +0,0 @@
plan:
module: .dagger/env/docker-compose-directory/plan
name: docker-compose-directory
inputs:
TestCompose.up.ssh.key:
secret: ENC[AES256_GCM,data:54RfK81pTyk8F52munntMtc34t5fMV83HS+4vhnjYeC203t8AX70NbbxTVOizjI/e+jUjvwabDjrFG/fWfvLvm6kZQQQ1ECg0u71oGdDV4avSdx4mR7YEhUN/Xes/jM+B4B4igDdC25Q6u3DPAOA61e8o/Tv9pRKDpgj6ztKweTdK09wLVguHsuAmBs9lhiMOWWRNWSLZL+N3SxQwb+fZc1lUVyI3Xnth6rvComNdEcJszTrz2mMJNUDM9Zw4OvIXEhiTjByOS+5qqkpl0HOzyX1ktAeU63B0a8PkV90ws/bz1/9IFk6w57owbbJQ6iBXDe4+D8rABPqyYB3XbYzoEAT+u2geBV2e31slhTTJK0OSYIyWY+2sE8fPNXmveFeuxGLGQptTkrUqu21Y3ZQpGYuuEzh+YrpBOP3wXV+HYyMo8YDJIKJECIi7QT8V8bkZ7mbqQQU2M5RxU2/fwBf8LTU5ShLJpPu5jL1obUvqxBOZf7tPVL/5cfYVrjDM25UYqKUMc1N4rGawjJrkRGNi7oH3dc32fZHnRu2,iv:Bcw6vL1YSm1J0aAlsuxB3D4VZKc345Tnuh6vxnUcmSk=,tag:A7mxZNoCXQzMkh9yb/Uhvw==,type:str]
repo:
dir:
path: ./docker/compose/testdata
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBmMjkxUitkQUpYWldlMkdo
Y0R4ZEx2ZVV4WTVic3pzaFBGdGJ3emo5T1hzCllyTXVUMEl5SGx2ekM2eEhrMFpj
MS9wcHRrdnFMWUlTdHdLTTNHZElKZkUKLS0tIDFpWWFoY2JZc25nVE9pbXlOMFpS
MG8yM2VtSldVYzRJZnFsNTJMYXUrWTAKoitUeYU7MDClQo5Rvs/CYcZWzU57QrIk
YrCCEjehmguDoZPKlBowtzwTzNTyTBK3x8hjkj655EPnJIw2P86pjg==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-06-17T13:11:50Z"
mac: ENC[AES256_GCM,data:1x14dBYelWAq3dnOxNVHp/rt2AcKQVejfr/KLuq2PfJqorOO3MD54mBIiX4DVmBak1jzFJ5I4PQxv+7pltHDgYA9NqQaSi6O9zd6c80wKD8NlXDNlLyPpxq1FccX/4yvAyYpxGrvRk0GFbfXpJxWaKE/48Pb0mPQJPdQMYCnA84=,iv:zZsdt2TbExB5c6vsV8PK3yHLfEIICMDjA+lGMJ6rdws=,tag:MHJamBbW+RQ143iAMU5zWQ==,type:str]
pgp: []
encrypted_suffix: secret
version: 3.7.1

View File

@ -1,2 +0,0 @@
# dagger state
state/**

View File

@ -1,46 +0,0 @@
package compose
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/docker"
"alpha.dagger.io/docker/compose"
)
repo: dagger.#Artifact
TestCompose: {
up: compose.#Up & {
ssh: {
host: "143.198.64.230"
user: "root"
}
source: repo
composeFile: #"""
version: "3"
services:
api-mix:
build: .
environment:
PORT: 7000
ports:
- 7000:7000
networks:
default:
name: mix-context
"""#
}
verify: docker.#Command & {
ssh: up.run.ssh
command: #"""
docker container ls | grep "api-mix" | grep "Up"
"""#
}
cleanup: #CleanupCompose & {
context: up.run
ssh: verify.ssh
}
}

View File

@ -1,29 +0,0 @@
plan:
module: .dagger/env/docker-compose-mix-context/plan
name: docker-compose-mix-context
inputs:
TestCompose.up.ssh.key:
secret: ENC[AES256_GCM,data:PFfUg9ViLTNkVbbAUhSk38H3xJwRj2apsxK/pGkHdYbmzSxtwf10R0HcJuRgHY+D/Q8Wy5qNnhByaVePYqpmu28LAMSERcIDqurDX/pDVgyK9dZKCp6Jq+57mVl+PtkyKkYyp/PKWjVI1W6uMSFjjv53OdfUPmygdpcfRiWq2JXRx/SLQtWtfme0QxUPUNVTEnuvmyfA44mZbah6z270rA0/AZyHF1+AKJpY1Dm4y11D1wTamZkAK45EghG0GcUyRjx/PLyIRYzVumcqCUTLMn7frfxjD5ft44C05hL76KJSBEekmsxytj3v7HCvnULEwtsIhcS0imyu139fe9nHPXhTgkJvP2tKZF8P4e65MjHszTema3SUVegCbl5aavms4Z30vRP0kX/sbUVuDktaPMN2bUSBREmbkRBGOKIRHuDDTEgQBRf9eFIMe3Z/kfYjVYRQPiLc+KUhxwXjs43TYebqS+FwzY757h1gvzqdKmtdHK6KI3agmKbgQCmAnvsJEl7C3qlFso8zTgcT0ei2IGHZ86DstMCQFzRU,iv:SgafW/IIOZyyI7uaccDgmERfmiURKX4Z6UGzbRZ5T2s=,tag:XCa3nBhjGch3MjlHRCG4/w==,type:str]
repo:
dir:
path: ./docker/compose/testdata
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBMSmROdEtUblF3REhwS3hC
bU9ObTE0aWQzdGJzRlB5WjA0UG5nZFFJTEJjClljQWFYYWNQaFozZGRMcWxyT3p3
Y0ZVUlZISUNlVkxVSVBqY0RRaGxPN3cKLS0tIGhsUTFCK2ljaWZFekVQMlRSRmtD
bEY3N3ZLTFpUNzZVWVBOK3VNRk9hWlUKd9db3j7FqFW4t7TxFyzudKDPTVqr66v2
KqedhRYCjF4ZozN0H++xQPH24RBRnwc6Uq0Vm38UYv1ozDN2L/l5DA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-06-17T13:12:17Z"
mac: ENC[AES256_GCM,data:dqszDALkWcBoEZKogzVRGZA/L/5ZUrn872KfcXawx/osd7RZXRNI3DhHN10scX7Mu94yIkFBW0V+TBGseFkA/8uZmgS1AEepVf6Z5GB17/kg7tGiFGJFwNIcc2PqpN+1CvK6SYfo2Ro309wUnt+sCIXEwPn9C5XObaAvje1KnZg=,iv:3Xc75g1OFlp6j+mwWWXfyVPE3gXEnLYGza8FdtQ94zc=,tag:dj4Na2g2KEM2Lz8Ws/op/w==,type:str]
pgp: []
encrypted_suffix: secret
version: 3.7.1

View File

@ -1,2 +0,0 @@
# dagger state
state/**

View File

@ -1,85 +0,0 @@
package compose
import (
"strconv"
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
)
#CleanupCompose: {
// docker-compose up context
context: dagger.#Artifact
ssh: {
// ssh host
host: string @dagger(input)
// ssh user
user: string @dagger(input)
// ssh port
port: *22 | int @dagger(input)
// private key
key: dagger.#Secret @dagger(input)
// fingerprint
fingerprint?: string @dagger(input)
// ssh key passphrase
keyPassphrase?: dagger.#Secret @dagger(input)
}
#code: #"""
# Export host
export DOCKER_HOST="unix://$(pwd)/docker.sock"
# Start ssh agent
eval $(ssh-agent) > /dev/null
ssh-add /key > /dev/null
ssh -i /key -o "StreamLocalBindUnlink=yes" -fNT -L "$(pwd)"/docker.sock:/var/run/docker.sock -p "$DOCKER_PORT" "$DOCKER_USERNAME"@"$DOCKER_HOSTNAME" || true
# Down
docker-compose down -v
"""#
#up: [
op.#Load & {from: context},
op.#WriteFile & {
content: #code
dest: "/entrypoint.sh"
},
op.#Exec & {
always: true
args: [
"/bin/sh",
"--noprofile",
"--norc",
"-eo",
"pipefail",
"/entrypoint.sh",
]
env: {
DOCKER_HOSTNAME: ssh.host
DOCKER_USERNAME: ssh.user
DOCKER_PORT: strconv.FormatInt(ssh.port, 10)
if ssh.keyPassphrase != _|_ {
SSH_ASKPASS: "/get_passphrase"
DISPLAY: "1"
}
}
mount: {
if ssh.key != _|_ {
"/key": secret: ssh.key
}
if ssh.keyPassphrase != _|_ {
"/passphrase": secret: ssh.keyPassphrase
}
}
},
]
}

View File

@ -1,37 +0,0 @@
package compose
import (
"alpha.dagger.io/docker"
"alpha.dagger.io/docker/compose"
)
TestCompose: {
up: compose.#Up & {
ssh: {
host: "143.198.64.230"
user: "root"
}
composeFile: #"""
version: "3"
services:
nginx:
image: nginx:alpine
ports:
- 8000:80
"""#
}
verify: docker.#Command & {
ssh: up.run.ssh
command: #"""
docker container ls | grep "nginx" | grep "Up"
"""#
}
// Can't simply use docker.#Command because we need to keep docker-compose context
cleanup: #CleanupCompose & {
context: up.run
ssh: verify.ssh
}
}

View File

@ -1,26 +0,0 @@
plan:
module: .dagger/env/docker-compose-simple/plan
name: docker-compose-simple
inputs:
TestCompose.up.ssh.key:
secret: ENC[AES256_GCM,data:abxRdizVf/D9A9XI1xnQKaQrwRYHu12Ene3MmyooqxnqLtOB2Y03YtdfL2MAJLB73ulWYAXWOEcefU8+DghnkCQ94EenDNmnbuAJvXOdqgo0g4Uik1jXUpC6D81YQCFQmqTzsNoh0Rom+bKZK8boVVSEyLr7cgjEtAsAfIgns4B0uVe5l5XaHw+vfSXP3hraxZjbXUdv6qPKtkTWzeu2ywvUEzc7zm7XCHXWsZDzuyKaGJThxZu6upiHRuMdsJ7JSNJMdZ9AOAVMTfD0miYFOuj6mdlYshtR+6lWo86i+LKXdILsUi9cerapqvFV+rjN31hS2Y1dY5O0O/rQOhPv7LcbpAKzkQsnY4giKf8oBwfn2v7roA7C+b1P1GeknQZaozckV644mJPLztfukJjhFjZ8qWHkv/jpdetm1FQJSDkBs2o3EqPbZJLFdyvui6g50dNdP48sdzuxONLH8vPwHrkjkUp4QK9mMd/Fhva0G/dgnO49h/pAVqicketnlQnl+V8RUpWAxHVRRAZ4CmGj2M4XtePnPXsTeysi,iv:EftAI98PVgOWaI63T1Isbe0EpjRIxaUYYmAe7i19J8Q=,tag:4OJHMVVfbbY8KNWG4va/pg==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAyMUJoZHN0NVFCd1d1bXUv
ZCtPUmltRmJCcnE3WHhheGRjOE5Yby95Mmd3CmJKTzBQYXNyRHVKcTQrZUNWL3pC
TnNhZmFJeGJCRmJ4UkVMMlZxUnVXV00KLS0tIGN5cWlrdDhGVkVLMlNMNWJVRkEv
ejZLR2dsTFlyQTR4amptL2Npb3R3QTAKpP7FdS2HwfBcCjhHolgDV2aEGII0IUwV
+V3fy0p1JBrhyGif/d2dca7hJGkMv42TgaGy+EHXZWKw+5cbq/XctQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-06-17T11:56:59Z"
mac: ENC[AES256_GCM,data:OPUtKdxQNAB564Zljt7zJ6mITLMpf2qmeGvpMsEGi1Y907wMbBCJ5kgoo1t19nr/gEvyY2zE611dcbs5xEqn47WM1L87VJ+YQOfv2dGFg460LrNGaGgqTS7wxyynnAfRmDHVvIowVps4Qso8QVMOIbbiL/Dyn5ePzoQYQlHhp8s=,iv:XN0T1ukTJRWsvhvRsVUUodkFOfyfVrrV0l3OCQSQ95I=,tag:iK2WvfI+33z7T5p7E/7Tag==,type:str]
pgp: []
encrypted_suffix: secret
version: 3.7.1

View File

@ -0,0 +1,34 @@
plan:
module: ./docker/compose
package: ./tests
name: docker-compose
inputs:
TestSSH.host:
text: 143.198.64.230
TestSSH.key:
secret: ENC[AES256_GCM,data:8heZn3UqcB0aV9XAn9uLx9gBcTqbmfNX7voBpYCNCGaX1nustSzKhbR29dxAoETIdfSFPetX2s4cCYbPTqFc6KTyRvfdmI8tXvb5+lin/CkdQJy7cR+RiynLEfbs32EPQilaph+kyGyGBAWAme49g8U2om/QObxCSes+Zn8ihfv7lBkLEj8hen2OC7YwIqjs9V8ozNCJ0zsk+NIk5LkryXdWTaYvgGHOmO/NuWz411L/pF1HieOV1L4Fe6E5hsUun0kVny8GxXQSbVCKle9A9TxD2bs+IBVNAUZVTsrjZYyTjYlNNgTaOqPASS5VDrOtR8csrGJ6GyGxtGrtRdhaoXYQA1zfA7uMfSMNlCwk3VB70P60s0U9tKr3HnRFX6rQdKcUwR2a1zbJ8UmHPy9apsM+tc+m/CAb8dkdu6UyiwvBK+kyPDyBVz4rwyhmtiB7cjw9vXYWX3hbZcE0e3RR4Upqw5NkIIlLfNH7T1fPDmVmIlXQk0wKIZJ//dwdJZyrraA+RRtG5b3PECSojIN3x57LnHdIXfp5drHK,iv:xqGFk9QgC6YwqFODSLRwShf+SMyY4PmtfWt5neHwfSY=,tag:vVZtGty5ehLvYzd8H0+Xsw==,type:str]
TestSSH.user:
text: root
repo:
dir:
path: ./docker/compose/tests/testdata
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBMSmROdEtUblF3REhwS3hC
bU9ObTE0aWQzdGJzRlB5WjA0UG5nZFFJTEJjClljQWFYYWNQaFozZGRMcWxyT3p3
Y0ZVUlZISUNlVkxVSVBqY0RRaGxPN3cKLS0tIGhsUTFCK2ljaWZFekVQMlRSRmtD
bEY3N3ZLTFpUNzZVWVBOK3VNRk9hWlUKd9db3j7FqFW4t7TxFyzudKDPTVqr66v2
KqedhRYCjF4ZozN0H++xQPH24RBRnwc6Uq0Vm38UYv1ozDN2L/l5DA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-06-25T13:17:45Z"
mac: ENC[AES256_GCM,data:RclYzWUgBU06881KztfHdaeBtHLOiQZ5xNp0taaxS152rUxyXCXEAFlOu/yqE3RvEoorUp473wDwFUa9DudHidY88YNdfdk5AUuZdsOXW4bRMFPF4eiFugqZJNPepaW1YBDUMeH7XQBN1jyEkFOvzyk2KKQhoUshWyrU5QDR2kc=,iv:MjhUSjzVm6nV2PnSNi346GxkirmF3yAti3Jmb94gLGg=,tag:t4fHAYh60//PlkwUPQh2uA==,type:str]
pgp: []
encrypted_suffix: secret
version: 3.7.1

View File

@ -1,3 +1,4 @@
// Docker-compose operations
package compose
import (
@ -6,7 +7,7 @@ import (
"alpha.dagger.io/docker"
)
#Up: {
#App: {
ssh?: {
// ssh host
host: string @dagger(input)

View File

@ -0,0 +1,75 @@
package compose
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/docker"
)
repo: dagger.#Artifact @dagger(input)
TestSSH: {
key: dagger.#Secret @dagger(input)
host: string @dagger(input)
user: string @dagger(input)
}
TestCompose: {
up: #App & {
ssh: {
key: TestSSH.key
host: TestSSH.host
user: TestSSH.user
}
source: repo
}
verify: docker.#Command & {
ssh: up.run.ssh
command: #"""
docker container ls | grep "api" | grep "Up"
"""#
}
cleanup: #CleanupCompose & {
context: up.run
ssh: verify.ssh
}
}
TestInlineCompose: {
up: #App & {
ssh: {
key: TestSSH.key
host: TestSSH.host
user: TestSSH.user
}
source: repo
composeFile: #"""
version: "3"
services:
api-mix:
build: .
environment:
PORT: 7000
ports:
- 7000:7000
networks:
default:
name: mix-context
"""#
}
verify: docker.#Command & {
ssh: up.run.ssh
command: #"""
docker container ls | grep "api-mix" | grep "Up"
"""#
}
cleanup: #CleanupCompose & {
context: up.run
ssh: verify.ssh
}
}

View File

@ -70,16 +70,8 @@ setup() {
assert_failure
}
@test "docker compose: simple" {
dagger -e docker-compose-simple up
}
@test "docker compose: directory" {
dagger -e docker-compose-directory up
}
@test "docker compose: mix-context" {
dagger -e docker-compose-mix-context up
@test "docker compose" {
dagger -e docker-compose up
}
@test "docker run: ssh" {