Native installers for azdata in auto deployment (#8285)

* code complete

* minor fixes from self-review

* installation searchaPaths and display logs fixes

* revert inadvertent change

* fixing installaton roott for debian and mac

* Chaning from getos to linux-release-info with sync api usage for figuring out os distribution

* adding file missed in previous commit

* fixing indvertent compile error that creeped in

* fix default install root for azli
This commit is contained in:
Arvind Ranasaria
2019-11-17 21:39:57 -08:00
committed by GitHub
parent dae71c3bf4
commit bafd9fd437
11 changed files with 529 additions and 449 deletions

View File

@@ -8,12 +8,15 @@ import { SemVer } from 'semver';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { azdataPipInstallArgsKey, AzdataPipInstallUriKey, DeploymentConfigurationKey } from '../../constants';
import { Command, OsType, ToolType } from '../../interfaces';
import { Command, OsDistribution, ToolType } from '../../interfaces';
import { IPlatformService } from '../platformService';
import { dependencyType, ToolBase } from './toolBase';
const localize = nls.loadMessageBundle();
export const AzdataToolName = 'azdata';
const win32InstallationRoot = `${process.env['ProgramFiles(x86)']}\\Microsoft SDKs\\Azdata\\CLI\\wbin`;
const macInstallationRoot = '/usr/local/bin';
const debianInstallationRoot = '/usr/local/bin';
export class AzdataTool extends ToolBase {
constructor(platformService: IPlatformService) {
@@ -65,7 +68,13 @@ export class AzdataTool extends ToolBase {
}
protected async getSearchPaths(): Promise<string[]> {
switch (this.osType) {
switch (this.osDistribution) {
case OsDistribution.win32:
return [win32InstallationRoot];
case OsDistribution.darwin:
return [macInstallationRoot];
case OsDistribution.debian:
return [debianInstallationRoot];
default:
const azdataCliInstallLocation = await this.getPip3InstallLocation('azdata-cli');
if (azdataCliInstallLocation) {
@@ -76,12 +85,12 @@ export class AzdataTool extends ToolBase {
}
}
protected get allInstallationCommands(): Map<OsType, Command[]> {
return new Map<OsType, Command[]>([
[OsType.linux, this.defaultInstallationCommands],
[OsType.win32, this.defaultInstallationCommands],
[OsType.darwin, this.defaultInstallationCommands],
[OsType.others, this.defaultInstallationCommands]
protected get allInstallationCommands(): Map<OsDistribution, Command[]> {
return new Map<OsDistribution, Command[]>([
[OsDistribution.debian, debianInstallationCommands],
[OsDistribution.win32, win32InstallationCommands],
[OsDistribution.darwin, macOsInstallationCommands],
[OsDistribution.others, this.defaultInstallationCommands]
]);
}
@@ -114,16 +123,45 @@ export class AzdataTool extends ToolBase {
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[azdataPipInstallArgsKey];
}
protected dependenciesByOsType: Map<OsType, dependencyType[]> = new Map<OsType, dependencyType[]>([
[OsType.linux, [dependencyType.PythonAndPip3]],
[OsType.win32, [dependencyType.PythonAndPip3]],
[OsType.darwin, [dependencyType.PythonAndPip3]],
[OsType.others, [dependencyType.PythonAndPip3]]
protected dependenciesByOsType: Map<OsDistribution, dependencyType[]> = new Map<OsDistribution, dependencyType[]>([
[OsDistribution.debian, []],
[OsDistribution.win32, []],
[OsDistribution.darwin, []],
[OsDistribution.others, [dependencyType.PythonAndPip3]]
]);
}
/*
const linuxInstallationCommands = [
const win32InstallationCommands = [
{
comment: localize('resourceDeployment.Azdata.DeletingPreviousAzdata.msi', "deleting previously downloaded Azdata.msi if one exists …"),
command: `IF EXIST .\\Azdata.msi DEL /F .\\Azdata.msi`
},
{
sudo: true,
comment: localize('resourceDeployment.Azdata.DownloadingAndInstallingAzdata', "downloading Azdata.msi and installing azdata-cli …"),
command: `powershell -Command "& {(New-Object System.Net.WebClient).DownloadFile('https://aka.ms/azdata-msi', 'Azdata.msi'); Start-Process msiexec.exe -Wait -ArgumentList '/I Azdata.msi /passive /quiet /lvx ADS_AzdataInstall.log'}"`
},
{
comment: localize('resourceDeployment.Azdata.DisplayingInstallationLog', "displaying the installation log …"),
command: `type ADS_AzdataInstall.log | findstr /i /v ^MSI"`,
ignoreError: true
}
];
const macOsInstallationCommands = [
{
comment: localize('resourceDeployment.Azdata.TappingBrewRepository', "tapping into the brew repository for azdata-cli …"),
command: 'brew tap microsoft/azdata-cli-release'
},
{
comment: localize('resourceDeployment.Azdata.UpdatingBrewRepository', "updating the brew repository for azdata-cli installation …"),
command: 'brew update'
},
{
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata …"),
command: 'brew install azdata-cli'
}
];
const debianInstallationCommands = [
{
sudo: true,
comment: localize('resourceDeployment.Azdata.AptGetUpdate', "updating repository information …"),
@@ -141,8 +179,8 @@ const linuxInstallationCommands = [
},
{
sudo: true,
comment: localize('resourceDeployment.Azdata.AddingAzureCliRepositoryInformation', "adding the azdata repository information …"),
command: 'add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-preview.list)"'
comment: localize('resourceDeployment.Azdata.AddingAzdataRepositoryInformation', "adding the azdata repository information …"),
command: 'add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)"'
},
{
sudo: true,
@@ -155,4 +193,3 @@ const linuxInstallationCommands = [
command: 'apt-get install -y azdata-cli'
}
];
*/