redhat-developer / openshift-vsts

OpenShift Extension for Azure DevOps.
Apache License 2.0
15 stars 20 forks source link

OC-Setup task fails #149

Open mdepa opened 4 years ago

mdepa commented 4 years ago

Hi,

I'm testing the version 2.* (preview) of the OC-Setup on top of a Windows based Agent.

Test Specs TFS Version: 2018Upd3 Agent.OS: Windows_NT Agent.Version: 2.134.2 Agent.OSVersion: 6.3.9600

Error The task fails complaining about not finding the cUrl executable.

Expectation If cUrl is a requirement, I'd like to have it listed as Demands into the Agent phase.

LOG 2020-02-28T16:16:18.2386612Z ##[section]Starting: oc-setup 2020-02-28T16:16:18.2580838Z ============================================================================== 2020-02-28T16:16:18.2581133Z Task : Install and setup oc 2020-02-28T16:16:18.2581385Z Description : Installs oc and configures the PATH and KUBECONFIG environment variables. 2020-02-28T16:16:18.2581612Z Version : 2.0.12 2020-02-28T16:16:18.2581809Z Author : Hardy Ferentschik 2020-02-28T16:16:18.2582254Z Help : See getting started 2020-02-28T16:16:18.2582527Z ============================================================================== 2020-02-28T16:16:18.8610079Z ##[debug]agent.TempDirectory=T:\DiscreteManufacturing_AgtBld001_work_temp 2020-02-28T16:16:18.8622105Z ##[debug]loading inputs and endpoints 2020-02-28T16:16:18.8643053Z ##[debug]loading ENDPOINT_AUTH_7597e090-b953-456f-b75a-73ef38ddafb7 2020-02-28T16:16:18.8643386Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_7597e090-b953-456f-b75a-73ef38ddafb7_ACCEPTUNTRUSTEDCERTS 2020-02-28T16:16:18.8643660Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_7597e090-b953-456f-b75a-73ef38ddafb7_PASSWORD 2020-02-28T16:16:18.8643908Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_7597e090-b953-456f-b75a-73ef38ddafb7_USERNAME 2020-02-28T16:16:18.8644139Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2020-02-28T16:16:18.8644378Z ##[debug]loading ENDPOINT_AUTH_SCHEME_7597e090-b953-456f-b75a-73ef38ddafb7 2020-02-28T16:16:18.8644797Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2020-02-28T16:16:18.8645007Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2020-02-28T16:16:18.8645221Z ##[debug]loading INPUT_OPENSHIFTSERVICE 2020-02-28T16:16:18.8645435Z ##[debug]loaded 9 2020-02-28T16:16:18.8645623Z ##[debug]Agent.ProxyUrl=undefined 2020-02-28T16:16:18.8645832Z ##[debug]Agent.CAInfo=undefined 2020-02-28T16:16:18.8646025Z ##[debug]Agent.ClientCert=undefined 2020-02-28T16:16:18.8646243Z ##[debug]Agent.SkipCertValidation=undefined 2020-02-28T16:16:18.8646453Z ##[debug]version=undefined 2020-02-28T16:16:18.8646636Z ##[debug]proxy=undefined 2020-02-28T16:16:18.8646842Z ##[debug]determining latest oc version 2020-02-28T16:16:18.8647086Z ##[debug]latest stable oc version: https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/windows/oc.zip 2020-02-28T16:16:18.8647312Z ##[debug]creating download directory 2020-02-28T16:16:18.8647556Z ##[debug]downloading: https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/windows/oc.zip 2020-02-28T16:16:18.8647787Z ##[debug]which 'curl' 2020-02-28T16:16:18.8647967Z ##[debug]not found 2020-02-28T16:16:18.8648168Z ##[debug]task result: Failed 2020-02-28T16:16:18.8685045Z ##[error]Unable to locate executable file: 'curl'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file. 2020-02-28T16:16:18.8692260Z ##[debug]Processed: ##vso[task.issue type=error;]Unable to locate executable file: 'curl'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file. 2020-02-28T16:16:18.8707229Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unable to locate executable file: 'curl'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file. 2020-02-28T16:16:18.8708490Z ##[section]Finishing: oc-setup

lstocchi commented 4 years ago

Good point @mdepa - I don't think we can add this to the oc-cmd/oc-config task because there is atleast a case where the cUrl is not required but this is definitely a good idea for the oc-setup task. Thanks a lot!!

lstocchi commented 4 years ago

I looked into this and i found it is not possible to add custom demands in a task right now. What Microsoft does is to implement the check inside the code and show an error message which is the same result we have now. (e.g. their curl extension https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/CUrlUploaderV2/curluploader.ts#L63 )

The other option would be to avoid using curl and make use of a library shipped with the extension but this is not so simple. We need to make sure this extension is usable with as many agents as possible. Most of them use node with a version < 7 and some modern libs don't work with it. Others are not reliable when using proxies, others don't support redirection (not mandatory but it's something i'd like to keep). So the choices are not so many. i prefer to keep using curl.

I agree we should warn users about the need of having curl installed to run this extension but i don't think there is a way to do it in the way i was thinking. I'll leave this issue opened waiting to find a better way to deal with it. In the meantime I'll update the documentation to highlight this aspect.