arm template, customscriptextension is failing with returned a non-zero exit code of: '1'. Command execution may have been interrupted by a VM restart - arm-template

i have a arm template that contains a customscriptextension that is meant to install an app (Sophos AV and Notepad++) from a storage account.
the deployment is picking up the storageaccount correctly and copying the sophos.ps1 file from the blob storage account and adding it to the VM.
i can find the file in this location
C:\Packages\Plugins\Microsoft.Compute.CustomScriptExtension\1.10.12\Downloads\0
the log file for the customscriptextension shows that sophos file is downloaded.
[INFO] DownloadFiles: fileUri = https://stgacctname.blob.core.windows.net/scripts/sophos.ps1
[INFO] DownloadFiles: fileDownloadPath = C:\Packages\Plugins\Microsoft.Compute.CustomScriptExtension\1.10.12\Downloads\0
[INFO] Waiting for all async file download tasks to complete...
[INFO] DownloadFiles: asynchronously downloaded file to fileDownloadLocation = Downloads\0\sophos.ps1
[INFO] Files downloaded. Asynchronously executing command: 'SecureCommand_0'
[INFO] Command execution task started. Awaiting completion...
but the install of this file is failing and spitting out this error
**[ERROR] Command execution finished, but failed because it returned a non-zero exit code of: '1'. Command execution may have been interrupted by a VM restart**
[INFO] {"sequenceNumber":0,"totalDuration":21317,"status":"error","code":1,"filesDownloaded":1,"durationOfFileDownload":336,"durationOfDownloadHashing":0,"statusFileAccessed":5,"operation":"enable","operationDuration":123,"operationResult":"success","operationSizeOfOutput":42,"operationSizeOfError":0,"sha256HashOfCommandToExecute":"HASHNUMBER","downloadSummary":{"downloadUris":["https://stgacctname.blob.core.windows.net/scripts/sophos.ps1"],"fileHashes":[{"fileName":"sophos.ps1","sha256Hash":"HASHNUMBER"}]}}
the sophos.ps1 file contains the following
Set-ExecutionPolicy Bypass
cmdkey /add:stgacctname.file.core.windows.net /user:AZURE\stgacctname /pass:sttgacctkey
\\stgacctname.file.core.windows.net\fileshare\SophosSetup.exe --quiet --devicegroup="Test servers"
\\stgacctname.file.core.windows.net\fileshare\npp.8.1.4.Installer.x64.exe /S
when i open the PS1 file and run it as admin it runs and installs sophos without any issues.
so question is...why is it failing here?
my thoughts are that the PS1 file is not being run as admin... its running as a standard user so its failing.. but thats just pure speculation.
can anybody shed some light on what could be happening?
let me know if you need any more info...
in the mean time i will keep digging around....
cheers!

Related

QA Pipeline Run failing in Azure

I'm using Testcomplete as my automation tool. Our pipeline is in Azure and its newly created for QA runs. The test VM was set up in VMSS in Azure. I'm using TestExecute as my test runner. Testexecute is already installed in the VM. When i run the pipeline, I'm getting an error which says
</RunSettings>
**************** Starting test execution *********************
C:\a\_tool\VsTest\17.4.0-preview-20220726-02\x64\tools\net462\Common7\IDE\Extensions\TestPlatform\vstest.console.exe "#C:\a\_temp\4hdijfnknda.tmp"
Microsoft (R) Test Execution Command Line Tool Version 17.4.0-preview-20220726-02 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
vstest.console.exe "C:\a\1\s\GrizzlyMatters.pjs"
/Settings:"C:\a\_temp\ro5un5cn0ip.tmp.runsettings"
/Logger:"trx"
/TestAdapterPath:"C:\a\1\s\TestCompleteAdapter"
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
##[error]Failed to get a list of tests from the "C:\a\1\s\GrizzlyMatters.pjs" file due to the following error: Unable to connect to TestExecute: it is running with different rights, or its state is incorrect. Please close it and try again.
No test is available in C:\a\1\s\GrizzlyMatters.pjs. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Results File: C:\a\_temp\TestResults\AzDevOps_vmliaqa000008_2022-09-01_14_51_35.trx
##[error]Test Run Failed.
Vstest.console.exe exited with code 1.
**************** Completed test execution *********************
Test results files: C:\a\_temp\TestResults\AzDevOps_vmliaqa000008_2022-09-01_14_51_35.trx
No Result Found to Publish 'C:\a\_temp\TestResults\AzDevOps_vmliaqa000008_2022-09-01_14_51_35.trx'.
Created test run: 2724386
Publishing test results: 0
Publishing test results to test run '2724386'.
TestResults To Publish 0, Test run id:2724386
Published test results: 0
Publishing Attachments: 1
Execution Result Code 1 is non zero, checking for failed results
Completed TestExecution Model...
##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.
##[error]Error: The process 'C:\a\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.205.0\Modules\DTAExecutionHost.exe' failed with exit code 1
##[error]Vstest failed with error. Check logs for failures. There might be failed tests.
Finishing: VsTest - testAssemblies
I've researched everything possible to get a solution. I'm not sure what I need to do. I'm attaching the screenshot of the pipeline config and the error.
Screenshots
Pipeline config 1:
Pipeline config 2:
Pipeline config 3:
Pipeline Run Error:

Publishing Azure Function Using CloudShell

I am using CloudShell to publish AzureFunction. I was able to publish the AzureFunction previously but today I am getting this Error while executing the publish command func azure functionapp publish <APP_NAME>
Getting site publishing info...
Creating archive for current directory...
Performing remote build for functions project. Deleting the old .python_packages directory Uploading 15.91 KB [##############################################################################]
Remote build in progress, please wait...
Unexpected character encountered while parsing value: {. Path '[0].build_summary', line 1, position 630.

Could not build Docker image WindowsServerCodre on Azure DevOps

I'm trying to build some Windows docker images on Azure Devops. However, during the last step I get:
re-exec error: exit status 1: output: time="2018-10-29T14:26:32Z" level=error msg="hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\\?\C:\ProgramData\docker\windowsfilter\e5d6a8d03464d02106a603b183b1ea47ad9fdd910a7dc1fdf19f605ec343b9cb flavour=1 folder=C:\ProgramData\docker\tmp\hcs934975059"
2018-10-29T14:26:34.2133323Z hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\?\C:\ProgramData\docker\windowsfilter\e5d6a8d03464d02106a603b183b1ea47ad9fdd910a7dc1fdf19f605ec343b9cb flavour=1 folder=C:\ProgramData\docker\tmp\hcs934975059
The weird thing is that I have the exactly same branch on my personal account and it works! It only fails for conan-io organization!
What I could do to fix it?
It's possible to check all windowsservercore here. I can't use 1709 or 1803 because of my environment.
Logs are available here:
[success] https://dev.azure.com/uilianr/conan-devops/_build/results?buildId=92&view=logs
[failing] https://dev.azure.com/conanio/conan-docker-tools/_build/results?buildId=28&view=logs
Docker recipes are here (same file on both repositories):
[uilianries] https://github.com/uilianries/conan-docker-tools/blob/feature/docker-windows/msvc_14/Dockerfile
[conan-io] https://github.com/conan-io/conan-docker-tools/blob/feature/docker-windows/msvc_14/Dockerfile

Deleting Workspace Post Maven Execution in LInux Machine

Our frame work is developed in a way that the whole project will be copied (from Perforce) to Linux machine (remote VM machine) and there a Maven command is executed to run test cases. Everything is driven through Jenkins.
After executing the test cases, I delete the workspace using an Execute shell post Maven build step. As expected it's deleting the workspace. My problem after deleting the workspace: not sure why again it's parsing POM? This causes the job to fail though test cases executed successfully.
This is how I configured to delete the workspace:
Upon running job, it's deleting the workspace as expected but parsing POM post deletion. Obviously POM will not be there as it deleted the workspace.
INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:11:26.091s
[INFO] Finished at: Mon Nov 02 22:50:42 PST 2015
[INFO] Final Memory: 133M/489M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
Waiting for Jenkins to finish collecting data
channel stopped
[testjob] $ /bin/sh -xe /tmp/hudson464395510348605766.sh
+ echo testjob
testjob
+ delworkspace=/opt/hudson/workspace/testjob
+ rm -rf /opt/hudson/workspace/testjob
ERROR: Failed to parse POMs
java.io.IOException: java.io.FileNotFoundException: /opt/hudson/workspace/testjob/pom.xml (No such file or directory)
at hudson.remoting.FastPipedInputStream.read(FastPipedInputStream.java:169)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Notifying upstream projects of job completion
Finished: FAILURE
Do I miss anything in configuration? I did all homework, but no luck.
You can do it with Parameterized Trigger Plugin easily.
What you should do: create a new job (say, named cleanWS), when build is completed, it will trigger cleanWS & delete your job's workspace instantly.
Go testjob configure -> select Execute shell from Build section -> copy and paste echo delworkspace=/opt/hudson/workspace/$JOB_NAME >> file.properties.
In Post-build Actions section:
Add post-build action -> Trigger parameterized build on the projects
Projects to build -> <job name e.g. cleanWS>
Trigger when build is -> Complete (always trigger)
Add Parameters -> Parameters from properties file
Use properties from file -> file.properties
press save.
Then go your cleanWS configure -> select Execute shell from Build section -> copy and paste rm -rf $delworkspace.
N.B. With this cleanWS job you can delete your all job's workspace.
I'd use the Workspace Cleanup Plugin:
This plugin deletes the workspace before the build or when a build is finished and artifacts saved.
instead of removing the workspace via an own script.

Upload of WebJob fails with Azure CLI on Linux (process out of memory)

We are trying to use the Azure CLI on linux to upload a WebJob as part of our continuous deployment pipeline.
azure site job upload -v $WEB_JOB_NAME $WEB_JOB_TYPE run.zip $WEB_SITE_NAME
But the command fails after > 20 mins of waiting on the "Uploading WebJob" step.
FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory
Some more info:
The cli is properly authenticated. We can trigger already existing WebJobs just fine.
The exact same run.zip uploads successfully from Microsoft Azure Powershell on Windows.
The zip-file contains a runnable jar, and a small .cmd-script to start it. File size: 30 MB
We tried setting the verbose-flag, but it does not give any more information.
It looks like a bug in the xplat-cli. I don't think it's related to linux because I get the same error when I run the xplat-cli on Windows with a zip file that's around 30 MB too. I'd suggest opening an issue for them here https://github.com/Azure/azure-xplat-cli/issues
Workaround:
You can use the cli to get the site creds and then use curl to upload the webjob. Here is a little script that would do that.
# get site config from azure cli
siteConfig=`azure site show $WEB_SITE_NAME -d --json`
# extract publishing username and password for the site
publishingUserName=`echo $siteConfig| python -c "import json,sys;obj=json.load(sys.stdin);print obj['config']['publishingUserName'];"`
publishingPassword=`echo $siteConfig| python -c "import json,sys;obj=json.load(sys.stdin);print obj['config']['publishingPassword'];"`
siteScmUrl=`echo $siteConfig | python -c "import json,sys;obj=json.load(sys.stdin);print obj['site']['siteProperties']['properties']['RepositoryUri'];"`
# build the path for the webjob on the server
jobPath="zip/site/wwwroot/App_Data/jobs/$WEB_JOB_TYPE/$WEB_JOB_NAME"
fullUrl=$siteScmUrl$jobPath
# Upload the zip file using curl
curl -XPUT --data-binary #run.zip -u $publishingUserName:$publishingPassword $fullUrl
You can read more about the webjob REST APIs here https://github.com/projectkudu/kudu/wiki/WebJobs-API

Resources