Skip to content

Commit 6a0bc1b

Browse files
committed
remove v1 interfaces and simplify code
1 parent fb6b62e commit 6a0bc1b

File tree

16 files changed

+44
-109
lines changed

16 files changed

+44
-109
lines changed

cmd/skaffold/app/cmd/runner.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ import (
3333
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/output/log"
3434
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/parser"
3535
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
36-
runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext/v2"
37-
v2 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/v2"
36+
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext"
3837
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/defaults"
3938
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
4039
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"

pkg/skaffold/runner/v2/apply.go renamed to pkg/skaffold/runner/apply.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"

pkg/skaffold/runner/v2/cleanup.go renamed to pkg/skaffold/runner/cleanup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"

pkg/skaffold/runner/v2/deploy.go renamed to pkg/skaffold/runner/deploy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"

pkg/skaffold/runner/v2/deploy_test.go renamed to pkg/skaffold/runner/deploy_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"bytes"
@@ -29,7 +29,6 @@ import (
2929
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph"
3030
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/client"
3131
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/manifest"
32-
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
3332
runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext/v2"
3433
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
3534
"github.com/GoogleContainerTools/skaffold/testutil"
@@ -79,7 +78,7 @@ func TestSkaffoldDeployRenderOnly(t *testing.T) {
7978
KubeContext: "does-not-exist",
8079
}
8180

82-
deployer, err := runner.GetDeployer(context.Background(), runCtx, nil, "", false)
81+
deployer, err := GetDeployer(context.Background(), runCtx, nil, "", false)
8382
t.RequireNoError(err)
8483
r := SkaffoldRunner{
8584
runCtx: runCtx,

pkg/skaffold/runner/v2/dev.go renamed to pkg/skaffold/runner/dev.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"
@@ -31,7 +31,6 @@ import (
3131
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/instrumentation"
3232
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/output"
3333
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/output/log"
34-
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
3534
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
3635
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync"
3736
timeutil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util/time"
@@ -50,7 +49,7 @@ func (r *SkaffoldRunner) doDev(ctx context.Context, out io.Writer) error {
5049
defer r.intents.Reset()
5150

5251
if r.changeSet.NeedsReload() {
53-
return runner.ErrorConfigurationChanged
52+
return ErrorConfigurationChanged
5453
}
5554

5655
buildIntent, syncIntent, deployIntent := r.intents.GetIntents()

pkg/skaffold/runner/v2/dev_test.go renamed to pkg/skaffold/runner/dev_test.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"
@@ -30,7 +30,6 @@ import (
3030
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker"
3131
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/filemon"
3232
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/client"
33-
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
3433
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
3534
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync"
3635
"github.com/GoogleContainerTools/skaffold/testutil"
@@ -339,7 +338,7 @@ func TestDevAutoTriggers(t *testing.T) {
339338
expectedActions []Actions
340339
autoTriggers triggerState // the state of auto triggers
341340
singleTriggers triggerState // the state of single intent triggers at the end of dev loop
342-
userIntents []func(i *runner.Intents)
341+
userIntents []func(i *Intents)
343342
}{
344343
{
345344
description: "build on; sync on; deploy on",
@@ -410,8 +409,8 @@ func TestDevAutoTriggers(t *testing.T) {
410409
autoTriggers: triggerState{false, false, false},
411410
singleTriggers: triggerState{false, false, false},
412411
expectedActions: []Actions{},
413-
userIntents: []func(i *runner.Intents){
414-
func(i *runner.Intents) {
412+
userIntents: []func(i *Intents){
413+
func(i *Intents) {
415414
i.SetBuild(true)
416415
},
417416
},
@@ -422,8 +421,8 @@ func TestDevAutoTriggers(t *testing.T) {
422421
autoTriggers: triggerState{false, false, false},
423422
singleTriggers: triggerState{false, false, false},
424423
expectedActions: []Actions{},
425-
userIntents: []func(i *runner.Intents){
426-
func(i *runner.Intents) {
424+
userIntents: []func(i *Intents){
425+
func(i *Intents) {
427426
i.SetBuild(true)
428427
i.SetSync(true)
429428
},
@@ -435,11 +434,11 @@ func TestDevAutoTriggers(t *testing.T) {
435434
autoTriggers: triggerState{false, false, false},
436435
singleTriggers: triggerState{false, false, false},
437436
expectedActions: []Actions{},
438-
userIntents: []func(i *runner.Intents){
439-
func(i *runner.Intents) {
437+
userIntents: []func(i *Intents){
438+
func(i *Intents) {
440439
i.SetBuild(true)
441440
},
442-
func(i *runner.Intents) {
441+
func(i *Intents) {
443442
i.SetSync(true)
444443
},
445444
},

pkg/skaffold/runner/v2/generate_pipeline.go renamed to pkg/skaffold/runner/generate_pipeline.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
package v2
16+
package runner
1717

1818
import (
1919
"context"

pkg/skaffold/runner/v2/new.go renamed to pkg/skaffold/runner/new.go

+12-13
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"
@@ -32,7 +32,6 @@ import (
3232
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/instrumentation"
3333
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/output/log"
3434
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/platform"
35-
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
3635
runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext/v2"
3736
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
3837
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/server"
@@ -81,13 +80,13 @@ func NewForConfig(ctx context.Context, runCtx *runcontext.RunContext) (*Skaffold
8180
return nil, fmt.Errorf("getting render output path: %w", err)
8281
}
8382

84-
renderer, err := runner.GetRenderer(ctx, runCtx, hydrationDir, labeller.Labels(), runCtx.UsingLegacyHelmDeploy())
83+
renderer, err := GetRenderer(ctx, runCtx, hydrationDir, labeller.Labels(), runCtx.UsingLegacyHelmDeploy())
8584
if err != nil {
8685
endTrace(instrumentation.TraceEndError(err))
8786
return nil, fmt.Errorf("creating renderer: %w", err)
8887
}
8988

90-
deployer, err = runner.GetDeployer(ctx, runCtx, labeller, hydrationDir, runCtx.UsingLegacyHelmDeploy())
89+
deployer, err = GetDeployer(ctx, runCtx, labeller, hydrationDir, runCtx.UsingLegacyHelmDeploy())
9190
if err != nil {
9291
endTrace(instrumentation.TraceEndError(err))
9392
return nil, fmt.Errorf("creating deployer: %w", err)
@@ -99,7 +98,7 @@ func NewForConfig(ctx context.Context, runCtx *runcontext.RunContext) (*Skaffold
9998
}
10099

101100
var verifier verify.Verifier
102-
verifier, err = runner.GetVerifier(ctx, runCtx, labeller)
101+
verifier, err = GetVerifier(ctx, runCtx, labeller)
103102
if err != nil {
104103
endTrace(instrumentation.TraceEndError(err))
105104
return nil, fmt.Errorf("creating verifier: %w", err)
@@ -109,7 +108,7 @@ func NewForConfig(ctx context.Context, runCtx *runcontext.RunContext) (*Skaffold
109108
// the Cluster object on the RunContext, which in turn influences whether or not we will push images.
110109
var builder build.Builder
111110
builder, err = build.NewBuilderMux(runCtx, store, func(p latest.Pipeline) (build.PipelineBuilder, error) {
112-
return runner.GetBuilder(ctx, runCtx, store, sourceDependencies, p)
111+
return GetBuilder(ctx, runCtx, store, sourceDependencies, p)
113112
})
114113
if err != nil {
115114
endTrace(instrumentation.TraceEndError(err))
@@ -140,9 +139,9 @@ func NewForConfig(ctx context.Context, runCtx *runcontext.RunContext) (*Skaffold
140139
return nil, fmt.Errorf("initializing cache: %w", err)
141140
}
142141

143-
builder, tester, renderer, deployer = runner.WithTimings(builder, tester, renderer, deployer, runCtx.CacheArtifacts())
142+
builder, tester, renderer, deployer = WithTimings(builder, tester, renderer, deployer, runCtx.CacheArtifacts())
144143
if runCtx.Notification() {
145-
deployer = runner.WithNotification(deployer)
144+
deployer = WithNotification(deployer)
146145
}
147146

148147
monitor := filemon.NewMonitor()
@@ -153,16 +152,16 @@ func NewForConfig(ctx context.Context, runCtx *runcontext.RunContext) (*Skaffold
153152
return nil, fmt.Errorf("creating watch trigger: %w", err)
154153
}
155154

156-
rbuilder := runner.NewBuilder(builder, tagger, platforms, artifactCache, runCtx)
155+
rbuilder := NewBuilder(builder, tagger, platforms, artifactCache, runCtx)
157156
return &SkaffoldRunner{
158157
Builder: *rbuilder,
159-
Pruner: runner.Pruner{Builder: builder},
158+
Pruner: Pruner{Builder: builder},
160159
renderer: renderer,
161160
tester: tester,
162161
deployer: deployer,
163162
platforms: platforms,
164163
monitor: monitor,
165-
listener: runner.NewSkaffoldListener(monitor, rtrigger, sourceDependencies, intentChan),
164+
listener: NewSkaffoldListener(monitor, rtrigger, sourceDependencies, intentChan),
166165
artifactStore: store,
167166
sourceDependencies: sourceDependencies,
168167
labeller: labeller,
@@ -174,8 +173,8 @@ func NewForConfig(ctx context.Context, runCtx *runcontext.RunContext) (*Skaffold
174173
}, nil
175174
}
176175

177-
func setupIntents(runCtx *runcontext.RunContext) (*runner.Intents, chan bool) {
178-
intents := runner.NewIntents(runCtx.AutoBuild(), runCtx.AutoSync(), runCtx.AutoDeploy())
176+
func setupIntents(runCtx *runcontext.RunContext) (*Intents, chan bool) {
177+
intents := NewIntents(runCtx.AutoBuild(), runCtx.AutoSync(), runCtx.AutoDeploy())
179178

180179
intentChan := make(chan bool, 1)
181180
setupTrigger("build", intents.SetBuild, intents.SetAutoBuild, intents.GetAutoBuild, server.SetBuildCallback, server.SetAutoBuildCallback, intentChan)

pkg/skaffold/runner/v2/render.go renamed to pkg/skaffold/runner/render.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"

pkg/skaffold/runner/runcontext/v2/context.go renamed to pkg/skaffold/runner/runcontext/context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runcontext
1818

1919
import (
2020
"context"

pkg/skaffold/runner/runner.go

+5
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ type Runner interface {
5050
Verify(context.Context, io.Writer, []graph.Artifact) error
5151
VerifyAndLog(context.Context, io.Writer, []graph.Artifact) error
5252
}
53+
54+
// DeployManifests returns a list of manifest if this runner has deployed something.
55+
func (r *SkaffoldRunner) DeployManifests() manifest.ManifestListByConfig {
56+
return r.deployManifests
57+
}

pkg/skaffold/runner/v2/runner_test.go renamed to pkg/skaffold/runner/runner_test.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"
@@ -41,8 +41,7 @@ import (
4141
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/render/generate"
4242
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/render/renderer"
4343
kRenderer "github.com/GoogleContainerTools/skaffold/pkg/skaffold/render/renderer/kubectl"
44-
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
45-
runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext/v2"
44+
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext"
4645
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/defaults"
4746
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
4847
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/status"
@@ -68,8 +67,8 @@ type TestBench struct {
6867
renderErrors []error
6968
deployErrors []error
7069
namespaces []string
71-
userIntents []func(*runner.Intents)
72-
intents *runner.Intents
70+
userIntents []func(*Intents)
71+
intents *Intents
7372
intentTrigger bool
7473

7574
devLoop func(context.Context, io.Writer, func() error) error
@@ -567,7 +566,7 @@ func TestNewForConfig(t *testing.T) {
567566
cfg, err := NewForConfig(context.Background(), runCtx)
568567
t.CheckError(tt.shouldErr, err)
569568
if cfg != nil {
570-
b, _t, r, d := runner.WithTimings(&tt.expectedBuilder, tt.expectedTester, tt.expectedRenderer,
569+
b, _t, r, d := WithTimings(&tt.expectedBuilder, tt.expectedTester, tt.expectedRenderer,
571570
tt.expectedDeployer, tt.cacheArtifacts)
572571
if tt.shouldErr {
573572
t.CheckError(true, err)

pkg/skaffold/runner/v2/test.go renamed to pkg/skaffold/runner/test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package runner
1818

1919
import (
2020
"context"

pkg/skaffold/runner/v2/runner.go

-64
This file was deleted.

0 commit comments

Comments
 (0)