Remove old docker push and pull test

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau 2021-06-12 17:11:41 +02:00
parent b1ed40ffed
commit f842f1ed1d
6 changed files with 35 additions and 126 deletions

View File

@ -70,7 +70,7 @@ _No output._
## docker.#Push
Push a docker image to remote registry
Push a docker image to a remote registry
### docker.#Push Inputs
@ -86,8 +86,8 @@ Push a docker image to remote registry
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*out.ref* | `string` |Image ref |
|*out.digest* | `string` |Image digest |
|*ref* | `string` |Image ref |
|*digest* | `string` |Image digest |
## docker.#Run

View File

@ -29,7 +29,7 @@ import (
]
}
// Push a docker image to remote registry
// Push a docker image to a remote registry
#Push: {
// Remote name (example: "index.docker.io/alpine:latest")
name: string @dagger(input)
@ -40,13 +40,13 @@ import (
// Image registry
registry: {
// Remote registry
target: string | *"https://index.docker.io/v1/" @dagger(input)
target: string | *"https://index.docker.io/v1/" @dagger(input)
// Username
username: string @dagger(input)
username: string @dagger(input)
// Password or secret
secret: string | bytes @dagger(input)
secret: string | bytes @dagger(input)
}
push: #up: [
@ -64,38 +64,36 @@ import (
op.#Subdir & {dir: "/dagger"},
]
out: {
// Image ref
ref: string @dagger(output)
// Image ref
ref: string @dagger(output)
// Image digest
digest: string @dagger(output)
// Image digest
digest: string @dagger(output)
#up: [
op.#Load & {from: alpine.#Image & {
package: {
bash: true
jq: true
}
}},
#up: [
op.#Load & {from: alpine.#Image & {
package: {
bash: true
jq: true
}
}},
op.#Exec & {
always: true
args: ["/bin/bash", "-c", #"""
jq --arg key0 'ref' --arg value0 $(cat /dagger/image_ref) \
--arg key1 'digest' --arg value1 $(cat /dagger/image_digest) \
'. | .[$key0]=$value0 | .[$key1]=$value1 '<<< '{}' > /out
"""#,
]
mount: "/dagger": from: push
},
op.#Exec & {
always: true
args: ["/bin/bash", "-c", #"""
jq --arg key0 'ref' --arg value0 $(cat /dagger/image_ref) \
--arg key1 'digest' --arg value1 $(cat /dagger/image_digest) \
'. | .[$key0]=$value0 | .[$key1]=$value1 '<<< '{}' > /out
"""#,
]
mount: "/dagger": from: push
},
op.#Export & {
source: "/out"
format: "json"
},
]
}
op.#Export & {
source: "/out"
format: "json"
},
]
}
#Run: {

View File

@ -67,7 +67,7 @@ setup() {
dagger -e docker-push up
# Get image reference
dagger -e docker-pull input text ref "$(dagger -e docker-push query -c TestPush.push.out.ref | tr -d '\n' | tr -d '\"')"
dagger -e docker-pull input text ref "$(dagger -e docker-push query -c TestPush.push.ref | tr -d '\n' | tr -d '\"')"
# Pull image
dagger -e docker-pull up
@ -75,7 +75,7 @@ setup() {
@test "docker push and pull: invalid credential" {
# Push image (SHOULD FAIL)
run docker -e docker-push-invalid-creds up
run dagger -e docker-push-invalid-creds up
assert_failure
}

View File

@ -1,23 +0,0 @@
registry:
username: ENC[AES256_GCM,data:YDDLkr32orAgQw==,iv:ezThCQJv+bVBf8SdfSa2HFoP+eu6IZMPl5xvMOGDcps=,tag:sEV9Sonc9rjDbxXsV+UBIA==,type:str]
secret: ENC[AES256_GCM,data:moBq7PwFdtL/Z58ez+V1gR8QJsFRZEMsF82H/W6aJgf8Xdw8,iv:YAXcRzBoemmef5PBdAOBa5acNPo4BoKH7Ngud/CWYfA=,tag:LFkJvUZdltgHJ8TKVEeS/Q==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBGVmQxTXNSeU1scWJvVDFJ
cExOL3AvR1JRRWp0cFFRWGtvQ1VKc2t1SUVFClVCS1hpN1dNTktoaWZ3R09OMFVM
STRyWmtHRVROMW1Oa28yQkMwOHd1UUUKLS0tIE5LL1pEb1dMSEVXTHBsNlJxOTcr
U2FyQUtYcXVVVTlVcW5zRXh5aUk3RUUKGiWb9jSl5xRHQxB56LtNclV5Jhs50sS7
SAOBWgaYPjLpsI1oxgXf+B1FgBUEt3EMccrWRW85VvnOKOAUAJ53pQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-05-28T20:49:27Z"
mac: ENC[AES256_GCM,data:we6IaVqfT6KZ4s97JbdFCbxL2zotojLRLEbmgwEAfBhz4KAitulRItMn4I6aD1dEIwYGAFtQEcf+Wqz2yT7JC6iz1s2zNtGIaMbxxQZD6EQcJvNmY3vzqC4SKf0cRENGZWI5OscH9VVenTmOAxwwWvp9W4J52d2w9FAD9+vCl/c=,iv:vf8mZwr+z7DjCVHaRbk8jQO9/pso5INy/FmCPq/xlzo=,tag:sgSvlksSOVq5LU0ycAsXxw==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.7.1

View File

@ -1,65 +0,0 @@
package main
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
"alpha.dagger.io/docker"
"alpha.dagger.io/random"
)
source: dagger.#Artifact
registry: {
username: string
secret: string
}
TestPushAndPull: {
tag: random.#String & {
seed: ""
}
ref: "daggerio/ci-test:\(tag.out)"
// Create image
image: docker.#ImageFromDockerfile & {
dockerfile: """
FROM alpine
COPY test.txt /test.txt
"""
context: source
}
// Login
login: #up: [
op.#DockerLogin & {
registry
},
]
// Push image
push: docker.#Push & {
"ref": ref
source: image
}
// Push image
pull: docker.#Pull & {
from: push.ref
}
// Check the content
verify: #up: [
op.#Load & {from: alpine.#Image},
op.#Exec & {
always: true
args: [
"sh", "-c", """
grep -q "test" /src/test.txt
""",
]
mount: "/src": from: pull
},
]
}

View File

@ -1 +0,0 @@
test