This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 270455 - For building image task: pass absolute dockerfile path instead of relative
Summary: For building image task: pass absolute dockerfile path instead of relative
Status: NEW
Alias: None
Product: docker
Classification: Unclassified
Component: UI (show other bugs)
Version: Dev
Hardware: All All
: P3 normal (vote)
Assignee: ilia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-21 09:46 UTC by ilia
Modified: 2017-04-23 01:49 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ilia 2017-04-21 09:46:43 UTC

    
Comment 1 Petr Hejl 2017-04-21 10:09:21 UTC
Is this even possible? The API is accepting path relative to the build context.
Comment 2 ilia 2017-04-21 11:10:55 UTC
Hi Petr,

Sorry for the misleading issue title.
Let me describe the problem which appeared in Docker after migrating from File to FileObject:
Before migration we made it possible to specify both relative and absolute path to Dockerfile, with known build context.
After migration this logic was just removed for some reason, see lines in changeset [1], like:
... if (!file.isAbsolute()) ...

Of course Build Image Wizard didn't work well without this logic. I.e. specifying in UI

Build Context = /home/user/docker/
Dockerfile    = /home/user/docker/Dockerfile

led to computing absolute path of Dockerfile as /home/user/docker//home/user/docker/Dockerfile
which is not correct.

I decided to store only absolute paths in BuildImageWizard, thus everyone who use this property
is sure that path is absolute. This eliminates code like:

                String file;
                if (dockerfile != null) {
                    file = buildContext + "/" + dockerfile;
                } else {
                    file = buildContext + "/" + DockerAction.DOCKER_FILE;
                }

As you correctly noted API is only accepting a relative path of Dockerfile to Build Context.
The relative path is now computed only once, before creating a build task. See changeset [2]

[1] http://hg.netbeans.org/cnd-main/rev/4c4f992549bc
[2] http://hg.netbeans.org/cnd-main/rev/b2ea7738c04b
Comment 3 Quality Engineering 2017-04-23 01:49:55 UTC
Integrated into 'main-silver', will be available in build *201704230002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b2ea7738c04b
User: Ilia Gromov <ilia@netbeans.org>
Log: Fixed #270455 - For building image task: pass absolute dockerfile path instead of relative