From eee69e45295a76eda126fc247e19ae3651aa881c Mon Sep 17 00:00:00 2001 From: Ayush Sethi Date: Tue, 21 Nov 2023 13:10:18 +0530 Subject: [PATCH] Update installation steps for not using apt-key (#1498) Remove use of apt-key for Ubuntu 21+ and Debian 11+ --- tools/cd_scripts/install_test.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/cd_scripts/install_test.sh b/tools/cd_scripts/install_test.sh index 2b33f23a8b..e715eda4b3 100755 --- a/tools/cd_scripts/install_test.sh +++ b/tools/cd_scripts/install_test.sh @@ -32,17 +32,31 @@ EOF #details.txt file contains the release version and commit hash of the current release. gsutil cp gs://gcsfuse-release-packages/version-detail/details.txt . # Writing VM instance name to details.txt (Format: release-test-) -curl http://metadata.google.internal/computeMetadata/v1/instance/name -H "Metadata-Flavor: Google" >> details.txt +vm_instance_name=$(curl http://metadata.google.internal/computeMetadata/v1/instance/name -H "Metadata-Flavor: Google") +echo $vm_instance_name >> details.txt touch ~/logs.txt # Based on the os type(from vm instance name) in detail.txt, run the following # commands to install gcsfuse. if grep -q ubuntu details.txt || grep -q debian details.txt; then -# For ubuntu and debian os + # For ubuntu and debian os export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s` - echo "deb https://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - + # Don't use apt-key for Debian 11+ and Ubuntu 21+ + if { [[ $vm_instance_name == *"debian"* && !( "$vm_instance_name" < "release-test-debian-11") ]]; } || { [[ $vm_instance_name == *"ubuntu"* && !("$vm_instance_name" < "release-test-ubuntu-21") ]]; } + then + echo "deb [signed-by=/usr/share/keyrings/cloud.google.asc] https://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo tee /usr/share/keyrings/cloud.google.asc >> ~/apt_key_logs.txt + else + echo "deb https://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - >> ~/apt_key_logs.txt + fi + + if grep -q -i warning ~/apt_key_logs.txt; + then + echo "Failure: Got warning while using apt-key" >> ~/logs.txt + fi + sudo apt-get update # Install latest released gcsfuse version sudo apt-get install -y gcsfuse