Repository: GoogleContainerTools/skaffold
Pull request #7107 (2022-02-14 20:04:59)

fix: correctly handle excluded profiles
Fixes: #7084
**Alternative implemetation to PR #7099**

**Description**
As mentioned in #7099, that implementation is checking for every profile loaded, which does not work. The problem is that since each file is processed in a "bubble", we never have a full picture of all the profiles in order to check the command line flags. I added such a list to the record, such that we can check all the opts profiles against the config files after all files have been loaded.

What do you think of this solution @gsquared94?

This is sort of WIP, I can try to add an integration test in a follow up PR, as requested by @MarlonGamez 




codecov[bot]: # [Codecov](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) Report
> Merging [#7107](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) (3007972) into [main](https://codecov.io/gh/GoogleContainerTools/skaffold/commit/290280e8c6c19231e9ed5b5c027f2c01d22f75be?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) (290280e) will **decrease** coverage by `1.89%`.
> The diff coverage is `56.96%`.

[![Impacted file tree graph](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/graphs/tree.svg?width=650&height=150&src=pr&token=mVPJs21wYu&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools)](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools)

```diff
@@            Coverage Diff             @@
##             main    #7107      +/-   ##
==========================================
- Coverage   70.48%   68.58%   -1.90%     
==========================================
  Files         515      558      +43     
  Lines       23150    26085    +2935     
==========================================
+ Hits        16317    17891    +1574     
- Misses       5776     6954    +1178     
- Partials     1057     1240     +183     
```


| [Impacted Files](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) | Coverage Δ | |
|---|---|---|
| [cmd/skaffold/app/cmd/deploy.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvZGVwbG95Lmdv) | `52.00% <ø> (-1.85%)` | :arrow_down: |
| [cmd/skaffold/app/cmd/dev.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvZGV2Lmdv) | `84.61% <0.00%> (ø)` | |
| [cmd/skaffold/app/cmd/render.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvcmVuZGVyLmdv) | `36.66% <0.00%> (-4.72%)` | :arrow_down: |
| [cmd/skaffold/skaffold.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL3NrYWZmb2xkLmdv) | `0.00% <0.00%> (ø)` | |
| [cmd/skaffold/app/cmd/inspect\_tests.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvaW5zcGVjdF90ZXN0cy5nbw==) | `62.50% <14.28%> (-1.14%)` | :arrow_down: |
| [cmd/skaffold/app/cmd/lsp.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvbHNwLmdv) | `28.12% <28.12%> (ø)` | |
| [cmd/skaffold/app/cmd/fix.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvZml4Lmdv) | `68.85% <40.00%> (-7.62%)` | :arrow_down: |
| [cmd/skaffold/app/cmd/lint.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvbGludC5nbw==) | `42.85% <42.85%> (ø)` | |
| [cmd/skaffold/app/cmd/find\_configs.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvZmluZF9jb25maWdzLmdv) | `48.88% <50.00%> (+0.24%)` | :arrow_up: |
| [cmd/skaffold/app/skaffold.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9za2FmZm9sZC5nbw==) | `76.19% <70.00%> (-8.43%)` | :arrow_down: |
| ... and [206 more](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools). Last update [35ec779...3007972](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/7107?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools).


Patch:
diff --git a/ROADMAP.md b/ROADMAP.md
index 5378db2ea..17a53d655 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,5 +1,5 @@
-# 2021 Roadmap
-Last updated: 03/09/2021
+# 2022 Roadmap
+Last updated: 02/15/2022
 
 **What this roadmap is**
 
@@ -15,21 +15,18 @@ Feedback! We want to hear from each and every one of you: what are you personall
 
 # Product Excellence
 ### Improve Developer Experience for Helm Users
-### Identify and Address Performance Bottlenecks
+### Improve Skaffold Onboarding docs
+### Revamp skaffold configuration to dissociate configuration from phase they are used and improve configuration reusability across modules.
 
 # CI/CD
 ### Create a Clearer Separation of Manifest Management (`render`) and Deployment (`deploy`) Phases
+### Post deployments tests
+
 
 # User Experience and Extensibility
-### Pre- and Post- Phase Hooks
-### Deploy Directly to Docker
-### Multi-Architecture Container Builds
-### Terminal UX Improvements
-### Extensible Skaffold API
-
-# Diagnostics and Debugging
-### Improve Python Debug Support
-### Improve Developer Assistance For Failures to Run/Debug Apps
+### Enable users to perform Cross Platform and Multi-Architecture Container Builds
+### Polish Skaffold's Deployer platform extensibility.
+
 
 # OSS Health and Community Engagement
 ### Reduce PR Review Latency
diff --git a/cmd/skaffold/app/cmd/flags.go b/cmd/skaffold/app/cmd/flags.go
index b3d1ca0ae..38adfe044 100644
--- a/cmd/skaffold/app/cmd/flags.go
+++ b/cmd/skaffold/app/cmd/flags.go
@@ -316,11 +316,10 @@ var flagRegistry = []Flag{
 		Name:          "status-check",
 		Usage:         "Wait for deployed resources to stabilize",
 		Value:         &opts.StatusCheck,
-		DefValue:      true,
+		DefValue:      nil,
 		FlagAddMethod: "Var",
 		DefinedOn:     []string{"dev", "debug", "deploy", "run", "apply"},
 		IsEnum:        true,
-		NoOptDefVal:   "true",
 	},
 	{
 		Name:          "iterative-status-check",
diff --git a/docs/content/en/docs/references/cli/_index.md b/docs/content/en/docs/references/cli/_index.md
index 64e0e394d..01c1c3091 100644
--- a/docs/content/en/docs/references/cli/_index.md
+++ b/docs/content/en/docs/references/cli/_index.md
@@ -130,7 +130,7 @@ Options:
   -n, --namespace='': Run deployments in the specified namespace
   -p, --profile=[]: Activate profiles by name (prefixed with `-` to disable a profile)
       --remote-cache-dir='': Specify the location of the git repositories cache (default $HOME/.skaffold/repos)
-      --status-check=true: Wait for deployed resources to stabilize
+      --status-check=: Wait for deployed resources to stabilize
       --sync-remote-cache='always': Controls how Skaffold manages the remote config cache (see `remote-cache-dir`). One of `always` (default), `missing`, or `never`. `always` syncs remote repositories to latest on access. `missing` only clones remote repositories if they do not exist locally. `never` means the user takes responsibility for updating remote repositories.
       --tail=false: Stream logs from deployed objects
       --wait-for-connection=false: Blocks ending execution of skaffold until the /v2/events gRPC/HTTP endpoint is hit
@@ -425,7 +425,7 @@ Options:
       --rpc-http-port=: tcp port to expose the Skaffold API over HTTP REST
       --rpc-port=: tcp port to expose the Skaffold API over gRPC
       --skip-tests=false: Whether to skip the tests after building
-      --status-check=true: Wait for deployed resources to stabilize
+      --status-check=: Wait for deployed resources to stabilize
       --sync-remote-cache='always': Controls how Skaffold manages the remote config cache (see `remote-cache-dir`). One of `always` (default), `missing`, or `never`. `always` syncs remote repositories to latest on access. `missing` only clones remote repositories if they do not exist locally. `never` means the user takes responsibility for updating remote repositories.
   -t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
       --tail=true: Stream logs from deployed objects
@@ -591,7 +591,7 @@ Options:
       --rpc-http-port=: tcp port to expose the Skaffold API over HTTP REST
       --rpc-port=: tcp port to expose the Skaffold API over gRPC
       --skip-render=false: Don't render the manifests, just deploy them
-      --status-check=true: Wait for deployed resources to stabilize
+      --status-check=: Wait for deployed resources to stabilize
       --sync-remote-cache='always': Controls how Skaffold manages the remote config cache (see `remote-cache-dir`). One of `always` (default), `missing`, or `never`. `always` syncs remote repositories to latest on access. `missing` only clones remote repositories if they do not exist locally. `never` means the user takes responsibility for updating remote repositories.
   -t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
       --tail=false: Stream logs from deployed objects
@@ -687,7 +687,7 @@ Options:
       --rpc-http-port=: tcp port to expose the Skaffold API over HTTP REST
       --rpc-port=: tcp port to expose the Skaffold API over gRPC
       --skip-tests=false: Whether to skip the tests after building
-      --status-check=true: Wait for deployed resources to stabilize
+      --status-check=: Wait for deployed resources to stabilize
       --sync-remote-cache='always': Controls how Skaffold manages the remote config cache (see `remote-cache-dir`). One of `always` (default), `missing`, or `never`. `always` syncs remote repositories to latest on access. `missing` only clones remote repositories if they do not exist locally. `never` means the user takes responsibility for updating remote repositories.
   -t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
       --tail=true: Stream logs from deployed objects
@@ -1012,7 +1012,7 @@ Options:
       --rpc-http-port=: tcp port to expose the Skaffold API over HTTP REST
       --rpc-port=: tcp port to expose the Skaffold API over gRPC
       --skip-tests=false: Whether to skip the tests after building
-      --status-check=true: Wait for deployed resources to stabilize
+      --status-check=: Wait for deployed resources to stabilize
       --sync-remote-cache='always': Controls how Skaffold manages the remote config cache (see `remote-cache-dir`). One of `always` (default), `missing`, or `never`. `always` syncs remote repositories to latest on access. `missing` only clones remote repositories if they do not exist locally. `never` means the user takes responsibility for updating remote repositories.
   -t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
       --tail=false: Stream logs from deployed objects
diff --git a/examples/buildpacks-python/requirements.txt b/examples/buildpacks-python/requirements.txt
index e433f90ba..f21b24b41 100644
--- a/examples/buildpacks-python/requirements.txt
+++ b/examples/buildpacks-python/requirements.txt
@@ -1,1 +1,1 @@
-Flask==2.0.2
+Flask==2.0.3
diff --git a/examples/google-cloud-build/skaffold.yaml b/examples/google-cloud-build/skaffold.yaml
index a76c19acb..b5fcd1b5d 100644
--- a/examples/google-cloud-build/skaffold.yaml
+++ b/examples/google-cloud-build/skaffold.yaml
@@ -2,6 +2,7 @@ apiVersion: skaffold/v2beta27
 kind: Config
 build:
   googleCloudBuild:
+    # Change `k8s-skaffold` with your PROJECT_ID
     projectId: k8s-skaffold
   artifacts:
   - image: skaffold-example
diff --git a/examples/ruby/backend/Gemfile.lock b/examples/ruby/backend/Gemfile.lock
index a8f6200e3..653faa93d 100644
--- a/examples/ruby/backend/Gemfile.lock
+++ b/examples/ruby/backend/Gemfile.lock
@@ -2,7 +2,7 @@ GEM
   remote: https://rubygems.org/
   specs:
     nio4r (2.5.8)
-    puma (4.3.9)
+    puma (4.3.11)
       nio4r (~> 2.0)
     rack (2.1.4)
     rack-unreloader (1.7.0)
diff --git a/go.mod b/go.mod
index bdea48dc3..dd85b98d7 100644
--- a/go.mod
+++ b/go.mod
@@ -16,7 +16,6 @@ replace (
 	k8s.io/apimachinery => k8s.io/apimachinery v0.21.3
 )
 
-// TODO(bdealwis)[10/07/2021] CVE-2021-41103: pin github.com/containerd/containerd v1.5.7
 // TODO(bdealwis)[10/07/2021] CVE-2021-30465: pin github.com/opencontainers/runc v1.0.2
 // TODO(bdealwis)[10/07/2021] GO-2021-0113: pin golang.org/x/text v0.3.7
 
@@ -36,8 +35,9 @@ require (
 	github.com/buildpacks/lifecycle v0.13.1
 	github.com/buildpacks/pack v0.23.0
 	github.com/cenkalti/backoff/v4 v4.1.1
+	github.com/containerd/containerd v1.5.8
 	github.com/docker/cli v20.10.11+incompatible
-	github.com/docker/distribution v2.7.1+incompatible
+	github.com/docker/distribution v2.8.0+incompatible
 	github.com/docker/docker v20.10.11+incompatible
 	github.com/docker/go-connections v0.4.0
 	github.com/dustin/go-humanize v1.0.0
@@ -59,7 +59,6 @@ require (
 	github.com/krishicks/yaml-patch v0.0.10
 	github.com/mattn/go-colorable v0.1.12
 	github.com/mitchellh/go-homedir v1.1.0
-	// github.com/moby/buildkit v0.7.1
 	github.com/moby/buildkit v0.8.0
 	github.com/opencontainers/go-digest v1.0.0
 	github.com/opencontainers/image-spec v1.0.2
@@ -136,7 +135,6 @@ require (
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/bits-and-blooms/bitset v1.2.0 // indirect
 	github.com/cespare/xxhash/v2 v2.1.1 // indirect
-	github.com/containerd/containerd v1.5.8 // indirect
 	github.com/containerd/stargz-snapshotter/estargz v0.10.1 // indirect
 	github.com/containerd/ttrpc v1.1.0 // indirect
 	github.com/containerd/typeurl v1.0.2 // indirect
diff --git a/go.sum b/go.sum
index 0cd55b815..6b3729380 100644
--- a/go.sum
+++ b/go.sum
@@ -527,8 +527,9 @@ github.com/docker/cli v20.10.11+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hH
 github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
 github.com/docker/distribution v2.6.0-rc.1.0.20180327202408-83389a148052+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
 github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
-github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
 github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
+github.com/docker/distribution v2.8.0+incompatible h1:l9EaZDICImO1ngI+uTifW+ZYvvz7fKISBAKpg+MbWbY=
+github.com/docker/distribution v2.8.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
 github.com/docker/docker v0.0.0-20200511152416-a93e9eb0e95c/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
 github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
 github.com/docker/docker v1.4.2-0.20180531152204-71cd53e4a197/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
@@ -1303,7 +1304,6 @@ github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/
 github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
 github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
 github.com/opencontainers/runtime-spec v1.0.3-0.20200728170252-4d89ac9fbff6/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
-github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d h1:pNa8metDkwZjb9g4T8s+krQ+HRgZAkqnXml+wNir/+s=
 github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
 github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
 github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs=
diff --git a/integration/examples/buildpacks-python/requirements.txt b/integration/examples/buildpacks-python/requirements.txt
index e433f90ba..f21b24b41 100644
--- a/integration/examples/buildpacks-python/requirements.txt
+++ b/integration/examples/buildpacks-python/requirements.txt
@@ -1,1 +1,1 @@
-Flask==2.0.2
+Flask==2.0.3
diff --git a/integration/examples/gcb-kaniko/skaffold.yaml b/integration/examples/gcb-kaniko/skaffold.yaml
index 73df20288..f4a754068 100644
--- a/integration/examples/gcb-kaniko/skaffold.yaml
+++ b/integration/examples/gcb-kaniko/skaffold.yaml
@@ -2,6 +2,7 @@ apiVersion: skaffold/v2beta27
 kind: Config
 build:
   googleCloudBuild:
+    # Change `k8s-skaffold` with your PROJECT_ID
     projectId: k8s-skaffold
   artifacts:
   - image: skaffold-example
diff --git a/integration/examples/google-cloud-build/skaffold.yaml b/integration/examples/google-cloud-build/skaffold.yaml
index a76c19acb..b5fcd1b5d 100644
--- a/integration/examples/google-cloud-build/skaffold.yaml
+++ b/integration/examples/google-cloud-build/skaffold.yaml
@@ -2,6 +2,7 @@ apiVersion: skaffold/v2beta27
 kind: Config
 build:
   googleCloudBuild:
+    # Change `k8s-skaffold` with your PROJECT_ID
     projectId: k8s-skaffold
   artifacts:
   - image: skaffold-example
diff --git a/integration/examples/ruby/backend/Gemfile.lock b/integration/examples/ruby/backend/Gemfile.lock
index a8f6200e3..653faa93d 100644
--- a/integration/examples/ruby/backend/Gemfile.lock
+++ b/integration/examples/ruby/backend/Gemfile.lock
@@ -2,7 +2,7 @@ GEM
   remote: https://rubygems.org/
   specs:
     nio4r (2.5.8)
-    puma (4.3.9)
+    puma (4.3.11)
       nio4r (~> 2.0)
     rack (2.1.4)
     rack-unreloader (1.7.0)
diff --git a/pkg/skaffold/docker/image.go b/pkg/skaffold/docker/image.go
index b16d91744..bbb468970 100644
--- a/pkg/skaffold/docker/image.go
+++ b/pkg/skaffold/docker/image.go
@@ -540,6 +540,10 @@ func (l *localDaemon) TagWithImageID(ctx context.Context, ref string, imageID st
 		return "", err
 	}
 
+	if imageID == "" {
+		log.Entry(ctx).Debugf("generating tag for %s: empty image id\n", ref)
+		return "", nil
+	}
 	uniqueTag := parsed.BaseName + ":" + strings.TrimPrefix(imageID, "sha256:")
 	if err := l.Tag(ctx, imageID, uniqueTag); err != nil {
 		return "", err
diff --git a/pkg/skaffold/git/gitutil.go b/pkg/skaffold/git/gitutil.go
index b2e61da59..232a52377 100644
--- a/pkg/skaffold/git/gitutil.go
+++ b/pkg/skaffold/git/gitutil.go
@@ -160,21 +160,7 @@ func syncRepo(ctx context.Context, g latestV1.GitInfo, opts config.SkaffoldOptio
 			return "", fmt.Errorf("failed to clone repo %s: unable to find any matching refs %s; run 'git clone <REPO>; stat <DIR/SUBDIR>' to verify credentials: %w", g.Repo, ref, err)
 		}
 
-		// check if the downloaded repo has uncommitted changes.
-		if changes, err := r.Run(ctx, "diff", "--name-only", "--ignore-submodules", "HEAD"); err != nil {
-			return "", fmt.Errorf("failed to clone repo %s: unable to check for uncommitted changes; run 'git clone <REPO>; stat <DIR/SUBDIR>' to verify credentials: %w", g.Repo, err)
-		} else if len(changes) > 0 {
-			return "", fmt.Errorf("failed to clone repo %s: there are uncommitted changes in the target directory %s; either set the repository `sync` property to false in the skaffold config, or manually commit and sync changes to remote, or revert the local changes", g.Repo, repoCacheDir)
-		}
-
-		// check if the downloaded repo has unpushed commits.
-		if changes, err := r.Run(ctx, "diff", "--name-only", "--ignore-submodules", fmt.Sprintf("origin/%s...", ref)); err != nil {
-			return "", fmt.Errorf("failed to clone repo %s: unable to check for unpushed commits; run 'git clone <REPO>; stat <DIR/SUBDIR>' to verify credentials: %w", g.Repo, err)
-		} else if len(changes) > 0 {
-			return "", fmt.Errorf("failed to clone repo %s: there are unpushed commits in the target directory %s; either set the repository `sync` property to false in the skaffold config, or manually push commits to remote, or reset the local commits", g.Repo, repoCacheDir)
-		}
-
-		// reset the repo state
+		// Sync option is either nil or true, so we are resetting the repo
 		if _, err := r.Run(ctx, "reset", "--hard", fmt.Sprintf("origin/%s", ref)); err != nil {
 			return "", fmt.Errorf("failed to clone repo %s: trouble resetting branch to origin/%s; run 'git clone <REPO>; stat <DIR/SUBDIR>' to verify credentials: %w", g.Repo, ref, err)
 		}
diff --git a/pkg/skaffold/kubernetes/manifest/visitor.go b/pkg/skaffold/kubernetes/manifest/visitor.go
index f583843ad..c9db7e8a5 100644
--- a/pkg/skaffold/kubernetes/manifest/visitor.go
+++ b/pkg/skaffold/kubernetes/manifest/visitor.go
@@ -27,20 +27,23 @@ import (
 
 // transformableAllowlist is the set of kinds that can be transformed by Skaffold.
 var transformableAllowlist = map[apimachinery.GroupKind]bool{
-	{Group: "", Kind: "Pod"}:                        true,
-	{Group: "apps", Kind: "DaemonSet"}:              true,
-	{Group: "apps", Kind: "Deployment"}:             true, // v1beta1, v1beta2: deprecated in K8s 1.9, removed in 1.16
-	{Group: "apps", Kind: "ReplicaSet"}:             true,
-	{Group: "apps", Kind: "StatefulSet"}:            true,
-	{Group: "batch", Kind: "CronJob"}:               true,
-	{Group: "batch", Kind: "Job"}:                   true,
-	{Group: "extensions", Kind: "DaemonSet"}:        true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
-	{Group: "extensions", Kind: "Deployment"}:       true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
-	{Group: "extensions", Kind: "ReplicaSet"}:       true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
-	{Group: "serving.knative.dev", Kind: "Service"}: true,
-	{Group: "agones.dev", Kind: "Fleet"}:            true,
-	{Group: "agones.dev", Kind: "GameServer"}:       true,
-	{Group: "argoproj.io", Kind: "Rollout"}:         true,
+	{Group: "", Kind: "Pod"}:                                true,
+	{Group: "apps", Kind: "DaemonSet"}:                      true,
+	{Group: "apps", Kind: "Deployment"}:                     true, // v1beta1, v1beta2: deprecated in K8s 1.9, removed in 1.16
+	{Group: "apps", Kind: "ReplicaSet"}:                     true,
+	{Group: "apps", Kind: "StatefulSet"}:                    true,
+	{Group: "batch", Kind: "CronJob"}:                       true,
+	{Group: "batch", Kind: "Job"}:                           true,
+	{Group: "extensions", Kind: "DaemonSet"}:                true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
+	{Group: "extensions", Kind: "Deployment"}:               true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
+	{Group: "extensions", Kind: "ReplicaSet"}:               true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
+	{Group: "serving.knative.dev", Kind: "Service"}:         true,
+	{Group: "agones.dev", Kind: "Fleet"}:                    true,
+	{Group: "agones.dev", Kind: "GameServer"}:               true,
+	{Group: "argoproj.io", Kind: "Rollout"}:                 true,
+	{Group: "argoproj.io", Kind: "ClusterWorkflowTemplate"}: true,
+	{Group: "argoproj.io", Kind: "Workflow"}:                true,
+	{Group: "argoproj.io", Kind: "WorkflowTemplate"}:        true,
 }
 
 // FieldVisitor represents the aggregation/transformation that should be performed on each traversed field.
diff --git a/pkg/skaffold/parser/config.go b/pkg/skaffold/parser/config.go
index 5a93566d0..d08e3e556 100644
--- a/pkg/skaffold/parser/config.go
+++ b/pkg/skaffold/parser/config.go
@@ -57,6 +57,7 @@ type record struct {
 	appliedProfiles  map[string]string      // config -> list of applied profiles
 	configNameToFile map[string]string      // configName -> file path
 	cachedRepos      map[string]interface{} // git repo -> cache path or error
+	allProfiles      []string               // list of all profiles, from all configuration files
 }
 
 func newRecord() *record {
@@ -92,7 +93,7 @@ func GetConfigSet(ctx context.Context, opts config.SkaffoldOptions) (SkaffoldCon
 		return nil, sErrors.ZeroConfigsParsedErr(opts.ConfigurationFile)
 	}
 
-	if unmatched := unmatchedProfiles(r.appliedProfiles, opts.Profiles); len(unmatched) != 0 {
+	if unmatched := unmatchedProfiles(r.allProfiles, opts.Profiles); len(unmatched) != 0 {
 		return nil, sErrors.ConfigProfilesNotMatchedErr(unmatched)
 	}
 
@@ -130,10 +131,17 @@ func getConfigs(ctx context.Context, cfgOpts configOpts, opts config.SkaffoldOpt
 	}
 	log.Entry(context.TODO()).Debugf("parsed %d configs from configuration file %s", len(parsed), cfgOpts.file)
 
-	// validate that config names are unique if specified
+	// add profiles to record and validate that config names are unique if specified
 	seen := make(map[string]bool)
 	for _, cfg := range parsed {
-		cfgName := cfg.(*latestV1.SkaffoldConfig).Metadata.Name
+		config := cfg.(*latestV1.SkaffoldConfig)
+		for _, profile := range config.Profiles {
+			if !stringslice.Contains(r.allProfiles, profile.Name) {
+				r.allProfiles = append(r.allProfiles, profile.Name)
+			}
+		}
+
+		cfgName := config.Metadata.Name
 		if cfgName == "" {
 			continue
 		}
@@ -342,14 +350,10 @@ func checkRevisit(config *latestV1.SkaffoldConfig, profiles []string, appliedPro
 	return false, nil
 }
 
-func unmatchedProfiles(activatedProfiles map[string]string, allProfiles []string) []string {
-	var allActivated []string
-	for _, profiles := range activatedProfiles {
-		allActivated = append(allActivated, strings.Split(profiles, ",")...)
-	}
+func unmatchedProfiles(configProfiles []string, optsProfiles []string) []string {
 	var unmatched []string
-	for _, p := range allProfiles {
-		if !stringslice.Contains(allActivated, p) {
+	for _, p := range optsProfiles {
+		if !stringslice.Contains(configProfiles, strings.TrimPrefix(p, "-")) {
 			unmatched = append(unmatched, p)
 		}
 	}
diff --git a/pkg/skaffold/util/config.go b/pkg/skaffold/util/config.go
index 7072223c5..42b2ffae7 100644
--- a/pkg/skaffold/util/config.go
+++ b/pkg/skaffold/util/config.go
@@ -35,11 +35,11 @@ var stdin []byte
 
 // ReadConfiguration reads a `skaffold.yaml` configuration and
 // returns its content.
-func ReadConfiguration(filename string) ([]byte, error) {
+func ReadConfiguration(filePath string) ([]byte, error) {
 	switch {
-	case filename == "":
+	case filePath == "":
 		return nil, errors.New("filename not specified")
-	case filename == "-":
+	case filePath == "-":
 		if len(stdin) == 0 {
 			var err error
 			stdin, err = ioutil.ReadAll(os.Stdin)
@@ -48,25 +48,24 @@ func ReadConfiguration(filename string) ([]byte, error) {
 			}
 		}
 		return stdin, nil
-	case IsURL(filename):
-		return Download(filename)
+	case IsURL(filePath):
+		return Download(filePath)
 	default:
-		fp := filename
-		if !filepath.IsAbs(fp) {
+		if !filepath.IsAbs(filePath) {
 			dir, err := os.Getwd()
 			if err != nil {
 				return []byte{}, err
 			}
-			fp = filepath.Join(dir, fp)
+			filePath = filepath.Join(dir, filePath)
 		}
-		contents, err := afero.ReadFile(Fs, fp)
+		contents, err := afero.ReadFile(Fs, filePath)
 		if err != nil {
 			// If the config file is the default `skaffold.yaml`,
 			// then we also try to read `skaffold.yml`.
-			if filename == "skaffold.yaml" {
+			if filepath.Base(filePath) == "skaffold.yaml" {
 				log.Entry(context.TODO()).Infof("Could not open skaffold.yaml: \"%s\"", err)
 				log.Entry(context.TODO()).Info("Trying to read from skaffold.yml instead")
-				contents, errIgnored := afero.ReadFile(Fs, filepath.Join(filepath.Dir(fp), "skaffold.yml"))
+				contents, errIgnored := afero.ReadFile(Fs, filepath.Join(filepath.Dir(filePath), "skaffold.yml"))
 				if errIgnored != nil {
 					// Return original error because it's the one that matters
 					return nil, err


Test patch:
diff --git a/pkg/skaffold/docker/image_test.go b/pkg/skaffold/docker/image_test.go
index 0b26ea3b0..7f3bdcd7b 100644
--- a/pkg/skaffold/docker/image_test.go
+++ b/pkg/skaffold/docker/image_test.go
@@ -537,6 +537,10 @@ func TestTagWithImageID(t *testing.T) {
 			imageName:   "!!invalid!!",
 			shouldErr:   true,
 		},
+		{
+			description: "empty image id",
+			imageName:   "ref",
+		},
 	}
 	for _, test := range tests {
 		testutil.Run(t, test.description, func(t *testutil.T) {
diff --git a/pkg/skaffold/git/gitutil_test.go b/pkg/skaffold/git/gitutil_test.go
index ca4d10fab..210e8684f 100644
--- a/pkg/skaffold/git/gitutil_test.go
+++ b/pkg/skaffold/git/gitutil_test.go
@@ -114,8 +114,6 @@ func TestSyncRepo(t *testing.T) {
 			cmds: []cmdResponse{
 				{cmd: "git remote -v", out: "origin git@github.com/foo.git"},
 				{cmd: "git fetch origin master"},
-				{cmd: "git diff --name-only --ignore-submodules HEAD"},
-				{cmd: "git diff --name-only --ignore-submodules origin/master..."},
 				{cmd: "git reset --hard origin/master"},
 			},
 			syncFlag: "always",
@@ -131,6 +129,16 @@ func TestSyncRepo(t *testing.T) {
 			syncFlag:  "always",
 			shouldErr: true,
 		},
+		{
+			description: "existing repo with no remotes fails",
+			g:           latestV1.GitInfo{Repo: "http://github.com/foo.git", Path: "bar/skaffold.yaml", Ref: "master"},
+			existing:    true,
+			cmds: []cmdResponse{
+				{cmd: "git remote -v"},
+			},
+			syncFlag:  "always",
+			shouldErr: true,
+		},
 		{
 			description: "existing dirty repo with sync off succeeds",
 			g:           latestV1.GitInfo{Repo: "http://github.com/foo.git", Path: "bar/skaffold.yaml", Ref: "master", Sync: util.BoolPtr(false)},
@@ -152,30 +160,28 @@ func TestSyncRepo(t *testing.T) {
 			expected: "iSEL5rQfK5EJ2yLhnW8tUgcVOvDC8Wjl",
 		},
 		{
-			description: "existing repo with uncommitted changes and sync on fails",
+			description: "existing repo with uncommitted changes and sync on resets",
 			g:           latestV1.GitInfo{Repo: "http://github.com/foo.git", Path: "bar/skaffold.yaml", Ref: "master", Sync: util.BoolPtr(true)},
 			existing:    true,
 			cmds: []cmdResponse{
 				{cmd: "git remote -v", out: "origin git@github.com/foo.git"},
 				{cmd: "git fetch origin master"},
-				{cmd: "git diff --name-only --ignore-submodules HEAD", out: "pkg/foo\npkg/bar"},
+				{cmd: "git reset --hard origin/master"},
 			},
-			syncFlag:  "always",
-			shouldErr: true,
+			syncFlag: "always",
+			expected: "iSEL5rQfK5EJ2yLhnW8tUgcVOvDC8Wjl",
 		},
 		{
-			description: "existing repo with unpushed commits and sync on fails",
+			description: "existing repo with unpushed commits and sync on resets",
 			g:           latestV1.GitInfo{Repo: "http://github.com/foo.git", Path: "bar/skaffold.yaml", Ref: "master", Sync: util.BoolPtr(true)},
 			existing:    true,
 			cmds: []cmdResponse{
 				{cmd: "git remote -v", out: "origin git@github.com/foo.git"},
 				{cmd: "git fetch origin master"},
-				{cmd: "git diff --name-only --ignore-submodules HEAD"},
-				{cmd: "git diff --name-only --ignore-submodules origin/master...", out: "pkg/foo\npkg/bar"},
 				{cmd: "git reset --hard origin/master"},
 			},
-			syncFlag:  "always",
-			shouldErr: true,
+			syncFlag: "always",
+			expected: "iSEL5rQfK5EJ2yLhnW8tUgcVOvDC8Wjl",
 		},
 		{
 			description: "existing repo update fails on fetch",
@@ -188,31 +194,6 @@ func TestSyncRepo(t *testing.T) {
 			syncFlag:  "always",
 			shouldErr: true,
 		},
-		{
-			description: "existing repo update fails on diff remote",
-			g:           latestV1.GitInfo{Repo: "http://github.com/foo.git", Path: "bar/skaffold.yaml", Ref: "master"},
-			existing:    true,
-			cmds: []cmdResponse{
-				{cmd: "git remote -v", out: "origin git@github.com/foo.git"},
-				{cmd: "git fetch origin master"},
-				{cmd: "git diff --name-only --ignore-submodules HEAD"},
-				{cmd: "git diff --name-only --ignore-submodules origin/master...", err: errors.New("error")},
-			},
-			syncFlag:  "always",
-			shouldErr: true,
-		},
-		{
-			description: "existing repo update fails on diff working dir",
-			g:           latestV1.GitInfo{Repo: "http://github.com/foo.git", Path: "bar/skaffold.yaml", Ref: "master"},
-			existing:    true,
-			cmds: []cmdResponse{
-				{cmd: "git remote -v", out: "origin git@github.com/foo.git"},
-				{cmd: "git fetch origin master"},
-				{cmd: "git diff --name-only --ignore-submodules HEAD", err: errors.New("error")},
-			},
-			syncFlag:  "always",
-			shouldErr: true,
-		},
 		{
 			description: "existing repo update fails on reset",
 			g:           latestV1.GitInfo{Repo: "http://github.com/foo.git", Path: "bar/skaffold.yaml", Ref: "master"},
@@ -220,8 +201,6 @@ func TestSyncRepo(t *testing.T) {
 			cmds: []cmdResponse{
 				{cmd: "git remote -v", out: "origin git@github.com/foo.git"},
 				{cmd: "git fetch origin master"},
-				{cmd: "git diff --name-only --ignore-submodules HEAD"},
-				{cmd: "git diff --name-only --ignore-submodules origin/master..."},
 				{cmd: "git reset --hard origin/master", err: errors.New("error")},
 			},
 			syncFlag:  "always",