How to install azCopy on linux in vsts online build task? - linux

My goal is, on hosted linux preview, copy built/archived zip file to azure storage file system.
On Hosted linux preview , I would like to copy build archive (single zip file) from VSTS build to azure storage file using azCopy. I've tried both flavors of instructions for install for linux. Both fail with
2018-05-06T23:59:51.7967023Z 2018-05-06 23:59:50 (53.5 MB/s) - ‘azcopy.tar.gz’ saved [68428738/68428738]
2018-05-06T23:59:51.7975469Z
2018-05-06T23:59:52.8481973Z ./install.sh: line 20: rsync: command not found
Everything before and after this error is correct. How do I install azCopy into Hosted linux preview.
The build task runs a script. The variables in the script echo correctly.
EDITS :
When I try to use the command line to use azCopy directly, I get
******************************************************************************
Starting: Run azCopy
******************************************************************************
==============================================================================
Task : Command Line
Description : Run a command line with arguments
Version : 1.1.3
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
Failed which: Not found azCopy: null
undefined failed with error: Failed which: Not found azCopy: null
******************************************************************************
Finishing: Run azCopy
******************************************************************************

The azCopy is available on Hosted linux preview agent, so call azcopy command directly (e.g. Command line, azure cli tasks)

Related

run EF Migration in Azure DevOps pipleline

I am new to the Azure Devops. Your help is very appreciated!! thanks!
I am trying to add EF migration into my project build/release pipeline. I got error on task : build EF Migration by using Command line:
migrations script -i -p TestDBDDeploy -o $(Build.ArtifactStagingDirectory)/Migrations/migration.sql
error showed:
Starting: Build EF Migration
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.201.1
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/ef141c6d-a3c5-4563-aac6-3418165fd854.sh
You can invoke the tool using the following command: dotnet-ef
Tool 'dotnet-ef' (version '6.0.9') was successfully installed.
/home/vsts/work/_temp/ef141c6d-a3c5-4563-aac6-3418165fd854.sh: line 2: migrations: command not found
##[error]Bash exited with code '127'.

electron-winstaller throws The system cannot find the path specified. at Squirrel.Utility.<CreateZipFromDirectory>d__23.MoveNext()<---

I am trying to build a electron installer for windows platform in Azure DevOps. I have successfully ran the electron-package command with npm run build (look at my package.json). After that when I try to run the command to create the RELEASES, .msi, .exe and .nupkg files with electron-winstaller it throws an error saying:
The system cannot find the path specified.
at Squirrel.Utility.d__23.MoveNext()<---
The command that I executed was npm run create-installer-win which executes the command node build.js.
The build runs in a on-premises agent with windows server 2014.
Locally everything works fine.
Image of my build.js
Image of my package.json
enter image description here
The was with Squirrel.
My agent is running with NT AUTHORITY\System user which does not have permission to create the SquirrelTemp folder in %appdata%. When it try to create de folder in current folder it throws the error because it does not find the SquirrelTemp folder.
The solution I have found was to set a environment variable SQUIRREL_TEMP in the build pipeline with the value to %currentfolder%\SquirrelTemp and it works.
Thanks to https://github.com/Squirrel/Squirrel.Windows/issues/1081#issuecomment-340958128

Pull and Run a Linux docker image on an azure pipeline

When pulling and running a Linux docker based image in AZURE PIPELINE, I get this error:
"image operating system "Linux" cannot be used on this platform"
I create a Linux docker image
I pushed the image to azure registry
I setup the azure pipeline as follow:
Docker CLI
Azure CLI:
I login to registry
Command Line:
I do: docker pull image
I do: docker run -it image
When I run the pipeline, I get this error:
"image operating system "Linux" cannot be used on this platform"
Script output:
2019-03-25T21:23:03.4513990Z ##[section]Starting: Command Line Script
2019-03-25T21:23:03.4616971Z ==============================================================================
2019-03-25T21:23:03.4617284Z Task : Command Line
2019-03-25T21:23:03.4617442Z Description : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
2019-03-25T21:23:03.4617592Z Version : 2.146.1
2019-03-25T21:23:03.4617715Z Author : Microsoft Corporation
2019-03-25T21:23:03.4618046Z ==============================================================================
2019-03-25T21:23:04.8241638Z Generating script.
2019-03-25T21:23:04.9020040Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\157d3a61-fe5f-46b2-b74e-1082d4532014.cmd""
2019-03-25T21:23:05.7814076Z v1: Pulling from hubb-api-tests
2019-03-25T21:23:06.2370457Z image operating system "linux" cannot be used on this platform
2019-03-25T21:23:06.2872386Z the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
2019-03-25T21:23:06.3934386Z ##[error]Cmd.exe exited with code '1'.
2019-03-25T21:23:06.4549404Z ##[section]Finishing: Command Line Script
I expect to be able to pull the image and run it on Azure DevOps pipeline since I tested the same steps on my local computer with no problems.
Thank you so very much
You can only achieve this using your own windows agent configured to allow to run linux containers on windows. hosted agents wont allow that.

Cannot install Azure Dev Spaces using cloud shell in AKS

When i run the below command in cloud shell.
az aks use-dev-spaces -g aksrgrp -n akscluster
I get the below error. Any help will be highly appreciated
You may be prompted for your administrator password to authorize the installation process.
/tmp/tmpy1vng2we/azds-linux-setup.sh: line 84: sudo: command not found
/tmp/tmpy1vng2we/azds-linux-setup.sh: line 112: sudo: command not found
[INFO] Failed to install dotnet core dependencies.
[INFO] You can manually install all required dependencies based on the following documentation:
[FATAL] https://www.microsoft.com/net/download/dotnet-core/2.1
Azure Dev Spaces CLI not installed properly. Visit 'https://aka.ms/get-azds' for Azure Dev Spaces.
The error shows why the issue happens. It cannot find the command azds. Because the cloud shell does not install the command tool. You can find all the command tools installed in the cloud shell here.
I suggest you can install the tool which you need in the Azure VM of the azure Kubernetes, if you do not find the tool what you want.
It's a better way for you. By the way, the Cloud Shell just enables access to a browser-based command-line experience built with Azure management tasks in mind. So install the Azure CLI in the VM is a better experience.
To add to Charles's answer: the Azure Dev Spaces CLI currently does not support running in the Cloud Shell. Its functionality is designed more for running on your local dev machine where you application's source code is.

Error: C:\Program Files\Docker\docker.exe: failed to register layer: re-exec error: exit status 1: output: ProcessUtilityVMImage

Steps to reproduce the problem
Step 1. Create a .NET Core 2.0 console app for Dockerization
d:\Hello> dotnet new console
Step 2. Add a new file dockerfile to the folder d:\Hello:
FROM microsoft/dotnet
WORKDIR /app
copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
copy and build everything else
COPY . ./
RUN dotnet publish -c Release -o out
ENTRYPOINT ["dotnet", "out/Hello.dll"]
Step 3: Push the Docker Image to repository.
d:\Hello> docker image push sandeepsoni/demo
Step 4: Created a New VM in Windows Azure (Windows Server 2016 with Container)
Step 5: From the VM executing the following command
c:> docker run sandeepsoni\demo
It's downloading the files and after extracting giving the following error:
C:\Program Files\Docker\docker.exe: failed to register layer: re-exec error: exit status 1: output: ProcessUtilityVMImage C:\ProgramData\docker\windowsfilter\67d5b7d6c870c7ec84a26def53bb3882da856a2e55f2f94e52d651293f4e3547\UtilityVM: The system cannot find the path specified.
Can you please help with the error and solution.
Thanks.
I've seen such error when I tried to run my Docker images built for Windows Server 1709 (newer and smaller images) on Windows Server 2016 host. MS introduced major breaking change for their base images. You cannot run images built for Windows 1709 on Windows Server 2016 (long-term support channel) unless you use hyperv isolation.
Try to switch base image from
FROM microsoft/dotnet
to
FROM microsoft/dotnet:2.0-sdk-nanoserver-sac2016

Resources