Skip to content

Commit 47d7201

Browse files
committed
Merge remote-tracking branch 'origin/main' into HEAD
2 parents 1b44f5f + 23f65f2 commit 47d7201

File tree

147 files changed

+2232
-563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+2232
-563
lines changed

CHANGELOG.md

+56
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
# v1.34.0 Release - 10/26/2021
2+
**Linux**
3+
`curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.34.0/skaffold-linux-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin`
4+
5+
**macOS**
6+
`curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.34.0/skaffold-darwin-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin`
7+
8+
**Windows**
9+
https://storage.googleapis.com/skaffold/releases/v1.34.0/skaffold-windows-amd64.exe
10+
11+
**Docker image**
12+
`gcr.io/k8s-skaffold/skaffold:v1.34.0`
13+
14+
Note: This release comes with a new config version, `v2beta25`. To upgrade your skaffold.yaml, use `skaffold fix`. If you choose not to upgrade, skaffold will auto-upgrade as best as it can.
15+
16+
Highlights:
17+
* `skaffold deploy`, `skaffold render` and `skaffold test` now support the `--images` flag for providing a list of images to run against.
18+
* The `--images` flag now supports `NAME=TAG` pairs.
19+
20+
New Features and Additions:
21+
* feat: trap SIGUSR1 to dump current stacktrace [#6751](https://github.com/GoogleContainerTools/skaffold/pull/6751)
22+
* feat: skaffold lint core logic, CLI command+flags, and MVP skaffold.yaml support [#6715](https://github.com/GoogleContainerTools/skaffold/pull/6715)
23+
24+
Fixes:
25+
* fix: fix non-determinism in skaffoldyamls_test.go [#6757](https://github.com/GoogleContainerTools/skaffold/pull/6757)
26+
* fix: use new stringslice lib [#6752](https://github.com/GoogleContainerTools/skaffold/pull/6752)
27+
* fix: correctly rewrite debug container entrypoint and bind host port [#6682](https://github.com/GoogleContainerTools/skaffold/pull/6682)
28+
* Fix new version generation [#6616](https://github.com/GoogleContainerTools/skaffold/pull/6616)
29+
* fix: panic caused by multiple channel closes [#6714](https://github.com/GoogleContainerTools/skaffold/pull/6714)
30+
* fix: sanity check kpt deployer versions [#6711](https://github.com/GoogleContainerTools/skaffold/pull/6711)
31+
32+
Updates and Refactors:
33+
* refactor: move some of `pkg/skaffold/util` into into packages [#6731](https://github.com/GoogleContainerTools/skaffold/pull/6731)
34+
35+
Docs, Test, and Release Updates:
36+
* doc: update CI-CD article to decouple `render` and `deploy` use from GitOps [#6750](https://github.com/GoogleContainerTools/skaffold/pull/6750)
37+
* chore: update image dependencies [#6736](https://github.com/GoogleContainerTools/skaffold/pull/6736)
38+
* chore: use ad-hoc signing on darwin to avoid network popups [#6738](https://github.com/GoogleContainerTools/skaffold/pull/6738)
39+
* chore: add cluster type to the instrumentation meter [#6734](https://github.com/GoogleContainerTools/skaffold/pull/6734)
40+
* chore: Update globstar syntax in examples dependencies [#6614](https://github.com/GoogleContainerTools/skaffold/pull/6614)
41+
* docs: add Cloud Code install instructions [#6716](https://github.com/GoogleContainerTools/skaffold/pull/6716)
42+
43+
Huge thanks goes out to all of our contributors for this release:
44+
45+
- Aaron Prindle
46+
- Brian de Alwis
47+
- Conor A. Callahan
48+
- Dave Dorbin
49+
- Gaurav
50+
- Halvard Skogsrud
51+
- Marlon Gamez
52+
- Mike Verbanic
53+
- Nick Kubala
54+
- Tejal Desai
55+
- Yuwen Ma
56+
157
# v1.33.0 Release - 10/07/2021
258
**Linux**
359
`curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.33.0/skaffold-linux-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin`

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ $(BUILD_DIR)/$(PROJECT): $(STATIK_FILES) $(GO_FILES) $(BUILD_DIR)
7777
$(eval tags = $(GO_BUILD_TAGS_$(GOOS)) $(GO_BUILD_TAGS_$(GOOS)_$(GOARCH)))
7878
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=1 \
7979
go build -gcflags="all=-N -l" -tags "$(tags)" -ldflags "$(ldflags)" -o $@ $(BUILD_PACKAGE)
80+
ifeq ($(GOOS),darwin)
81+
codesign --force --deep --sign - $@
82+
endif
8083

8184
.PHONY: install
8285
install: $(BUILD_DIR)/$(PROJECT)

cmd/skaffold/app/cmd/cmd.go

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func NewSkaffoldCommand(out, errOut io.Writer) *cobra.Command {
195195
rootCmd.AddCommand(NewCmdGeneratePipeline())
196196
rootCmd.AddCommand(NewCmdSurvey())
197197
rootCmd.AddCommand(NewCmdInspect())
198+
rootCmd.AddCommand(NewCmdLint())
198199

199200
templates.ActsAsRootCommand(rootCmd, nil, groups...)
200201
rootCmd.PersistentFlags().StringVarP(&v, "verbosity", "v", log.DefaultLogLevel.String(), fmt.Sprintf("Log level: one of %v", log.AllLevels))

cmd/skaffold/app/cmd/deploy.go

-6
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ import (
2222

2323
"github.com/spf13/cobra"
2424

25-
"github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/flags"
2625
"github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/tips"
2726
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph"
2827
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
2928
latestV1 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest/v1"
3029
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"
3130
)
3231

33-
var (
34-
preBuiltImages flags.Images
35-
)
36-
3732
// NewCmdDeploy describes the CLI command to deploy artifacts.
3833
func NewCmdDeploy() *cobra.Command {
3934
return NewCmd("deploy").
@@ -44,7 +39,6 @@ func NewCmdDeploy() *cobra.Command {
4439
WithExample("Deploy without first rendering the manifests", "deploy --skip-render").
4540
WithCommonFlags().
4641
WithFlags([]*Flag{
47-
{Value: &preBuiltImages, Name: "images", Shorthand: "i", DefValue: nil, Usage: "A list of pre-built images to deploy"},
4842
{Value: &opts.SkipRender, Name: "skip-render", DefValue: false, Usage: "Don't render the manifests, just deploy them", IsEnum: true},
4943
}).
5044
WithHouseKeepingMessages().

cmd/skaffold/app/cmd/flags.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232

3333
var (
3434
fromBuildOutputFile flags.BuildOutputFileFlag
35+
preBuiltImages flags.Images
3536
)
3637

3738
// Nillable is used to reset objects that implement pflag's `Value` and `SliceValue`.
@@ -180,7 +181,7 @@ var flagRegistry = []Flag{
180181
},
181182
{
182183
Name: "wait-for-connection",
183-
Usage: "Blocks execution until the /v2/events gRPC/HTTP endpoint is hit",
184+
Usage: "Blocks ending execution of skaffold until the /v2/events gRPC/HTTP endpoint is hit",
184185
Value: &opts.WaitForConnection,
185186
DefValue: false,
186187
FlagAddMethod: "BoolVar",
@@ -529,8 +530,19 @@ var flagRegistry = []Flag{
529530
Value: &fromBuildOutputFile,
530531
DefValue: "",
531532
FlagAddMethod: "Var",
532-
DefinedOn: []string{"test", "deploy"},
533+
DefinedOn: []string{"deploy", "render", "test"},
533534
},
535+
536+
{
537+
Name: "images",
538+
Shorthand: "i",
539+
Usage: "A list of pre-built images to deploy, either tagged images or NAME=TAG pairs",
540+
Value: &preBuiltImages,
541+
DefValue: nil,
542+
FlagAddMethod: "Var",
543+
DefinedOn: []string{"deploy", "render", "test"},
544+
},
545+
534546
{
535547
Name: "auto-create-config",
536548
Usage: "If true, skaffold will try to create a config for the user's run if it doesn't find one",
@@ -569,7 +581,8 @@ var flagRegistry = []Flag{
569581
"run": true,
570582
},
571583
IsEnum: true,
572-
}, {
584+
},
585+
{
573586
Name: "load-images",
574587
Usage: "If true, skaffold will force load the container images into the local cluster.",
575588
Value: &opts.ForceLoadImages,

cmd/skaffold/app/cmd/lint.go

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright 2021 The Skaffold Authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package cmd
18+
19+
import (
20+
"context"
21+
"io"
22+
23+
"github.com/spf13/cobra"
24+
25+
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/lint"
26+
)
27+
28+
var outFormat string
29+
30+
func NewCmdLint() *cobra.Command {
31+
return NewCmd("lint").
32+
WithDescription("Lints skaffold app skaffold.yaml(s) to improve skaffold's - user-experience, performance, etc..").
33+
WithCommonFlags().
34+
WithFlags([]*Flag{
35+
{Value: &outFormat, Name: "format", DefValue: lint.PlainTextOutput,
36+
Usage: "Output format. One of: plain-text(default) or json"}}).
37+
Hidden().
38+
NoArgs(lintCmd)
39+
}
40+
41+
func lintCmd(ctx context.Context, out io.Writer) error {
42+
return lint.Lint(ctx, out, lint.Options{
43+
Filename: opts.ConfigurationFile,
44+
RepoCacheDir: opts.RepoCacheDir,
45+
OutFormat: outFormat,
46+
Modules: opts.ConfigurationFilter,
47+
Profiles: opts.Profiles,
48+
})
49+
}

cmd/skaffold/app/cmd/render.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ import (
2424

2525
"github.com/spf13/cobra"
2626

27-
"github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/flags"
2827
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph"
2928
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
3029
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"
3130
)
3231

3332
var (
34-
showBuild bool
35-
renderOutputPath string
36-
renderFromBuildOutputFile flags.BuildOutputFileFlag
37-
offline bool
33+
showBuild bool
34+
renderOutputPath string
35+
offline bool
3836
)
3937

4038
// NewCmdRender describes the CLI command to build artifacts render Kubernetes manifests.
@@ -45,7 +43,6 @@ func NewCmdRender() *cobra.Command {
4543
WithCommonFlags().
4644
WithFlags([]*Flag{
4745
{Value: &showBuild, Name: "loud", DefValue: false, Usage: "Show the build logs and output", IsEnum: true},
48-
{Value: &renderFromBuildOutputFile, Name: "build-artifacts", Shorthand: "a", Usage: "File containing build result from a previous 'skaffold build --file-output'"},
4946
{Value: &offline, Name: "offline", DefValue: false, Usage: `Do not connect to Kubernetes API server for manifest creation and validation. This is helpful when no Kubernetes cluster is available (e.g. GitOps model). No metadata.namespace attribute is injected in this case - the manifest content does not get changed.`, IsEnum: true},
5047
{Value: &renderOutputPath, Name: "output", Shorthand: "o", DefValue: "", Usage: "File to write rendered manifests to"},
5148
}).
@@ -62,11 +59,15 @@ func doRender(ctx context.Context, out io.Writer) error {
6259

6360
return withRunner(ctx, out, func(r runner.Runner, configs []util.VersionedConfig) error {
6461
var bRes []graph.Artifact
62+
var err error
6563

66-
if renderFromBuildOutputFile.String() != "" {
67-
bRes = renderFromBuildOutputFile.BuildArtifacts()
64+
if fromBuildOutputFile.String() != "" || len(preBuiltImages.GetSlice()) > 0 {
65+
// pass `nil` as render shouldn't build if provided --build-artifacts or --images
66+
bRes, err = getBuildArtifactsAndSetTags(nil, r.ApplyDefaultRepo)
67+
if err != nil {
68+
return fmt.Errorf("loading artifacts: %w", err)
69+
}
6870
} else {
69-
var err error
7071
bRes, err = r.Build(ctx, buildOut, targetArtifacts(opts, configs))
7172
if err != nil {
7273
return fmt.Errorf("executing build: %w", err)

cmd/skaffold/app/flags/image.go

+10
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ func convertImageToArtifact(value string) (*graph.Artifact, error) {
122122
if value == "" {
123123
return nil, errors.New("cannot add an empty image value")
124124
}
125+
if c := strings.SplitN(value, "=", 2); len(c) == 2 {
126+
_, err := docker.ParseReference(c[1])
127+
if err != nil {
128+
return nil, err
129+
}
130+
return &graph.Artifact{
131+
ImageName: c[0],
132+
Tag: c[1],
133+
}, nil
134+
}
125135
parsed, err := docker.ParseReference(value)
126136
if err != nil {
127137
return nil, err

cmd/skaffold/app/flags/image_test.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,15 @@ func TestImagesFlagSet(t *testing.T) {
7272
},
7373
},
7474
{
75-
description: "set errors with in-correct docker name",
75+
description: "set with name=tag",
76+
setValue: "name=tag",
77+
expectedArtifact: graph.Artifact{
78+
ImageName: "name",
79+
Tag: "tag",
80+
},
81+
},
82+
{
83+
description: "set errors with invalid docker name",
7684
setValue: "docker_:!",
7785
shouldErr: true,
7886
},
@@ -81,6 +89,11 @@ func TestImagesFlagSet(t *testing.T) {
8189
setValue: "",
8290
shouldErr: true,
8391
},
92+
{
93+
description: "set errors with invalid docker name-tag pair",
94+
setValue: "name=docker_:!",
95+
shouldErr: true,
96+
},
8497
}
8598
for _, test := range tests {
8699
testutil.Run(t, test.description, func(t *testutil.T) {
@@ -121,8 +134,8 @@ func TestImagesString(t *testing.T) {
121134
flag.SetNil()
122135
testutil.CheckDeepEqual(t, "", flag.String())
123136

124-
flag.Set("gcr.io/test/test-image:test,gcr.io/test/test-image-1:test")
125-
testutil.CheckDeepEqual(t, "gcr.io/test/test-image:test,gcr.io/test/test-image-1:test", flag.String())
137+
flag.Set("gcr.io/test/test-image:test,gcr.io/test/test-image-1:test,name=tag")
138+
testutil.CheckDeepEqual(t, "gcr.io/test/test-image:test,gcr.io/test/test-image-1:test,name=tag", flag.String())
126139
}
127140

128141
func TestImagesType(t *testing.T) {

cmd/skaffold/app/skaffold.go

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func Run(out, stderr io.Writer) error {
3232
ctx, cancel := context.WithCancel(context.Background())
3333
defer cancel()
3434

35+
catchStackdumpRequests()
3536
catchCtrlC(cancel)
3637

3738
c := cmd.NewSkaffoldCommand(out, stderr)

cmd/skaffold/app/stackdump.go

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//go:build !windows
2+
// +build !windows
3+
4+
/*
5+
Copyright 2021 The Skaffold Authors
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
*/
19+
20+
package app
21+
22+
import (
23+
"fmt"
24+
"os"
25+
"os/signal"
26+
"runtime"
27+
"syscall"
28+
)
29+
30+
func catchStackdumpRequests() {
31+
signals := make(chan os.Signal, 1)
32+
signal.Notify(signals,
33+
syscall.SIGUSR1,
34+
)
35+
36+
go func() {
37+
for {
38+
<-signals
39+
buf := make([]byte, 1<<20)
40+
runtime.Stack(buf, true)
41+
os.Stderr.Write([]byte(fmt.Sprintf("---stacktraces begin: %v---\n", os.Args)))
42+
os.Stderr.Write(buf)
43+
os.Stderr.Write([]byte(fmt.Sprintf("---stacktraces end: %v---\n", os.Args)))
44+
}
45+
}()
46+
}

cmd/skaffold/app/stackdump_windows.go

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//go:build windows
2+
// +build windows
3+
4+
/*
5+
Copyright 2021 The Skaffold Authors
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
*/
19+
20+
package app
21+
22+
func catchStackdumpRequests() {
23+
// ignored on Windows
24+
}

deploy/skaffold/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# This base image has to be updated manually after running `make build_deps`
16-
FROM gcr.io/k8s-skaffold/build_deps:e34c0c143e9fe6c39a4f119547289d7142afcb0d as build
16+
FROM gcr.io/k8s-skaffold/build_deps:cc22ba3ccc5e3f854b540493fc781f7c5a4f5ece as build
1717
WORKDIR /skaffold
1818

1919
FROM build as builder

0 commit comments

Comments
 (0)