Skip to content

Commit 586578c

Browse files
authored
Remove unsupported docker.secret.dst field (#5927)
1 parent 1675c84 commit 586578c

File tree

6 files changed

+15
-34
lines changed

6 files changed

+15
-34
lines changed

docs/content/en/schemas/v2beta17.json

+1-7
Original file line numberDiff line numberDiff line change
@@ -1215,11 +1215,6 @@
12151215
"id"
12161216
],
12171217
"properties": {
1218-
"dst": {
1219-
"type": "string",
1220-
"description": "path in the container to mount the secret.",
1221-
"x-intellij-html-description": "path in the container to mount the secret."
1222-
},
12231218
"id": {
12241219
"type": "string",
12251220
"description": "id of the secret.",
@@ -1233,8 +1228,7 @@
12331228
},
12341229
"preferredOrder": [
12351230
"id",
1236-
"src",
1237-
"dst"
1231+
"src"
12381232
],
12391233
"additionalProperties": false,
12401234
"type": "object",

pkg/skaffold/docker/image.go

-3
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,6 @@ func ToCLIBuildArgs(a *latestV1.DockerArtifact, evaluatedArgs map[string]*string
511511
if a.Secret.Source != "" {
512512
secretString += ",src=" + a.Secret.Source
513513
}
514-
if a.Secret.Destination != "" {
515-
secretString += ",dst=" + a.Secret.Destination
516-
}
517514
args = append(args, "--secret", secretString)
518515
}
519516

pkg/skaffold/docker/image_test.go

-21
Original file line numberDiff line numberDiff line change
@@ -355,27 +355,6 @@ func TestGetBuildArgs(t *testing.T) {
355355
},
356356
want: []string{"--secret", "id=mysecret,src=foo.src"},
357357
},
358-
{
359-
description: "secret with destination",
360-
artifact: &latestV1.DockerArtifact{
361-
Secret: &latestV1.DockerSecret{
362-
ID: "mysecret",
363-
Destination: "foo.dst",
364-
},
365-
},
366-
want: []string{"--secret", "id=mysecret,dst=foo.dst"},
367-
},
368-
{
369-
description: "secret with source and destination",
370-
artifact: &latestV1.DockerArtifact{
371-
Secret: &latestV1.DockerSecret{
372-
ID: "mysecret",
373-
Source: "foo.src",
374-
Destination: "foo.dst",
375-
},
376-
},
377-
want: []string{"--secret", "id=mysecret,src=foo.src,dst=foo.dst"},
378-
},
379358
{
380359
description: "ssh with no source",
381360
artifact: &latestV1.DockerArtifact{

pkg/skaffold/schema/latest/v1/config.go

-3
Original file line numberDiff line numberDiff line change
@@ -1247,9 +1247,6 @@ type DockerSecret struct {
12471247

12481248
// Source is the path to the secret on the host machine.
12491249
Source string `yaml:"src,omitempty"`
1250-
1251-
// Destination is the path in the container to mount the secret.
1252-
Destination string `yaml:"dst,omitempty"`
12531250
}
12541251

12551252
// BazelArtifact describes an artifact built with [Bazel](https://bazel.build/).

pkg/skaffold/schema/v2beta16/upgrade.go

100755100644
+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package v2beta16
1818

1919
import (
20+
"github.com/sirupsen/logrus"
21+
2022
next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest/v1"
2123
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"
2224
pkgutil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
@@ -34,5 +36,10 @@ func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) {
3436
}
3537

3638
func upgradeOnePipeline(oldPipeline, newPipeline interface{}) error {
39+
for _, a := range oldPipeline.(*Pipeline).Build.Artifacts {
40+
if a.DockerArtifact != nil && a.DockerArtifact.Secret != nil && a.DockerArtifact.Secret.Destination != "" {
41+
logrus.Warnf("Artifact %q: Docker secret destination is no longer supported: %q", a.ImageName, a.DockerArtifact.Secret.Destination)
42+
}
43+
}
3744
return nil
3845
}

pkg/skaffold/schema/v2beta16/upgrade_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ build:
3232
- image: gcr.io/k8s-skaffold/skaffold-example
3333
docker:
3434
dockerfile: path/to/Dockerfile
35+
secret:
36+
id: id
37+
src: /file.txt
38+
dst: /etc/passwd
3539
- image: gcr.io/k8s-skaffold/bazel
3640
bazel:
3741
target: //mytarget
@@ -108,6 +112,9 @@ build:
108112
- image: gcr.io/k8s-skaffold/skaffold-example
109113
docker:
110114
dockerfile: path/to/Dockerfile
115+
secret:
116+
id: id
117+
src: /file.txt
111118
- image: gcr.io/k8s-skaffold/bazel
112119
bazel:
113120
target: //mytarget

0 commit comments

Comments
 (0)