-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove gcr.io/k8s-skaffold repository from examples #3368
Remove gcr.io/k8s-skaffold repository from examples #3368
Conversation
Codecov Report
|
8bc58fd
to
856e0b5
Compare
Not sure what's happening with the integration tests on travis, I'm looking... |
So, e.g.:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
integration tests are failing still
Sorry, I still didn't have time to look into this. I'll do this as soon as possible. Interesting though that kokoro is happy 🤔 |
Yeah only GCP_ONLY tests run on kokoro |
22747ef
to
4f6807d
Compare
integration/skaffold/helper.go
Outdated
@@ -262,6 +276,15 @@ func (b *RunBuilder) cmd(ctx context.Context) *exec.Cmd { | |||
return cmd | |||
} | |||
|
|||
func isCoreCommand(command string) bool { | |||
switch command { | |||
case "build", "debug", "delete", "deploy", "dev", "generate-pipeline", "render", "run": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super-happy with this approach, as it mirrors what is already configured on the cobra command.
An alternative could be to create a NewSkaffoldCommand
and filter valid arguments based on the cobra configuration. If this makes sense this should be done in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using the cobra command to determine directly if the command has the given flags? Something like:
c := cmd.NewSkaffoldCommand(os.Stdout, os.Stderr)
var command *cobra.Command
for _, comm := range c.Commands() {
if comm.Name() == b.command {
command = comm
break
}
}
if b.ns != "" && command.Flags().Lookup("namespace") != nil {
args = append(args, "--namespace", b.ns)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is what I was thinking too. Then I'll add it in this PR.
Finally the build is back to normal, sorry it took so long. I had trouble running the integration tests locally, as |
Signed-off-by: Cornelius Weig <[email protected]>
Signed-off-by: Cornelius Weig <[email protected]>
Signed-off-by: Cornelius Weig <[email protected]>
Skaffold deploy with default-repo seems to be not working that way.
Flags such as --namespace or --default-repo are applied to "all" Skaffold commands, but this only applies to all core commands. Make the test helper a bit smarter to not forward unknown arguments. Signed-off-by: Cornelius Weig <[email protected]>
…in integration tests Signed-off-by: Cornelius Weig <[email protected]>
When passing unknown flags to skaffold in integration tests, the tests rightfully fails. However, for simpler test setup it is desirable to unconditionally set some configurations. This change ensures that those flags will not break the integration tests. Signed-off-by: Cornelius Weig <[email protected]>
Signed-off-by: Cornelius Weig <[email protected]>
ab2a2d8
to
69ed501
Compare
It's rebased now and I also adapted the new buildpack example. Let's see if everything stays green :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'lll take another look after this is merged to see if we missed a few more cases
Oh dear.. there's another issue with a helm test. I need to take a look later today. |
Ok, I couldn't wait to fix that right now. I really hope this was the last issue. I think this is because the helm deployer does not correctly rewrite image names (possibly just for |
@corneliusweig bad news
|
@dgageot 🤦♂️ well that one goes on me. Sorry for causing so much back-and-forth. Would you care for another try? |
…ools#3368) * Always use the default repository `gcr.io/k8s-skaffold` in tests Signed-off-by: Cornelius Weig <[email protected]> * Remove gcr.io/k8s-skaffold repository from image names Signed-off-by: Cornelius Weig <[email protected]> * Convert former default-repo test to explicit repo tests Signed-off-by: Cornelius Weig <[email protected]> * Adapt image names in examples Signed-off-by: Cornelius Weig <[email protected]> * Revert helm integration test Skaffold deploy with default-repo seems to be not working that way. * Restrict flags to core commands in test-helper Flags such as --namespace or --default-repo are applied to "all" Skaffold commands, but this only applies to all core commands. Make the test helper a bit smarter to not forward unknown arguments. Signed-off-by: Cornelius Weig <[email protected]> * Adapt expectations to account for --default-repo=gcr.io/k8s-skaffold in integration tests Signed-off-by: Cornelius Weig <[email protected]> * Silently ignore unknown flags in integration tests When passing unknown flags to skaffold in integration tests, the tests rightfully fails. However, for simpler test setup it is desirable to unconditionally set some configurations. This change ensures that those flags will not break the integration tests. Signed-off-by: Cornelius Weig <[email protected]> * Use default repo in buildpack example Signed-off-by: Cornelius Weig <[email protected]> * Revert helm-test: use fully qualified image name * Change to fully qualified image in explicit repo integration test
Description
All examples reference images in the
gcr.io/k8s-skaffold/
repository. The underlying reason for this is that Skaffold uses these examples in its integration tests, and pushes the built images to the registry.However, for regular Skaffold users the repository is not writable, so they need to modify the image names to try out the examples. The goal of this PR is to improve the usability of examples for Skaffold users. Removing the
gcr.io/k8s-skaffold
image prefix will allow to run examples with just the--default-repo
option and without having to modify theskaffold.yaml
.User facing changes
Images in examples no longer reference the
gcr.io/k8s-skaffold
repository.Before
Users could not use the
--default-repo
option to push to their own registries.After
Users can use the
--default-repo
option to push to their own registries.Next PRs.
n/a
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Open question
Should the README to run examples include instructions for running with the
--default-repo
option?Reviewer Notes