HodorNV / ALOps

ALOps
59 stars 24 forks source link

The term 'New-ALOpsV2Compilation' is not recognized as the name of a cmdlet, #532

Closed MortenRa closed 2 years ago

MortenRa commented 2 years ago

Describe the bug Getting this error in our nightly pipeline, no changes in my setup and tried to run this right now still same error

The term 'New-ALOpsV2Compilation' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

the used yaml please provide the yaml that you used. It helps you put the yaml like this:

 - task: ALOpsAppCompiler@2
    displayName: 'Fast compile with AppSourceCop and testing breaking changes -${{ parameters.AppName }}-${{ parameters.artifacttypes }}-${{ parameters.artifactcountries }}-${{ parameters.versionselect }}'
    inputs:
      artifacttype: '${{ parameters.artifacttypes  }}'
      artifactcountry: '${{ parameters.artifactcountries  }}'
      versionselect: '${{ parameters.versionselect }}'
      alcodeanalyzer: $(alcodeanalyzer)
      alsourcepath: ${{ parameters.alsourcepath }}
      appversiontemplate: ${{ parameters.appversiontemplate }}
      sasToken: $(bcSasToken)
      publishxlif: true
      appfilenametemplate: '%APP_PUBLISHER%_%APP_NAME%_%APP_VERSION%_%BC_TYPE%_%BC_VERSION%_%BC_COUNTRY%_APP.app'
      updatebuildnumber: true
      publishartifact: false
      failonwarnings: ${{ parameters.failonwarnings }}

  - task: ALOpsAppSign@1
    displayName: 'ALOps App Sign'
    env:
      pfx_password: $(CodeSignPfxPassword)
    inputs:
      pfx_path: $(CodeSignPfxFile)
      nav_artifact_app_filter: $(BC_Artifact_App_Filter)
      publish_artifact: true
      timestamp_uri: $(TimeStampUri) #'http://timestamp.comodoca.com/authenticode' 
      usedocker: false

  - task: ALOpsInfo@1

the output Also the complete output is necessary for us to see what is going on. Also use backtics:

2022-06-15T08:27:33.9616464Z ##[section]Starting: Fast compile with AppSourceCop and testing breaking changes -Rental Management-Sandbox-w1-NextMinor
2022-06-15T08:27:33.9778071Z ==============================================================================
2022-06-15T08:27:33.9778544Z Task         : ALOps App Compiler
2022-06-15T08:27:33.9778904Z Description  : Compile AL Extension(s) for Business Central
2022-06-15T08:27:33.9779241Z Version      : 2.0.3024
2022-06-15T08:27:33.9779483Z Author       : Hodor
2022-06-15T08:27:33.9779834Z Help         : Compile Business Central extension(s) from AL code.
2022-06-15T08:27:33.9780280Z ==============================================================================
2022-06-15T08:27:36.0563248Z ******************************************************************************
2022-06-15T08:27:36.0589239Z *** ALOps v2 - Preview                                                     ***
2022-06-15T08:27:36.0611298Z ******************************************************************************
2022-06-15T08:27:36.0630726Z *** Importing required ALOps-Functions
2022-06-15T08:27:36.6321022Z *** Task Inputs:
2022-06-15T08:27:36.6391049Z 
2022-06-15T08:27:36.6567148Z name                                             value                                                                 
2022-06-15T08:27:36.6573428Z ----                                             -----                                                                 
2022-06-15T08:27:36.6577521Z artifactversion                                                                                                        
2022-06-15T08:27:36.6581929Z artifacttype                                     Sandbox                                                               
2022-06-15T08:27:36.6586764Z artifactcountry                                  w1                                                                    
2022-06-15T08:27:36.6590988Z versionselect                                    NextMinor                                                             
2022-06-15T08:27:36.6596051Z alternativevsixurl                                                                                                     
2022-06-15T08:27:36.6601541Z alsourcepath                                     App/app.json                                                          
2022-06-15T08:27:36.6655121Z ruleset                                          https://abappsourcestandard01.blob.core.windows.net/cdci/app.rulese...
2022-06-15T08:27:36.6660876Z suppresswarnings                                 KEEP                                                                  
2022-06-15T08:27:36.6664757Z appversiontemplate                               20.0.[yyyyWW].*                                                       
2022-06-15T08:27:36.6670111Z updatebuildnumber                                True                                                                  
2022-06-15T08:27:36.6722763Z appfilenametemplate                              %APP_PUBLISHER%_%APP_NAME%_%APP_VERSION%_%BC_TYPE%_%BC_VERSION%_%BC...
2022-06-15T08:27:36.6726600Z alcodeanalyzer                                   AppSourceCop,CodeCop,UICop                                            
2022-06-15T08:27:36.6730472Z showmycode                                       Keep                                                                  
2022-06-15T08:27:36.6736882Z resourceexposurepolicy_allowdebugging            Keep                                                                  
2022-06-15T08:27:36.6742162Z resourceexposurepolicy_allowdownloadingsource    Keep                                                                  
2022-06-15T08:27:36.6748256Z resourceexposurepolicy_includesourceinsymbolfile Keep                                                                  
2022-06-15T08:27:36.6752046Z applicationinsightskey                                                                                                 
2022-06-15T08:27:36.6756918Z alcachepath                                      C:\Agent\NightlySCBAgent\_work\112\s                                  
2022-06-15T08:27:36.6761345Z publishartifact                                  False                                                                 
2022-06-15T08:27:36.6767136Z publishxlif                                      True                                                                  
2022-06-15T08:27:36.6770852Z failonwarnings                                   False                                                                 
2022-06-15T08:27:36.6777170Z storageaccount                                                                                                         
2022-06-15T08:27:36.6830150Z sastoken                                        
2022-06-15T08:27:36.6833573Z printappmanifest                                 True                                                                  
2022-06-15T08:27:36.6845820Z outputalclogs                                    True                                                                  
2022-06-15T08:27:36.6850857Z additionalprobingpaths                                                                                                 
2022-06-15T08:27:36.6851579Z 
2022-06-15T08:27:36.6880713Z 
2022-06-15T08:27:36.6891895Z 
2022-06-15T08:27:36.7105129Z *** For documentation, please visit   : https://www.alops.be/documentation
2022-06-15T08:27:36.7112481Z 
2022-06-15T08:27:37.0866344Z *** Importing required Task-Functions
2022-06-15T08:27:37.8349503Z 
2022-06-15T08:27:37.8748349Z *** Artifact Type   : [Sandbox]
2022-06-15T08:27:37.8768047Z *** Artifact Version: []
2022-06-15T08:27:37.8787044Z *** Artifact Country: [w1]
2022-06-15T08:27:37.8806582Z *** AL Source Path  : [App/app.json]
2022-06-15T08:27:37.8824275Z *** AL Cache Path   : [C:\Agent\NightlySCBAgent\_work\112\s]
2022-06-15T08:27:37.8830781Z 
2022-06-15T08:27:37.8864851Z 
2022-06-15T08:27:37.9162519Z *** Default Working Folder: C:\Agent\NightlySCBAgent\_work\112\s
2022-06-15T08:27:37.9177037Z *** Artifact Folder       : C:\Agent\NightlySCBAgent\_work\112\a
2022-06-15T08:27:37.9190731Z *** Agent Tool Folder     : C:\Agent\NightlySCBAgent\_work\_tool
2022-06-15T08:27:37.9204686Z *** Agent Temp Folder     : C:\Agent\NightlySCBAgent\_work\_temp
2022-06-15T08:27:37.9210800Z 
2022-06-15T08:27:37.9267455Z *** Resolving Path: [App/app.json]
2022-06-15T08:27:37.9317947Z *** Resolved Path : [C:\Agent\NightlySCBAgent\_work\112\s\App\app.json]
2022-06-15T08:27:37.9335634Z *** AL Source Folder      : C:\Agent\NightlySCBAgent\_work\112\s\App\app.json
2022-06-15T08:27:37.9355530Z *** Resolving Path: [C:\Agent\NightlySCBAgent\_work\112\s]
2022-06-15T08:27:37.9394640Z *** AL Cache Folder       : C:\Agent\NightlySCBAgent\_work\112\s
2022-06-15T08:27:37.9401278Z 
2022-06-15T08:27:37.9428356Z *** Check BcContainerHelper
2022-06-15T08:27:38.2604571Z *** Load BcContainerHelper
2022-06-15T08:27:38.3073883Z BcContainerHelper version 3.0.10
2022-06-15T08:27:38.5243863Z BcContainerHelper emits usage statistics telemetry to Microsoft
2022-06-15T08:27:39.4081255Z 
2022-06-15T08:27:39.4089252Z 
2022-06-15T08:27:39.4176487Z ##[command]"Get-BCArtifactUrl" 
2022-06-15T08:27:39.4177709Z Name                           Value                                                                                   
2022-06-15T08:27:39.4179240Z ----                           -----                                                                                   
2022-06-15T08:27:39.4180457Z 
2022-06-15T08:27:39.4182421Z select                         NextMinor                                                                               
2022-06-15T08:27:39.4183014Z type                           Sandbox                                                                                 
2022-06-15T08:27:39.4184613Z country                        w1                                                                                      
2022-06-15T08:27:39.4184828Z 
2022-06-15T08:27:39.4184941Z 
2022-06-15T08:27:39.4186508Z  -sasToken: *** -select: NextMinor -type: Sandbox -country: w1
2022-06-15T08:28:07.4379362Z *** Platform: c:\bcartifacts.cache\sandbox\20.3.42202.0\platform
2022-06-15T08:28:07.4413749Z *** Localisation: c:\bcartifacts.cache\sandbox\20.3.42202.0\w1
2022-06-15T08:28:07.4820806Z *** BC Management DLL: C:\bcartifacts.cache\sandbox\20.3.42202.0\platform\ServiceTier\program files\Microsoft Dynamics NAV\200\Service\Microsoft.Dynamics.Nav.Management.dll
2022-06-15T08:28:07.5397225Z *** BC App Management DLL: C:\bcartifacts.cache\sandbox\20.3.42202.0\platform\ServiceTier\program files\Microsoft Dynamics NAV\200\Service\Microsoft.Dynamics.Nav.Apps.Management.dll
2022-06-15T08:28:07.5955625Z *** Specific App Manifest specified: [C:\Agent\NightlySCBAgent\_work\112\s\App\app.json]
2022-06-15T08:28:07.6014093Z *** Found [1] file.
2022-06-15T08:28:07.6029593Z *** Extract App detail from [C:\Agent\NightlySCBAgent\_work\112\s\App\app.json]
2022-06-15T08:28:07.6362398Z *** Starting Batch compile of Apps:
2022-06-15T08:28:07.6411136Z   * C:\Agent\NightlySCBAgent\_work\112\s\App
2022-06-15T08:28:07.6432366Z *** Start Compiling: [C:\Agent\NightlySCBAgent\_work\112\s\App]
2022-06-15T08:28:07.8559233Z ##[error]The term 'New-ALOpsV2Compilation' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2022-06-15T08:28:07.9111295Z ##[section]Finishing: Fast compile with AppSourceCop and testing breaking changes -Rental Management-Sandbox-w1-NextMinor

Expected behavior not to fail

MortenRa commented 2 years ago

@waldo1001 can you check if this is on your site, currently stuck for compiling any apps

panas78 commented 2 years ago

@waldo1001 Same here, before that i got a failed pipeline stating that a potential virus or threat found. I put the whole agent folder in defenders exclusion list.

[error]The term '.\5b0df20d-fb55-4c26-a587-35fca8680bac.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Finishing: ALOPS - Compile Extension: App

After that we also get the above error about a missing ps1 script.

Update: After setting exclusion the files must also be restored so the pipelines start working again

waldo1001 commented 2 years ago

Please read the previous issue: https://github.com/HodorNV/ALOps/issues/531

I think it's the same "issue" .. where defender is enabled and wrongfully accusing the script to be malicious.. . We don't have defender "under control" .. and the script hasn't changed for ages.

If you have tips on how to prevent this, I'm all ears.

We simply have an exclusion on the build-directory .. which prevents this behaviour..

MortenRa commented 2 years ago

@waldo1001 Same here, before that i got a failed pipeline stating that a potential virus or threat found. I put the whole agent folder in defenders exclusion list.

[error]The term '.\5b0df20d-fb55-4c26-a587-35fca8680bac.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Finishing: ALOPS - Compile Extension: App

After that we also get the above error about a missing ps1 script.

Update: After setting exclusion the files must also be restored so the pipelines start working again

@panas78 what do you mean when you write it should be restored?

panas78 commented 2 years ago

@MortenRa Defender had them on quarantine so you must restore the "infected" files after you set the folder to exclusion list

MortenRa commented 2 years ago

@panas78 okey files are restored, but still get errors in pipeline in regards to missing .ps1

panas78 commented 2 years ago

@MortenRa Don't know, after doing the same process on all agents every pipeline started working again

MortenRa commented 2 years ago

I have 2 build agent server, on the first I had file that was "infected" but on build server 2 which runs in the weekend no "infected" files but still error, I have added agent folders to exclusion list but still get this error

[error]The term 'New-ALOpsV2Compilation' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

waldo1001 commented 2 years ago

Can you try to rebuild the agent?
Remove service, remove folder, re-install the agent.. ?

MortenRa commented 2 years ago

@waldo1001 after cleaning and remove service etc. I´m back on track again.

waldo1001 commented 2 years ago

Thanks for letting me know! have a nice weekend!