Skip to content

Add Jib detection to skaffold init#2276

Merged
dgageot merged 49 commits intoGoogleContainerTools:masterfrom
TadCordle:jib-skaffold-init
Jul 30, 2019
Merged

Add Jib detection to skaffold init#2276
dgageot merged 49 commits intoGoogleContainerTools:masterfrom
TadCordle:jib-skaffold-init

Conversation

@TadCordle
Copy link
Copy Markdown
Contributor

@TadCordle TadCordle commented Jun 17, 2019

Review after #2327.

This PR adds Jib detection to skaffold init. Skaffold walks the directory searching for dockerfiles, build.gradles, and pom.xmls. If a build.gradle or a pom.xml is found, skaffold will attempt to run an internal Jib gradle task/maven goal to determine if Jib is configured on any of the projects (Jib v1.3.0 or higher is required for this to work).

If Jib is detected and jib.to.image is configured with an image found in the k8s manifest, the Jib builder is added to the skaffold config automatically.

If Jib is detected but jib.to.image is not configured to build a k8s image, the Jib project is added to the CLI prompt so the user can decide which image Jib should build, and the user's choice is added using the -Djib.to.image=... flag.

Issues left to solve:

  • Configuring to build with Jib via CLI artifacts
  • Gradle/Maven edge cases (config files that don't use the default names, unorthodox project structure, etc.)
  • Generating Jib config automatically if it's missing?

Towards #1264 (probably not completely fixed until there's some idea how to automatically apply Jib to maven/gradle projects).

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 20, 2019

Codecov Report

Merging #2276 into master will increase coverage by 0.43%.
The diff coverage is 88.31%.

Impacted Files Coverage Δ
pkg/skaffold/schema/latest/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/initializer/init.go 53.6% <81.81%> (+9.62%) ⬆️
pkg/skaffold/jib/jib_init.go 89.39% <89.39%> (ø)
pkg/skaffold/docker/docker_init.go 100% <0%> (+6.66%) ⬆️

Copy link
Copy Markdown
Member

@chanseokoh chanseokoh left a comment

Choose a reason for hiding this comment

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

Looks good.

@dgageot dgageot merged commit 27f5fe4 into GoogleContainerTools:master Jul 30, 2019
@TadCordle TadCordle deleted the jib-skaffold-init branch September 24, 2019 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants