HodorNV / ALOps

ALOps
59 stars 24 forks source link

How to use ALOpsOpenAPI on Container not build by AlOps #638

Closed epernst closed 1 year ago

epernst commented 1 year ago

I'm trying to get the ALOpsOpenAPI task to work in our pipeline together with a container that was not build by AlOps.

I have used the following specifications for the task:

But it errors out with: Error record:

[debug]C:\a_tasks\ALOpsOpenAPI_cdbb4478-e23e-4bfa-8f7a-1adde1799aca\1.455.3607\b1549363-a7bb-488d-a4ac-deb2efa0ceb1.ps1 : No Docker Container found with Label [DBC-BHG_115166]. Task aborted.

The container is named foundation-bld, why does it think it's DBC-BHG_115166?

waldo1001 commented 1 year ago

I'm afraid that's not how ALOps works. It can't "just" connect to any kind of container.

The "usedocker" actually means "use the docker container that I just built". It has a way of "remembering" what it built, and how to connect to it. Connecting to anything else is far from something we would ever be able to support.

My suggestion: Just build a container in the pipeline, enable apis, publish your app, and go from there. pretty much like: https://github.com/HodorNV/ALOps/blob/master/Examples/25_OpenAPI.yml

waldo1001 commented 1 year ago

You could try with "usedocker: false", and connect to the endpoint that way .. 🤔.

epernst commented 1 year ago

Tried to build a container using ALOps, but it seem to fail twice:

First with: Exception in BCConnector.GetAPIData: The underlying connection was closed: An unexpected error occurred on a receive.

and then again with: Cannot find path 'C:\OpenAPI*' because it does not exist.

ADO Log:

2023-05-19T08:09:27.6375202Z ##[debug]Evaluating condition for step: 'Generate OpenAPI descriptions'
2023-05-19T08:09:27.6376429Z ##[debug]Evaluating: SucceededNode()
2023-05-19T08:09:27.6376684Z ##[debug]Evaluating SucceededNode:
2023-05-19T08:09:27.6377223Z ##[debug]=> True
2023-05-19T08:09:27.6377484Z ##[debug]Result: True
2023-05-19T08:09:27.6377743Z ##[section]Starting: Generate OpenAPI descriptions
2023-05-19T08:09:27.6491038Z ==============================================================================
2023-05-19T08:09:27.6491195Z Task         : ALOps OpenAPI
2023-05-19T08:09:27.6491259Z Description  : Generate OpenAPI descriptions from Business Central API's
2023-05-19T08:09:27.6491387Z Version      : 1.455.3607
2023-05-19T08:09:27.6491448Z Author       : Hodor
2023-05-19T08:09:27.6491508Z Help         : Generate OpenAPI descriptions from Business Central API's.
2023-05-19T08:09:27.6491600Z ==============================================================================
2023-05-19T08:09:28.8257099Z ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4
2023-05-19T08:09:29.0160112Z ##[debug]Entering C:\a\_tasks\ALOpsOpenAPI_cdbb4478-e23e-4bfa-8f7a-1adde1799aca\1.455.3607\b1549363-a7bb-488d-a4ac-deb2efa0ceb1.ps1.
2023-05-19T08:09:29.0252477Z *** Validate configuration
2023-05-19T08:09:29.0932359Z ##[debug]INPUT_USEDOCKER: 'true'
2023-05-19T08:09:29.0982479Z ##[debug] Converted to bool: True
2023-05-19T08:09:29.1071979Z ##[debug]INPUT_FIXED_TAG (empty)
2023-05-19T08:09:29.1131751Z ##[debug]INPUT_API_ENDPOINT: 'http://e5e0de0172c5:7048/bc/api'
2023-05-19T08:09:29.1164868Z ##[debug]INPUT_AUTHENTICATION: 'basic'
2023-05-19T08:09:29.1200170Z ##[debug]INPUT_AZURE_TENANT_ID (empty)
2023-05-19T08:09:29.1234083Z ##[debug]INPUT_AZURE_APP_CLIENT_ID (empty)
2023-05-19T08:09:29.1267223Z ##[debug]INPUT_AZURE_APP_CLIENT_SECRET (empty)
2023-05-19T08:09:29.1306432Z ##[debug]INPUT_AZURE_APP_CLIENT_CERTIFICATE (empty)
2023-05-19T08:09:29.1339431Z ##[debug]INPUT_AZURE_APP_CLIENT_CERTIFICATE_PASSWORD (empty)
2023-05-19T08:09:29.1374959Z ##[debug]INPUT_USERNAME: 'admin'
2023-05-19T08:09:29.1415105Z ##[debug]INPUT_PASSWORD: 'Gasi7972'
2023-05-19T08:09:29.1448235Z ##[debug]INPUT_PUBLISH_ARTIFACTS: 'true'
2023-05-19T08:09:29.1473204Z ##[debug] Converted to bool: True
2023-05-19T08:09:29.1516970Z ##[debug]INPUT_DISCOVER: 'true'
2023-05-19T08:09:29.1541930Z ##[debug] Converted to bool: True
2023-05-19T08:09:29.1580768Z ##[debug]INPUT_API_ROUTES (empty)
2023-05-19T08:09:29.1613864Z ##[debug]INPUT_API_EXCLUDE_ROUTES (empty)
2023-05-19T08:09:29.1655402Z ##[debug]INPUT_INSPECT_PATHS: 'false'
2023-05-19T08:09:29.1700363Z ##[debug] Converted to bool: False
2023-05-19T08:09:29.1742303Z ##[debug]INPUT_API_SERVERS (empty)
2023-05-19T08:09:29.1779877Z ##[debug]INPUT_EXPORT_EDMX: 'true'
2023-05-19T08:09:29.1808883Z ##[debug] Converted to bool: True
2023-05-19T08:09:29.1850064Z ##[debug]INPUT_EXPORT_YAML: 'true'
2023-05-19T08:09:29.1881858Z ##[debug] Converted to bool: True
2023-05-19T08:09:29.1920632Z ##[debug]INPUT_EXPORT_JSON: 'true'
2023-05-19T08:09:29.1948655Z ##[debug] Converted to bool: True
2023-05-19T08:09:29.1988245Z ##[debug]INPUT_EXCLUDE_COMPANY_PATHS: 'false'
2023-05-19T08:09:29.2013228Z ##[debug] Converted to bool: False
2023-05-19T08:09:29.2071610Z *** Task Inputs:
2023-05-19T08:09:29.2134699Z 
2023-05-19T08:09:29.2281393Z name                                                            value
2023-05-19T08:09:29.2286130Z ----                                                            -----
2023-05-19T08:09:29.2290090Z usedocker                                                        True
2023-05-19T08:09:29.2293912Z fixed_tag                                                            
2023-05-19T08:09:29.2297779Z api_endpoint                          http://e5e0de0172c5:7048/bc/api
2023-05-19T08:09:29.2301538Z authentication                                                  basic
2023-05-19T08:09:29.2305490Z azure_tenant_id                                                      
2023-05-19T08:09:29.2309820Z azure_app_client_id                                                  
2023-05-19T08:09:29.2313932Z azure_app_client_secret                                              
2023-05-19T08:09:29.2317952Z azure_app_client_certificate                                         
2023-05-19T08:09:29.2321957Z azure_app_client_certificate_password                                
2023-05-19T08:09:29.2325917Z username                                                        admin
2023-05-19T08:09:29.2329810Z password                                                     Gasi7972
2023-05-19T08:09:29.2333750Z publish_artifacts                                                True
2023-05-19T08:09:29.2337481Z discover                                                         True
2023-05-19T08:09:29.2341467Z api_routes                                                           
2023-05-19T08:09:29.2345257Z api_exclude_routes                                                   
2023-05-19T08:09:29.2348925Z inspect_paths                                                   False
2023-05-19T08:09:29.2352905Z api_servers                                                          
2023-05-19T08:09:29.2356788Z export_edmx                                                      True
2023-05-19T08:09:29.2360614Z export_yaml                                                      True
2023-05-19T08:09:29.2364505Z export_json                                                      True
2023-05-19T08:09:29.2368322Z exclude_company_paths                                           False
2023-05-19T08:09:29.2368920Z 
2023-05-19T08:09:29.2399734Z 
2023-05-19T08:09:29.2411678Z 
2023-05-19T08:09:29.2500180Z ##[debug]ALOPS-LICENSEID (empty)
2023-05-19T08:09:29.6335710Z ##[debug]ALOPS_LICENSEID (empty)
2023-05-19T08:09:29.6532229Z 
2023-05-19T08:09:29.6546087Z *** No ALOps License found. Set License with the [alops-licenseid] or [alops_licenseid] variables.
2023-05-19T08:09:29.6559381Z *** To acquire a license, please visit: https://www.alops.be/getlicense
2023-05-19T08:09:29.6571747Z *** For pricing options, please visit : https://www.alops.be/pricing
2023-05-19T08:09:29.6584113Z *** For documentation, please visit   : https://www.alops.be/documentation
2023-05-19T08:09:29.6589426Z 
2023-05-19T08:09:30.1981627Z ##[debug]POST https://alopsapi.azurewebsites.net/api/interactions/license/4904e776-1a56-4eea-b814-425d1ef12f7a/91313e1b-dc12-4bc3-bc83-890f48c2e9ae/ with -1-byte payload
2023-05-19T08:09:31.0947475Z ##[debug]received 349-byte response of content type application/json; charset=utf-8
2023-05-19T08:09:31.1139033Z *** ALOps License:
2023-05-19T08:09:31.1168247Z   * Trial Key  : 4904e776-1a56-4eea-b814-425d1ef12f7a
2023-05-19T08:09:31.1194878Z   * Licensed To: ALOps Trial [21/31] days remaining. Trial ends: Friday, 09 June 2023
2023-05-19T08:09:31.1199712Z 
2023-05-19T08:09:31.1290545Z ##[debug]ALOPS_DISABLE_SSL (empty)
2023-05-19T08:09:31.1312524Z ##[debug] Converted to bool: False
2023-05-19T08:09:31.1370231Z *** Imported required PS-Functions
2023-05-19T08:09:31.2349971Z *** Parse Task Parameters
2023-05-19T08:09:31.2394033Z ##[debug]INPUT_USEDOCKER: 'true'
2023-05-19T08:09:31.2419900Z ##[debug] Converted to bool: True
2023-05-19T08:09:31.2452096Z ##[debug]INPUT_FIXED_TAG (empty)
2023-05-19T08:09:31.2481013Z ##[debug]INPUT_API_ENDPOINT: 'http://e5e0de0172c5:7048/bc/api'
2023-05-19T08:09:31.2528412Z ##[debug]INPUT_AUTHENTICATION: 'basic'
2023-05-19T08:09:31.2557297Z ##[debug]INPUT_DISCOVER: 'true'
2023-05-19T08:09:31.2580655Z ##[debug] Converted to bool: True
2023-05-19T08:09:31.2608484Z ##[debug]INPUT_API_ROUTES (empty)
2023-05-19T08:09:31.2635599Z ##[debug]INPUT_API_EXCLUDE_ROUTES (empty)
2023-05-19T08:09:31.2667387Z ##[debug]INPUT_INSPECT_PATHS: 'false'
2023-05-19T08:09:31.2691533Z ##[debug] Converted to bool: False
2023-05-19T08:09:31.2723064Z ##[debug]INPUT_EXPORT_EDMX: 'true'
2023-05-19T08:09:31.2747013Z ##[debug] Converted to bool: True
2023-05-19T08:09:31.2778354Z ##[debug]INPUT_EXPORT_JSON: 'true'
2023-05-19T08:09:31.2802629Z ##[debug] Converted to bool: True
2023-05-19T08:09:31.2832467Z ##[debug]INPUT_EXPORT_YAML: 'true'
2023-05-19T08:09:31.2855718Z ##[debug] Converted to bool: True
2023-05-19T08:09:31.2899438Z ##[debug]INPUT_PUBLISH_ARTIFACTS: 'true'
2023-05-19T08:09:31.2925973Z ##[debug] Converted to bool: True
2023-05-19T08:09:31.2954875Z ##[debug]INPUT_API_SERVERS (empty)
2023-05-19T08:09:31.2985381Z ##[debug]INPUT_EXCLUDE_COMPANY_PATHS: 'false'
2023-05-19T08:09:31.3008134Z ##[debug] Converted to bool: False
2023-05-19T08:09:31.3037212Z ##[debug]INPUT_USERNAME: 'admin'
2023-05-19T08:09:31.3064456Z ##[debug]INPUT_PASSWORD: 'Gasi7972'
2023-05-19T08:09:31.3344478Z ##[debug]INPUT_AZURE_TENANT_ID (empty)
2023-05-19T08:09:31.3382839Z ##[debug]INPUT_AZURE_APP_CLIENT_ID (empty)
2023-05-19T08:09:31.3425224Z ##[debug]INPUT_AZURE_APP_CLIENT_SECRET (empty)
2023-05-19T08:09:31.3456132Z ##[debug]INPUT_AZURE_APP_CLIENT_CERTIFICATE (empty)
2023-05-19T08:09:31.3483841Z ##[debug]INPUT_AZURE_APP_CLIENT_CERTIFICATE_PASSWORD (empty)
2023-05-19T08:09:31.4744304Z *** Initiate Docker Session
2023-05-19T08:09:31.4805251Z ##[debug]ALOPS-DOCKER-USERNAME (empty)
2023-05-19T08:09:31.4865044Z ##[debug]ALOPS-DOCKER-PASSWORD (empty)
2023-05-19T08:09:31.7611494Z *** Set Docker Container ErrorActionPreference = Stop
2023-05-19T08:09:31.8647886Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:31.8969161Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:31.9130363Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:31.9240116Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.0230953Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.0344290Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.0391062Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.0509235Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.0666504Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.0806269Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.0841565Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.1006024Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.1165525Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.1315965Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.1357479Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.1493271Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.1676335Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.1779499Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.1824600Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.1927288Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.2191922Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.2326466Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.2374708Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.2486398Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.2696870Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.2805764Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.2848630Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.3022961Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.3378714Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.3495369Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.3530036Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.3632768Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.3739035Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.3846264Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.3880539Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.3986831Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.4092895Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.5165786Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.5207413Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.5314027Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.5429487Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.5534724Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.5566884Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.5660028Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.5857086Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.5969118Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.6007262Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.6116885Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.6219297Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.6331604Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.6367666Z ##[debug]Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_LogicalDisk WHERE DeviceId='C:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
2023-05-19T08:09:32.6479314Z ##[debug]Operation 'Query CimInstances' complete.
2023-05-19T08:09:32.8397795Z *** Creating API Connector with endpoint [http://e5e0de0172c5:7048/bc/api]
2023-05-19T08:09:32.8761715Z *** API Authentication: Using Basic Authentication [admin]
2023-05-19T08:09:32.8856780Z *** List Companies
2023-05-19T08:09:32.9044980Z ##[command]Invoke-RestMethod -Method Get -Uri 'http://e5e0de0172c5:7048/bc/api/microsoft/automation/v1.0/companies'
2023-05-19T08:13:41.1999822Z ##[error]Exception in BCConnector.GetAPIData: The underlying connection was closed: An unexpected error occurred on a receive.
2023-05-19T08:13:41.2012545Z ##[debug]Processed: ##vso[task.logissue type=error;]Exception in BCConnector.GetAPIData: The underlying connection was closed: An unexpected error occurred on a receive.
2023-05-19T08:13:41.2109355Z *** Selected Company:  []
2023-05-19T08:13:41.2749603Z *** Download [https://www.nuget.org/api/v2/package/Microsoft.OpenApi.OData/1.0.8]
2023-05-19T08:13:42.9778744Z *** Download [https://www.nuget.org/api/v2/package/microsoft.openapi/1.2.2]
2023-05-19T08:13:44.1080450Z *** Download [https://www.nuget.org/api/v2/package/microsoft.odata.edm/7.6.1]
2023-05-19T08:13:46.4316514Z *** Loading Assemblies:
2023-05-19T08:13:46.4323227Z   * Microsoft.OData.Edm, Version=7.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
2023-05-19T08:13:46.4330628Z   * Microsoft.OpenApi, Version=1.2.2.0, Culture=neutral, PublicKeyToken=3f5743946376f042
2023-05-19T08:13:46.4338074Z   * Microsoft.OpenApi.OData.Reader, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
2023-05-19T08:13:46.4348668Z *** Discover Routes
2023-05-19T08:17:55.3703939Z ##[error]Exception in BCConnector.GetAPIData: The underlying connection was closed: An unexpected error occurred on a receive.
2023-05-19T08:17:55.3704854Z ##[debug]Processed: ##vso[task.logissue type=error;]Exception in BCConnector.GetAPIData: The underlying connection was closed: An unexpected error occurred on a receive.
2023-05-19T08:17:55.3727817Z *** Exclude Routes
2023-05-19T08:17:55.3782504Z *** Routes to Convert:
2023-05-19T08:17:55.3794238Z 
2023-05-19T08:17:55.3815393Z *** Export OpenAPI definitions
2023-05-19T08:17:55.3948130Z *** Export BC EDMX To OpenAPI
2023-05-19T08:17:55.3996348Z *** Routes Conversion Performance:
2023-05-19T08:17:55.4019376Z *** Transfer OpenAPI Artifacts from Docker container.
2023-05-19T08:17:55.4461499Z ##[debug]Leaving C:\a\_tasks\ALOpsOpenAPI_cdbb4478-e23e-4bfa-8f7a-1adde1799aca\1.455.3607\b1549363-a7bb-488d-a4ac-deb2efa0ceb1.ps1.
2023-05-19T08:17:55.7255811Z ##[debug]Caught exception from task script.
2023-05-19T08:17:55.7293689Z ##[debug]Error record:
2023-05-19T08:17:55.7937860Z ##[debug]Copy-Item : Cannot find path 'C:\OpenAPI\*' because it does not exist.
2023-05-19T08:17:55.7952805Z ##[debug]At C:\a\_tasks\ALOpsOpenAPI_cdbb4478-e23e-4bfa-8f7a-1adde1799aca\1.455.3607\b1549363-a7bb-488d-a4ac-deb2efa0ceb1.ps1:240 char:9
2023-05-19T08:17:55.7972866Z ##[debug]+         Copy-Item -LiteralPath "C:\OpenAPI\*" `
2023-05-19T08:17:55.8027102Z ##[debug]+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-05-19T08:17:55.8034881Z ##[debug]    + CategoryInfo          : InvalidArgument: (C:\OpenAPI\*:String) [Copy-Item], ArgumentException
2023-05-19T08:17:55.8053110Z ##[debug]    + FullyQualifiedErrorId : RemotePathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
2023-05-19T08:17:55.8070302Z ##[debug] 
2023-05-19T08:17:55.8093634Z ##[debug]Script stack trace:
2023-05-19T08:17:55.8135832Z ##[debug]at <ScriptBlock>, C:\a\_tasks\ALOpsOpenAPI_cdbb4478-e23e-4bfa-8f7a-1adde1799aca\1.455.3607\b1549363-a7bb-488d-a4ac-deb2efa0ceb1.ps1: line 240
2023-05-19T08:17:55.8151677Z ##[debug]at <ScriptBlock>, C:\a\_tasks\ALOpsOpenAPI_cdbb4478-e23e-4bfa-8f7a-1adde1799aca\1.455.3607\46344e9e-1b00-468f-b204-bef0e51036ec.ps1: line 1
2023-05-19T08:17:55.8167502Z ##[debug]at <ScriptBlock>, <No file>: line 1
2023-05-19T08:17:55.8183355Z ##[debug]at <ScriptBlock>, <No file>: line 22
2023-05-19T08:17:55.8198947Z ##[debug]at <ScriptBlock>, <No file>: line 18
2023-05-19T08:17:55.8214939Z ##[debug]at <ScriptBlock>, <No file>: line 1
2023-05-19T08:17:55.8405354Z ##[debug]Exception:
2023-05-19T08:17:55.8457695Z ##[debug]System.ArgumentException: Cannot find path 'C:\OpenAPI\*' because it does not exist.
2023-05-19T08:17:55.8714478Z ##[error]Cannot find path 'C:\OpenAPI\*' because it does not exist.
2023-05-19T08:17:55.8716232Z ##[debug]Processed: ##vso[task.logissue type=error]Cannot find path 'C:\OpenAPI\*' because it does not exist.
2023-05-19T08:17:55.8726075Z ##[debug]Processed: ##vso[task.complete result=Failed]
2023-05-19T08:17:55.9180089Z ##[section]Finishing: Generate OpenAPI descriptions
waldo1001 commented 1 year ago

@epernst ,

Can you please post the yaml when you claim something doesn't work? Also, the debug-mode, really doesn't make it more readable :(.

Take a look at this example as you can find on our example library? https://github.com/HodorNV/ALOps/blob/master/Examples/25_OpenAPI.yml

I'm pretty sure you forgot the enable the API services - as that's where it errors out .. image

epernst commented 1 year ago

No, I did include enable_api_services. Here is my yaml:

     - task: ALOpsDockerCreate@1
        displayName: Create Docker Image
        inputs:
          artifactversion: $(artifactversion)
          artifacttype: $(artifacttype)
          artifactcountry: $(artifactcountry)
          versionselect: $(versionselect)
          imageprefix: $(imageprefix)
          imagenametemplate: $(imagenametemplate)          

      - task: ALOpsDockerStart@1
        displayName: 'Start Docker Container' 
        inputs:
          sql_backup_file: $(sql_backup_file)
          docker_parameters: $(docker_parameters)
          enable_api_services: true        

      - task: ALOpsDockerWait@1
        displayName: 'Wait for Docker Container to start'

      - download: ${{parameters.appPipeline}}
        displayName: Download build artifacts

      - powershell: |
          Write-Host "##[section]Copy apps to AL Cache Folder"
          Remove-Item '$(AppPublishFolder)' -Force -Recurse -ErrorAction SilentlyContinue
          New-Item '$(AppPublishFolder)' -ItemType Directory -Force -ErrorAction SilentlyContinue
          Get-ChildItem '$(AppFolder)' -Filter '*.app' -Recurse | Copy-Item -Destination '$(AppPublishFolder)' -Force
          Get-ChildItem '$(TestAppFolder)' -Filter '*.app' -Recurse | Copy-Item -Destination '$(AppPublishFolder)' -Force
        failOnStderr: true
        displayName: 'Copy apps to App Publish folder'

      - task: ALOpsAppPublish@1
        displayName: Publish Extensions
        inputs:
          usedocker: true
          nav_artifact_app_filter: '*.app'
          skip_verification: true   
          batch_publish_folder: $(AppPublishFolder)      

      - ${{ parameters.publishSteps }}

      - task: ALOpsOpenAPI@1
        displayName: Generate OpenAPI descriptions
        inputs:
          usedocker: true
          api_endpoint: "http://$(ALOPS_DOCKER_HOSTNAME):7048/bc/api"
          authentication: "basic"
          username: "$(ALOPS_DOCKER_ADMINUSER)"
          password: "$(ALOPS_DOCKER_ADMINPASSWORD)"
          export_yaml: true
          export_edmx: true
          export_json: true
          discover: true
          publish_artifacts: true
waldo1001 commented 1 year ago

Well .. not sure.

Can you try without the backupfile (you don't need it for creating OpenAPI)?

waldo1001 commented 1 year ago

Also - can you try literally with my example? https://github.com/HodorNV/ALOps/blob/master/Examples/25_OpenAPI.yml

epernst commented 1 year ago

Tried without any database or apps (just standard) and the result is the same. :(

waldo1001 commented 1 year ago

My example says "https", your yaml says "http" .. that could be it?

Please send your exact yaml that fails... and full log?

epernst commented 1 year ago

That made a different, even if it doesn't work. Now I'm getting: "HTTP Error 404. The requested resource is not found" when it calls: Invoke-RestMethod -Method Get -Uri 'https://5e04e77ff743:7048/bc/api/microsoft/automation/v1.0/companies'

[error]Exception in BCConnector.GetAPIData: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">

Before sharing all the remaning logs/yamls, then please confirm that this task works with BC v14?

waldo1001 commented 1 year ago

v1 API was introduced in v17. This was the first version of API that was converted to OpenAPI. I wasn't able to convert a v14 API to OpenAPI, so I think you just proved that as well ;-).

waldo1001 commented 1 year ago

@epernst , if you have any more questions, please re-open the issue!