konveyor / move2kube

Move2Kube is a command-line tool for automating creation of Infrastructure as code (IaC) artifacts. It has inbuilt support for creating IaC artifacts for replatforming to Kubernetes/Openshift.
https://move2kube.konveyor.io/
Apache License 2.0
383 stars 118 forks source link

In Generated Dockerfile COPY Command syntax formed incorrectly #1097

Closed anand2k24 closed 11 months ago

anand2k24 commented 11 months ago

Describe the bug As is generated : COPY --from= rating-buildstage/app/target/rating-0.0.1-SNAPSHOT.jar . It has to be like : COPY --from=rating-buildstage /app/target/rating-0.0.1-SNAPSHOT.jar .

There should be space between image name build jar file path, but instead the space presented after = COPY --from=

To Reproduce Steps to reproduce the behavior:

  1. Using the Mov2Kube UI Version http://localhost:8080/
  2. After Planning, use Tranform to the generate the outcome
  3. go to the scripts folder in the output directory generated, run the command buildimages.bat podman STEP 1/3: FROM registry.access.redhat.com/ubi8/ubi-minimal:latest STEP 2/3: COPY rating-0.0.1-SNAPSHOT.jar . --> 62de1907ec18 STEP 3/3: COPY --from= rating-buildstage/app/target/rating-0.0.1-SNAPSHOT.jar . Error: COPY --from=: no stage or image found with that name

Expected behavior The build should have completed without any errors

Screenshots STEP 3/3: COPY --from= rating-buildstage/app/target/rating-0.0.1-SNAPSHOT.jar . Error: COPY --from=: no stage or image found with that name

Desktop (please complete the following information):

Additional context Rest all works fine, I have even tried it seperately, special thanks to Padmanabha V Seshadri to helping in slack community to go forward

HarikrishnanBalagopal commented 11 months ago

@move2git Thanks for raising the issue.

In the Move2Kube UI please go to the Support page and copy/paste the details here. This will help us debug the issue.

anand2k24 commented 11 months ago
CLI | version: v0.3.11-rc.0+unreleased gitCommit: 9bc4e8b017e995ad6cab70f9f9e28a3508ad52d5 gitTreeState: clean goVersion: go1.18 platform: linux/amd64 -- | -- API | version: v0.3.11-rc.0+unreleased gitCommit: 2e2bd550826fb1bc60a2224abcb154fb60b2c05d gitTreeState: clean goVersion: go1.18 platform: linux/amd64 UI | version: latest gitCommit: 3f31fb9c0b0503e2887403e9423fedeb6abd105c gitTreeState: clean Docker | docker socket is not mounted
anand2k24 commented 11 months ago

@HarikrishnanBalagopal I have pasted the details now

HarikrishnanBalagopal commented 11 months ago

Thanks, possibly the space in this line between --from and the container name https://github.com/konveyor/move2kube/blob/9bc4e8b017e995ad6cab70f9f9e28a3508ad52d5/assets/built-in/transformers/dockerfilegenerator/java/jar/templates/Dockerfile.jar-run#L7

Should make it similar to https://github.com/konveyor/move2kube/blob/9bc4e8b017e995ad6cab70f9f9e28a3508ad52d5/assets/built-in/transformers/dockerfilegenerator/java/tomcat/templates/Dockerfile.tomcat#L24

I think the space got introduced accidentally in this PR https://github.com/konveyor/move2kube/pull/1001/files#diff-04b72caa3d4688f1c2eaa6edaca8db27cee3e2abd814dcff0d169c23b47a5d09R7

anand2k24 commented 11 months ago

@HarikrishnanBalagopal Thank you so much Hari for quickly looking at it and pointing to it. I also want to start contributing to open source. I don't know how to start and setup a test/debug environment in my local. Is there any help available to look in to it

anand2k24 commented 11 months ago

Thanks, possibly the space in this line between --from and the container name

https://github.com/konveyor/move2kube/blob/9bc4e8b017e995ad6cab70f9f9e28a3508ad52d5/assets/built-in/transformers/dockerfilegenerator/java/jar/templates/Dockerfile.jar-run#L7

Should make it similar to

https://github.com/konveyor/move2kube/blob/9bc4e8b017e995ad6cab70f9f9e28a3508ad52d5/assets/built-in/transformers/dockerfilegenerator/java/tomcat/templates/Dockerfile.tomcat#L24

I think the space got introduced accidentally in this PR https://github.com/konveyor/move2kube/pull/1001/files#diff-04b72caa3d4688f1c2eaa6edaca8db27cee3e2abd814dcff0d169c23b47a5d09R7

Space should be between Container Name and DeploymentFilePath, you rightly pointed out the fix Bug: --from= {{ .BuildContainerName }}{{ end }}{{ .DeploymentFilePath }} Fix: --from={{ .BuildContainerName }} {{ end }}{{ .DeploymentFilePath }}

anand2k24 commented 11 months ago

@HarikrishnanBalagopal once done with fix and moved to pre-prod/prod, keep me informed, I will test it and confirm

HarikrishnanBalagopal commented 11 months ago

@HarikrishnanBalagopal Thank you so much Hari for quickly looking at it and pointing to it. I also want to start contributing to open source. I don't know how to start and setup a test/debug environment in my local. Is there any help available to look in to it

Nice! You can take a look at issues labelled hacktoberfest in this repo for some idea on how to get started https://github.com/konveyor/move2kube/issues/881 Also this https://github.com/konveyor/move2kube/blob/main/contributing.md