Skip to content
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

Print the effective skaffold.yaml configuration #4048

Merged

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Apr 29, 2020

Example on examples/nodejs:

$ skaffold diagnose --only-config -p dev
apiVersion: skaffold/v2beta3
kind: Config
build:
  artifacts:
  - image: node-example
    context: backend
    sync:
      manual:
      - src: src/**/*.js
        dest: .
    docker:
      dockerfile: Dockerfile
      buildArgs:
        ENV: development
  tagPolicy:
    gitCommit: {}
  local:
    concurrency: 1
deploy:
  kubectl:
    manifests:
    - k8s/*.yaml

Signed-off-by: David Gageot [email protected]

@dgageot
Copy link
Contributor Author

dgageot commented Apr 29, 2020

cc @matthewmichihara

@codecov
Copy link

codecov bot commented Apr 29, 2020

Codecov Report

Merging #4048 into master will increase coverage by 0.02%.
The diff coverage is 41.66%.

Impacted Files Coverage Δ
cmd/skaffold/app/cmd/diagnose.go 39.13% <41.66%> (+11.35%) ⬆️
...affold/kubernetes/portforward/kubectl_forwarder.go 68.29% <0.00%> (+2.43%) ⬆️

@dgageot dgageot force-pushed the print-effective-config branch from 026a464 to cb643cf Compare April 29, 2020 12:09
@balopat
Copy link
Contributor

balopat commented Apr 29, 2020

Love it, I wanted to open a bug for this :D - this will be super useful for gitops workflows as well, where we can "hydrate" the skaffold config into a separate repo for audit purposes!

Copy link
Member

@briandealwis briandealwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional tweaks; I don't feel strongly about them.

WithCommonFlags().
WithFlags(func(f *pflag.FlagSet) {
f.BoolVar(&onlyConfig, "only-config", false, "Only prints the effective skaffold.yaml configuration")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--only-config reads oddly. --config-only or --yaml-only?

fmt.Fprintln(out, "Skaffold version:", version.Get().GitCommit)
fmt.Fprintln(out, "Configuration version:", config.APIVersion)
fmt.Fprintln(out, "Number of artifacts:", len(config.Build.Artifacts))
if !onlyConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since YAML supports comments, we could output this as comments?

@dgageot dgageot force-pushed the print-effective-config branch from cb643cf to 56adaf4 Compare May 2, 2020 10:48
@dgageot dgageot merged commit 2b9d573 into GoogleContainerTools:master May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants