mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-23 21:30:29 -04:00
Feat/tool install master merge back to master (#7819)
* add install tools button (#7454) * add install tools button * address comments * remove description for install tools hint message * First working version of AutoDeployment of tools (#7647) First working version of AutoDeployment of tools. This pull request adds feature to install the tools needed for doing BDC/TINA deployments. This has been tested so far only on win32 and testing on other platforms is in progress. * removing TODO and redundant code * Not localizing azuredatastudio product name * convert methods returning Promises to async-await * changing from null to undefined * Localize all the command labels * using existing sudo-prompt typings * progres/error status in ModalDialogue && PR fixes * review feedback to change warning to information * revert settings.json changes * fix resource-Deployment Extension Unit Test * ensuring platform service's working directory * incorporate review feedback * review feedback * addressing PR feedback * PR fixes * PR Feedback * remove debug logs * disable UI deployment containers when installing * addding data type to stdout/stderr messaging * remove commented code * revert accidental change * addressing review feedback * fix failed install with zero exit code * fixing bug due to typo * fixes for linux * Misc fixes during mac testing * PR fixes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ToolType } from '../../interfaces';
|
||||
import { Command, ToolType, OsType } from '../../interfaces';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { SemVer } from 'semver';
|
||||
import { IPlatformService } from '../platformService';
|
||||
@@ -21,7 +21,7 @@ export class KubeCtlTool extends ToolBase {
|
||||
}
|
||||
|
||||
get description(): string {
|
||||
return localize('resourceDeployment.KubeCtlDescription', 'A command-line tool allows you to run commands against Kubernetes clusters');
|
||||
return localize('resourceDeployment.KubeCtlDescription', "A command-line tool allows you to run commands against Kubernetes clusters");
|
||||
}
|
||||
|
||||
get type(): ToolType {
|
||||
@@ -29,7 +29,7 @@ export class KubeCtlTool extends ToolBase {
|
||||
}
|
||||
|
||||
get displayName(): string {
|
||||
return localize('resourceDeployment.KubeCtlDisplayName', 'kubectl');
|
||||
return localize('resourceDeployment.KubeCtlDisplayName', "kubectl");
|
||||
}
|
||||
|
||||
get homePage(): string {
|
||||
@@ -45,7 +45,101 @@ export class KubeCtlTool extends ToolBase {
|
||||
return version;
|
||||
}
|
||||
|
||||
protected get versionCommand(): string {
|
||||
return 'kubectl version -o json --client';
|
||||
protected get versionCommand(): Command {
|
||||
return { command: 'kubectl version -o json --client' };
|
||||
}
|
||||
|
||||
get autoInstallSupported(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
|
||||
[OsType.linux, linuxInstallationCommands],
|
||||
[OsType.win32, win32InstallationCommands],
|
||||
[OsType.darwin, macOsInstallationCommands],
|
||||
[OsType.others, defaultInstallationCommands]
|
||||
]);
|
||||
}
|
||||
|
||||
const macOsInstallationCommands = [
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.UpdatingBrewRepository', "updating your brew repository for kubectl installation ..."),
|
||||
command: 'brew update'
|
||||
},
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.InstallingKubeCtl', "installing kubectl ..."),
|
||||
command: 'brew install kubectl'
|
||||
}
|
||||
];
|
||||
const linuxInstallationCommands = [
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.AptGetUpdate', "updating repository information ..."),
|
||||
command: 'apt-get update'
|
||||
},
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.AptGetPackages', "getting packages needed for kubectl installation ..."),
|
||||
command: 'apt-get install -y apt-transport-https'
|
||||
},
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.DownloadAndInstallingSigningKey', "downloading and installing the signing key for kubectl ..."),
|
||||
command: 'curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -'
|
||||
},
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.AddingKubectlRepositoryInformation', "adding the kubectl repository information ..."),
|
||||
command: 'echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list'
|
||||
},
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.AptGetUpdate', "updating repository information ..."),
|
||||
command: 'apt-get update'
|
||||
},
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.InstallingKubectl', "installing kubectl ..."),
|
||||
command: 'apt-get install -y kubectl'
|
||||
}
|
||||
];
|
||||
// TODO: Remove dependency on curl on Win32 and use powershell Invoke-WebRequest instead
|
||||
const win32InstallationCommands = [
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.DeletePreviousDownloadedKubectl.exe', "deleting previously downloaded kubectl.exe if one exists ..."),
|
||||
command: `IF EXIST .\kubectl.exe DEL /F .\kubectl.exe`,
|
||||
},
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.DownloadingAndInstallingKubectl', "downloading and installing the latest kubectl.exe ..."),
|
||||
command: `for /f %i in ('curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt') do curl -LO https://storage.googleapis.com/kubernetes-release/release/%i/bin/windows/amd64/kubectl.exe`
|
||||
}
|
||||
];
|
||||
const defaultInstallationCommands = [
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.DeletePreviousDownloadedKubectl', "deleting previously downloaded kubectl if one exists ..."),
|
||||
command: `[ -e ./kubectl ] && rm -f ./kubectl`,
|
||||
},
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.DownloadingKubectl', "downloading the latest kubectl release ..."),
|
||||
command: 'curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl'
|
||||
},
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.MakingExecutable', "making kubectl executable ..."),
|
||||
command: 'chmod +x ./kubectl',
|
||||
},
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.CleaningUpOldBackups', "cleaning up any previously backed up version in the install location if they exist ..."),
|
||||
command: `[ -e /usr/local/bin/kubectl] && [ -e /usr/local/bin/kubectl_movedByADS ] && rm -f /usr/local/bin/kubectl_movedByADS`
|
||||
},
|
||||
{
|
||||
sudo: true,
|
||||
comment: localize('resourceDeployment.Kubectl.BackupCurrentBinary', "backing up any existing kubectl in the install location ..."),
|
||||
command: `[ -e /usr/local/bin/kubectl ] && mv /usr/local/bin/kubectl /usr/local/bin/kubectl_movedByADS`
|
||||
},
|
||||
{
|
||||
comment: localize('resourceDeployment.Kubectl.MoveToSystemPath', "moving kubectl into the install location in the PATH ..."),
|
||||
sudo: true,
|
||||
command: 'mv ./kubectl /usr/local/bin/kubectl'
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user