From a276d820b22dd49139ae95c75ff61ee50b211804 Mon Sep 17 00:00:00 2001 From: ilia-shipitsin <125650415+ilia-shipitsin@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:54:23 +0100 Subject: [PATCH] [ubuntu] split git and git-lfs into separate install scripts (#8711) for better observability of integrity validation let us split install script into two --- images/linux/scripts/installers/git-lfs.sh | 22 ++++++++++++++++++++++ images/linux/scripts/installers/git.sh | 7 ------- images/linux/scripts/tests/Tools.Tests.ps1 | 10 ++++++---- images/linux/ubuntu2004.json | 1 + images/linux/ubuntu2204.pkr.hcl | 1 + images/linux/ubuntuminimal.pkr.hcl | 1 + 6 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 images/linux/scripts/installers/git-lfs.sh diff --git a/images/linux/scripts/installers/git-lfs.sh b/images/linux/scripts/installers/git-lfs.sh new file mode 100644 index 000000000..a379a7c0f --- /dev/null +++ b/images/linux/scripts/installers/git-lfs.sh @@ -0,0 +1,22 @@ +#!/bin/bash -e +################################################################################ +## File: git-lfs.sh +## Desc: Installs Git-lfs +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/install.sh + +GIT_LFS_REPO="https://packagecloud.io/install/repositories/github/git-lfs" + +# Install git-lfs +curl -fsSL $GIT_LFS_REPO/script.deb.sh | bash +apt-get install -y git-lfs + +# Remove source repo's +rm /etc/apt/sources.list.d/github_git-lfs.list + +# Document apt source repo's +echo "git-lfs $GIT_LFS_REPO" >> $HELPER_SCRIPTS/apt-sources.txt + +invoke_tests "Tools" "Git-lfs" diff --git a/images/linux/scripts/installers/git.sh b/images/linux/scripts/installers/git.sh index e6f80ef5b..9e7e8c477 100644 --- a/images/linux/scripts/installers/git.sh +++ b/images/linux/scripts/installers/git.sh @@ -8,7 +8,6 @@ source $HELPER_SCRIPTS/install.sh GIT_REPO="ppa:git-core/ppa" -GIT_LFS_REPO="https://packagecloud.io/install/repositories/github/git-lfs" ## Install git add-apt-repository $GIT_REPO -y @@ -21,20 +20,14 @@ cat <> /etc/gitconfig directory = * EOF -# Install git-lfs -curl -fsSL $GIT_LFS_REPO/script.deb.sh | bash -apt-get install -y git-lfs - # Install git-ftp apt-get install git-ftp -y # Remove source repo's add-apt-repository --remove $GIT_REPO -rm /etc/apt/sources.list.d/github_git-lfs.list # Document apt source repo's echo "git-core $GIT_REPO" >> $HELPER_SCRIPTS/apt-sources.txt -echo "git-lfs $GIT_LFS_REPO" >> $HELPER_SCRIPTS/apt-sources.txt # Add well-known SSH host keys to known_hosts ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /etc/ssh/ssh_known_hosts diff --git a/images/linux/scripts/tests/Tools.Tests.ps1 b/images/linux/scripts/tests/Tools.Tests.ps1 index 396eed4b1..e420314ef 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -241,15 +241,17 @@ Describe "Git" { "git --version" | Should -ReturnZeroExitCode } - It "git-lfs" { - "git-lfs --version" | Should -ReturnZeroExitCode - } - It "git-ftp" { "git-ftp --version" | Should -ReturnZeroExitCode } } +Describe "Git-lfs" { + It "git-lfs" { + "git-lfs --version" | Should -ReturnZeroExitCode + } +} + Describe "Heroku" { It "heroku" { "heroku --version" | Should -ReturnZeroExitCode diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 5e66c9bb9..875edeafb 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -217,6 +217,7 @@ "{{template_dir}}/scripts/installers/gcc.sh", "{{template_dir}}/scripts/installers/gfortran.sh", "{{template_dir}}/scripts/installers/git.sh", + "{{template_dir}}/scripts/installers/git-lfs.sh", "{{template_dir}}/scripts/installers/github-cli.sh", "{{template_dir}}/scripts/installers/google-chrome.sh", "{{template_dir}}/scripts/installers/google-cloud-cli.sh", diff --git a/images/linux/ubuntu2204.pkr.hcl b/images/linux/ubuntu2204.pkr.hcl index c43761693..500d959f4 100644 --- a/images/linux/ubuntu2204.pkr.hcl +++ b/images/linux/ubuntu2204.pkr.hcl @@ -300,6 +300,7 @@ build { "${path.root}/scripts/installers/gcc.sh", "${path.root}/scripts/installers/gfortran.sh", "${path.root}/scripts/installers/git.sh", + "${path.root}/scripts/installers/git-lfs.sh", "${path.root}/scripts/installers/github-cli.sh", "${path.root}/scripts/installers/google-chrome.sh", "${path.root}/scripts/installers/google-cloud-cli.sh", diff --git a/images/linux/ubuntuminimal.pkr.hcl b/images/linux/ubuntuminimal.pkr.hcl index 6798420a4..373fc06f4 100644 --- a/images/linux/ubuntuminimal.pkr.hcl +++ b/images/linux/ubuntuminimal.pkr.hcl @@ -257,6 +257,7 @@ build { execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" scripts = [ "${path.root}/scripts/installers/git.sh", + "${path.root}/scripts/installers/git-lfs.sh", "${path.root}/scripts/installers/github-cli.sh", "${path.root}/scripts/installers/zstd.sh" ]