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

skaffold.yaml produced by skaffold init --XXenableJibInit could be simpler #3190

Closed
dgageot opened this issue Nov 6, 2019 · 8 comments · Fixed by #3191
Closed

skaffold.yaml produced by skaffold init --XXenableJibInit could be simpler #3190

dgageot opened this issue Nov 6, 2019 · 8 comments · Fixed by #3191

Comments

@dgageot
Copy link
Contributor

dgageot commented Nov 6, 2019

When I run skaffold init --XXenableJibInit --force in examples/jib, I get this skaffold.yaml.

...
build:
  artifacts:
  - image: gcr.io/k8s-skaffold/skaffold-jib
    jib:
      args:
      - -Dimage=gcr.io/k8s-skaffold/skaffold-jib
      type: maven

I expected to get this kind of output:

build:
  artifacts:
  - image: gcr.io/k8s-skaffold/skaffold-jib
    jib: {}

any reason why we duplicate the image name?

@dgageot
Copy link
Contributor Author

dgageot commented Nov 6, 2019

cc @saturnism

@loosebazooka
Copy link
Member

loosebazooka commented Nov 6, 2019

I think @TadCordle had a reason for this (for adding the -Dimage)

@briandealwis
Copy link
Member

briandealwis commented Nov 6, 2019

#2854 for #2852

@TadCordle
Copy link
Contributor

Yeah, this is intentional. If someone chooses to use Jib to build one of the k8s images, but the Jib config points to a different image, we need to specify the correct image using args in the skaffold.yaml. And I decided to just always specify args to make the code simpler.

@dgageot
Copy link
Contributor Author

dgageot commented Nov 6, 2019

Shouldn't the value passed as an argument override the value in the pom.xml?

@TadCordle
Copy link
Contributor

TadCordle commented Nov 6, 2019

Yes, that is what it does. E.g. if pom.xml points to image-a but the user chooses that Jib project to build image-b during skaffold init, we pass -Dimage=image-b in the skaffold.yaml so the original image-a config is overridden.

@chanseokoh
Copy link
Member

@TadCordle related, I am confused after I realized the Skaffold-Jib builder always appends -Dimage= at the end, so if I understood this right, this will end up passing -Dimage= twice where the last one provided by the builder will win and override the arg one. If that is true, then #2854 should have no effect, but that doesn't seem to be the case, so now I'm confused.

@TadCordle
Copy link
Contributor

Ah, I see what you're saying now. I didn't realize Jib automatically appended the image flag during the build. If the same flag is used twice, it looks like gradle errors out, and maven just uses the last argument, so in that case we can probably just remove the arg generation during skaffold init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants