Closed kkweon closed 4 years ago
This does sound suspicious.
Hi @kkweon I'm going to close that ticket because it works as intended. The reason why it's not running tests is because the image was already in the cache. Which means it was built and passed the tests the previous time you ran Skaffold. If you want to deacticate caching, you can run skaffold with --cache-artifacts=false
Re-opening because we should make this clear in the UX
@tstromberg what do you have in mind?
As a user I expect the following two:
Checking cache...
- skaffold-example: Found. Tagging (Skipping the tests since nothing has changed. Run with --cache-artifacts=false to invalidate the cache)
TBH I'd prefer the tests to be run unless we run with --skip-tests
. The cached image may be from having run with --skip-tests
.
Further point: our Jib builder does run the in-build tests unless run with --skip-tests
.
So, in this case. we cant to run test even if artifact is found in the cache.
BuildAndTest()
into individual Build()
and Test()
.This will make sure, Build() does nothing when an artifact is cached. Test() should run tests on cached artifact.
From the code, look like we are running tests for cached artifacts
Verify, if this code path is exercised correctly in skaffold build
, skaffold dev
This will work: build_deploy.go
// line 64 onwards
bRes, err := r.cache.Build(ctx, out, tags, artifacts, func(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact) ([]build.Artifact, error) {
if len(artifacts) == 0 {
return nil, nil
}
r.hasBuilt = true
bRes, err := r.builder.Build(ctx, out, tags, artifacts)
if err != nil {
return nil, err
}
- if !r.runCtx.SkipTests() {
- if err = r.tester.Test(ctx, out, bRes); err != nil {
- return nil, err
- }
- }
-
return bRes, nil
})
if err != nil {
return nil, err
}
+ if !r.runCtx.SkipTests() {
+ if err = r.tester.Test(ctx, out, bRes); err != nil {
+ return nil, err
+ }
+ }
Expected behavior
Actual behavior
Information
Skaffold version: v.1.6.0
Operating system
Contents of skaffold.yaml:
Steps to reproduce the behavior