Skip to content

Commit

Permalink
chore: refactor choco tools installation (#280)
Browse files Browse the repository at this point in the history
* chore: refactor choco tools installation

* Update provisioning/windows-provision.ps1

* fix

* remove cygwin path

* Update provisioning/windows-provision.ps1

* Update provisioning/windows-provision.ps1

* Update provisioning/windows-provision.ps1

* Update provisioning/windows-provision.ps1

* Update provisioning/windows-provision.ps1

Co-authored-by: Damien Duportal <damien.duportal@gmail.com>
  • Loading branch information
lemeurherve and dduportal authored Jul 20, 2022
1 parent 30c4a20 commit 0702400
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions provisioning/windows-provision.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ $downloads = [ordered]@{
& "gh.exe" version;
}
};
'chocolatey-make-cygwin' = @{
'chocolatey-and-packages' = @{
'url' = 'https://github.com/chocolatey/choco/releases/download/{0}/chocolatey.{0}.nupkg' -f $env:CHOCOLATEY_VERSION;
'local' = "$baseDir\chocolatey.zip";
'expandTo' = "$baseDir\chocolatey.tmp";
Expand All @@ -250,14 +250,23 @@ $downloads = [ordered]@{
& Remove-Item -Force -Recurse "$baseDir\chocolatey.tmp";
};
'cleanupLocal' = 'true';
'path' = "$baseDir\cygwin\bin\";
'path' = "$baseDir\ruby26\bin\;C:\HashiCorp\Vagrant\";
'postInstall' = {
# Installation of make for Windows
& "choco.exe" install make --yes --no-progress --limit-output --fail-on-error-output;
& "choco.exe" install vagrant --yes --no-progress --limit-output --fail-on-error-output --version "${env:VAGRANT_VERSION}";
# Append a ".1" as all ruby packages in chocolatey have this suffix. Not sure why (maybe a package build id)
& "choco.exe" install ruby --yes --no-progress --limit-output --fail-on-error-output --version "${env:RUBY_VERSION}.1";
& "choco.exe" install yq --yes --no-progress --limit-output --fail-on-error-output --version "${env:YQ_VERSION}";

};
'sanityCheck'= {
& "choco.exe";
& "make.exe" -version;
# & "vagrant.exe" --version;
& "$baseDir\ruby26\bin\ruby.exe" -v;
& "$baseDir\ruby26\bin\bundle" -v;
& "yq.exe" --version;
}
};
}
Expand Down Expand Up @@ -338,22 +347,6 @@ Write-Output "= Windows Powershell & Powershell Core sanity checks:"
Invoke-Command {& "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -command "(Get-Host).Version"}
Invoke-Command {& "C:\Program Files\PowerShell\7\pwsh.exe" -command "(Get-Host).Version"}

# Install Tools with Chocolatey Packages
Write-Output "= Installing Vagrant..."
Invoke-Command {& "choco.exe" install vagrant --yes --no-progress --limit-output --fail-on-error-output --version $env:VAGRANT_VERSION;}

Write-Output "= Installing Ruby..."
# Append a ".1" as all ruby packages in chocolatey have this suffix. Not sure why (maybe a package build id)
Invoke-Command {& "choco.exe" install ruby --yes --no-progress --limit-output --fail-on-error-output --version "${env:RUBY_VERSION}.1";}
Write-Host '- Sanity check for ruby tooling'
& C:\tools\ruby26\bin\ruby -v
& C:\tools\ruby26\bin\bundle -v

Write-Output "= Installing Yq..."
Invoke-Command {& "choco.exe" install yq --yes --no-progress --limit-output --fail-on-error-output --version "${env:YQ_VERSION}";}
Write-Host '- Sanity check for yq CLI'
& yq --version

## Add a set of pre-defined SSH keys to allow faster agent startups
$temp_authorized_keys_file = 'C:\custom_auth_keys'
DownloadFile "$env:OPENSSH_AUTHORIZED_KEYS_URL" "$temp_authorized_keys_file"
Expand Down

0 comments on commit 0702400

Please sign in to comment.