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

Allow using remote Dockerfiles (HTTP(S) only) for building images #5976

Conversation

rm3l
Copy link
Member

@rm3l rm3l commented Jul 26, 2022

What type of PR is this:
/kind feature

What does this PR do / why we need it:
This PR adds support for remote Dockerfiles (specified via an HTTP or HTTPS URL) when running odo build-images or odo deploy.

Which issue(s) this PR fixes:
Fixes #5450

PR acceptance criteria:

How to test changes / Special notes to the reviewer:
See the reproduction steps provided in #5450 for functional testing.

From the code perspective, commits in this branch are atomic and self-contained. This PR can be reviewed on a commit-by-commit basis.

rm3l added 6 commits July 26, 2022 17:53
…Dockerfile

For now, this only supports HTTP(S) and downloads the remote file to a temporary file.
The path to that temp. file is then returned to the caller.

In all other cases, the specified URI path is returned as is.
This means that non-HTTP(S) URIs will *not* get resolved, but will be returned as is.

Signed-off-by: Armel Soro <asoro@redhat.com>
…images` commands

Signed-off-by: Armel Soro <asoro@redhat.com>
… is relative

It actually does not make sense to join absolute Dockerfile paths,
as can be the case with temporary files created by downloading a remote Dockerfile

Signed-off-by: Armel Soro <asoro@redhat.com>
Signed-off-by: Armel Soro <asoro@redhat.com>
Signed-off-by: Armel Soro <asoro@redhat.com>
Signed-off-by: Armel Soro <asoro@redhat.com>
@rm3l rm3l requested review from dharmit, cdrage and valaparthvi July 26, 2022 15:55
@netlify
Copy link

netlify bot commented Jul 26, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 6d725be
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/62e3f551e3e8f100099be00f

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Jul 26, 2022
@openshift-ci openshift-ci bot requested a review from feloy July 26, 2022 15:56
@odo-robot
Copy link

odo-robot bot commented Jul 26, 2022

Unit Tests on commit 9b48987 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jul 26, 2022

Windows Tests (OCP) on commit 9b48987 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jul 26, 2022

OpenShift Tests on commit 9b48987 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jul 26, 2022

Kubernetes Tests on commit 9b48987 finished successfully.
View logs: TXT HTML

Copy link
Member

@dharmit dharmit left a comment

Choose a reason for hiding this comment

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

/approve

Requested few small items. LGTM otherwise.

@openshift-ci
Copy link

openshift-ci bot commented Jul 27, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharmit

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Jul 27, 2022
rm3l added 2 commits July 27, 2022 16:38
…`build-images` commands

Signed-off-by: Armel Soro <asoro@redhat.com>
@odo-robot
Copy link

odo-robot bot commented Jul 27, 2022

Validate Tests on commit 9b48987 finished successfully.
View logs: TXT HTML

@rm3l rm3l requested a review from dharmit July 27, 2022 14:58
@@ -89,7 +90,7 @@ func buildPushImage(backend Backend, image *devfile.ImageComponent, devfilePath
// selectBackend selects the container backend to use for building and pushing images
// It will detect podman and docker CLIs (in this order),
// or return an error if none are present locally
func selectBackend() (Backend, error) {
func selectBackend(fs filesystem.Filesystem) (Backend, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't find this change comfortable. Actually selectBackend has no need for the fs. It's doing something else along with trying to figure out the backend to use, and hence it now needs this extra param.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. Instead, I moved this parameter to the Build method in the image.Backend interface. This is where it is actually needed, when trying to build the image.
See 878285b (#5976)

@dharmit
Copy link
Member

dharmit commented Jul 29, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jul 29, 2022
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jul 29, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@rm3l rm3l requested a review from dharmit July 29, 2022 14:58
@dharmit
Copy link
Member

dharmit commented Aug 1, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Aug 1, 2022
@openshift-merge-robot openshift-merge-robot merged commit 45c45fa into redhat-developer:main Aug 1, 2022
cdrage pushed a commit to cdrage/odo that referenced this pull request Aug 31, 2022
…dhat-developer#5976)

* Add utility function in `docker_compatible.go` allowing to resolve a Dockerfile

For now, this only supports HTTP(S) and downloads the remote file to a temporary file.
The path to that temp. file is then returned to the caller.

In all other cases, the specified URI path is returned as is.
This means that non-HTTP(S) URIs will *not* get resolved, but will be returned as is.

Signed-off-by: Armel Soro <asoro@redhat.com>

* Allow using remote HTTP(S) Dockerfiles with both `deploy` and `build-images` commands

Signed-off-by: Armel Soro <asoro@redhat.com>

* Join resolved Dockerfile path with the Devfile one only if the former is relative

It actually does not make sense to join absolute Dockerfile paths,
as can be the case with temporary files created by downloading a remote Dockerfile

Signed-off-by: Armel Soro <asoro@redhat.com>

* Add integration test cases for `odo build-images`

Signed-off-by: Armel Soro <asoro@redhat.com>

* Add integration test cases for `odo deploy`

Signed-off-by: Armel Soro <asoro@redhat.com>

* Update doc for both `build-images` and `deploy` commands

Signed-off-by: Armel Soro <asoro@redhat.com>

* fixup! Add utility function in `docker_compatible.go` allowing to resolve a Dockerfile

* fixup! Allow using remote HTTP(S) Dockerfiles with both `deploy` and `build-images` commands

Signed-off-by: Armel Soro <asoro@redhat.com>

* fixup! Allow using remote HTTP(S) Dockerfiles with both `deploy` and `build-images` commands

* fixup! 878285b
@rm3l rm3l deleted the 5450-using-odo-deploy-remote-dockerfile-uri-not-accesible-https-not-supported branch December 1, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using odo deploy - remote Dockerfile uri not accesible: HTTPS not supported
3 participants