Rename field according to @shykes review

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau 2021-06-28 14:48:49 +02:00
parent 67a982eb0f
commit d10f2a49a5
4 changed files with 20 additions and 16 deletions

View File

@ -76,7 +76,7 @@ Push a docker image to a remote registry
| Name | Type | Description | | Name | Type | Description |
| ------------- |:-------------: |:-------------: | | ------------- |:-------------: |:-------------: |
|*name* | `string` |Remote name (example: "index.docker.io/alpine:latest") | |*target* | `string` |Remote target (example: "index.docker.io/alpine:latest") |
|*source* | `dagger.#Artifact` |Image source | |*source* | `dagger.#Artifact` |Image source |
|*auth.username* | `string` |Username | |*auth.username* | `string` |Username |
|*auth.secret* | `string` |Password or secret | |*auth.secret* | `string` |Password or secret |

View File

@ -30,8 +30,8 @@ import (
// Push a docker image to a remote registry // Push a docker image to a remote registry
#Push: { #Push: {
// Remote name (example: "index.docker.io/alpine:latest") // Remote target (example: "index.docker.io/alpine:latest")
name: string @dagger(input) target: string @dagger(input)
// Image source // Image source
source: dagger.#Artifact @dagger(input) source: dagger.#Artifact @dagger(input)
@ -50,13 +50,13 @@ import (
if auth != _|_ { if auth != _|_ {
op.#DockerLogin & { op.#DockerLogin & {
target: name "target": target
username: auth.username username: auth.username
secret: auth.secret secret: auth.secret
} }
}, },
op.#PushContainer & {ref: name}, op.#PushContainer & {ref: target},
op.#Subdir & {dir: "/dagger"}, op.#Subdir & {dir: "/dagger"},
] ]

View File

@ -10,9 +10,11 @@ TestRegistry: {
} }
TestPush: { TestPush: {
// Generate a random string
// Seed is used to force buildkit execution and not simply use a previous generated string.
tag: random.#String & {seed: "docker push and pull should fail"} tag: random.#String & {seed: "docker push and pull should fail"}
name: "daggerio/ci-test:\(tag.out)" target: "daggerio/ci-test:\(tag.out)"
image: #ImageFromDockerfile & { image: #ImageFromDockerfile & {
dockerfile: """ dockerfile: """
@ -23,7 +25,7 @@ TestPush: {
} }
push: #Push & { push: #Push & {
"name": name "target": target
source: image source: image
auth: { auth: {
username: TestRegistry.username username: TestRegistry.username

View File

@ -35,9 +35,11 @@ TestRegistry: {
} }
TestPush: { TestPush: {
// Generate a random string
// Seed is used to force buildkit execution and not simply use a previous generated string.
tag: random.#String & {seed: "docker push"} tag: random.#String & {seed: "docker push"}
name: "daggerio/ci-test:\(tag.out)" target: "daggerio/ci-test:\(tag.out)"
secret: #TestGetSecret & { secret: #TestGetSecret & {
secret: TestRegistry.secret secret: TestRegistry.secret
@ -52,7 +54,7 @@ TestPush: {
} }
push: #Push & { push: #Push & {
"name": name "target": target
source: image source: image
auth: { auth: {
username: TestRegistry.username username: TestRegistry.username