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

Add default dockerfile path to skaffold config when using skaffold init #4989

Merged

Conversation

MarlonGamez
Copy link
Contributor

Fixes #3766

Description
This PR is meant to address users who run skaffold init and are given the wrong context field in their skaffold config for docker artifacts. Currently the analyzer simply sets the context as the dockerfile location, but this may be different from the actual root of the project's source code.

Given a project structure like so:

proj-dir
├── README.md
└── app
    ├── deploy
    │   ├── Dockerfile
    │   └── k8s-pod.yaml
    └── main.go

Before, a user running skaffold init would get something like this:

apiVersion: skaffold/v2beta9
kind: Config
metadata:
  name: getting-started
build:
  artifacts:
  - image: skaffold-example
    context: app/deploy
deploy:
  ...

Now, they will get something like

apiVersion: skaffold/v2beta9
kind: Config
metadata:
  name: getting-started
build:
  artifacts:
  - image: skaffold-example
    context: app/deploy
    docker:
      dockerfile: Dockerfile
deploy:
  ...

This will allow users to more easily alter the necessary fields of their config to work for their project, as mentioned in #3766

Follow-up Work
The issue at the root of this is really #3760. I'd like to list this as follow up work as tackling this issue will create a much better skaffold init experience by reducing the need for modification of the config after the fact.

@codecov
Copy link

codecov bot commented Nov 2, 2020

Codecov Report

Merging #4989 into master will decrease coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4989      +/-   ##
==========================================
- Coverage   72.25%   72.19%   -0.07%     
==========================================
  Files         361      362       +1     
  Lines       12704    12715      +11     
==========================================
  Hits         9179     9179              
- Misses       2843     2855      +12     
+ Partials      682      681       -1     
Impacted Files Coverage Δ
pkg/skaffold/docker/docker_init.go 100.00% <ø> (ø)
pkg/skaffold/build/local/docker.go
pkg/skaffold/build/docker/docker.go 42.00% <0.00%> (ø)
pkg/skaffold/build/docker/types.go 100.00% <0.00%> (ø)
pkg/skaffold/build/local/types.go 78.84% <0.00%> (+1.92%) ⬆️
pkg/skaffold/build/local/local.go 72.50% <0.00%> (+12.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1fc079...9604157. Read the comment docs.

@MarlonGamez MarlonGamez marked this pull request as ready for review November 2, 2020 23:30
@MarlonGamez MarlonGamez requested a review from a team as a code owner November 2, 2020 23:30
@tejal29 tejal29 merged commit e474ed7 into GoogleContainerTools:master Nov 2, 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.

Skaffold init shouild generate a skaffold.yaml with default section.
2 participants