Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install test.sh with public documentation install commands #1496

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 34 additions & 52 deletions tools/cd_scripts/install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,31 @@ gsutil cp gs://gcsfuse-release-packages/version-detail/details.txt .
curl http://metadata.google.internal/computeMetadata/v1/instance/name -H "Metadata-Flavor: Google" >> details.txt
touch ~/logs.txt

# uname can be x86_64 or aarch64
uname=$(uname -m)
if [[ $uname == "x86_64" ]]; then
architecture="amd64"
elif [[ $uname == "aarch64" ]]; then
architecture="arm64"
fi

# Based on the os type(from vm instance name) in detail.txt, run the following commands to install apt-transport-artifact-registry
# 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
curl https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo apt-key add - && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# Here we used apt-transport-artifact-registry-unstable main as stable one does not supports arm64, will switch back to stable once they support.
echo 'deb http://packages.cloud.google.com/apt apt-transport-artifact-registry-unstable main' | sudo tee -a /etc/apt/sources.list.d/artifact-registry.list
sudo apt update
sudo apt install apt-transport-artifact-registry
echo "deb ar+https://us-apt.pkg.dev/projects/gcs-fuse-prod gcsfuse-$(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/artifact-registry.list
sudo apt update

# Install released gcsfuse version
sudo apt install -y gcsfuse=$(sed -n 1p details.txt) -t gcsfuse-$(lsb_release -cs) |& tee -a ~/logs.txt
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 -
sudo apt-get update
# Install latest released gcsfuse version
sudo apt-get install -y gcsfuse
else
# For rhel and centos
# arm64 machines only supports dnf
sudo yum -y install dnf
sudo dnf makecache
sudo yum -y install dnf-plugin-artifact-registry
sudo tee -a /etc/yum.repos.d/artifact-registry.repo << EOF
[gcsfuse-el7-x86-64]
name=gcsfuse-el7-x86-64
baseurl=https://asia-yum.pkg.dev/projects/gcs-fuse-prod/gcsfuse-el7-x86-64
sudo yum install fuse
sudo tee /etc/yum.repos.d/gcsfuse.repo > /dev/null <<EOF
[gcsfuse]
name=gcsfuse (packages.cloud.google.com)
baseurl=https://packages.cloud.google.com/yum/repos/gcsfuse-el7-x86_64
enabled=1
repo_gpgcheck=0
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove extra space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copy pasted the install command from https://cloud.google.com/storage/docs/gcsfuse-install because of which this extra space crept in. 😅 Going ahead with the merge.

EOF
sudo dnf makecache
sudo dnf -y --enablerepo=gcsfuse-el7-x86-64 install gcsfuse-$(sed -n 1p details.txt)-1 |& tee -a ~/logs.txt
sudo yum install -y gcsfuse
fi

# Verify gcsfuse version (successful installation)
Expand All @@ -73,35 +58,32 @@ else
echo "Failure detected in latest gcsfuse version installation." &>> ~/logs.txt
fi

# This will execute only for amd64 machines, as we have not had any previous releases for arm64.
if [[ $architecture == amd64 ]];

# Uninstall gcsfuse latest version and install old version
if grep -q ubuntu details.txt || grep -q debian details.txt;
then
# Uninstall gcsfuse latest version and install old version
if grep -q ubuntu details.txt || grep -q debian details.txt;
then
sudo apt remove -y gcsfuse
sudo apt install -y gcsfuse=0.42.5 -t gcsfuse-$(lsb_release -cs) |& tee -a ~/logs.txt
else
sudo dnf -y remove gcsfuse
sudo dnf -y install gcsfuse-0.42.5-1 |& tee -a ~/logs.txt
fi
sudo apt-get remove -y gcsfuse |& tee -a ~/logs.txt
sudo apt-get install -y gcsfuse=1.2.0 |& tee -a ~/logs.txt
else
sudo yum -y remove gcsfuse |& tee -a ~/logs.txt
sudo yum install -y gcsfuse-1.2.0 |& tee -a ~/logs.txt
fi

# verify old version installation
gcsfuse --version |& tee version.txt
installed_version=$(echo $(sed -n 1p version.txt) | cut -d' ' -f3)
if [ $installed_version == "0.42.5" ]; then
echo "GCSFuse old version (0.42.5) installed successfully" &>> ~/logs.txt
else
echo "Failure detected in GCSFuse old version installation." &>> ~/logs.txt
fi
# verify old version installation
gcsfuse --version |& tee version.txt
installed_version=$(echo $(sed -n 1p version.txt) | cut -d' ' -f3)
if [ $installed_version == "1.2.0" ]; then
echo "GCSFuse old version (1.2.0) installed successfully" &>> ~/logs.txt
else
echo "Failure detected in GCSFuse old version installation." &>> ~/logs.txt
fi

# Upgrade gcsfuse to latest version
if grep -q ubuntu details.txt || grep -q debian details.txt;
then
sudo apt install --only-upgrade gcsfuse |& tee -a ~/logs.txt
sudo apt-get install --only-upgrade gcsfuse |& tee -a ~/logs.txt
else
sudo dnf -y upgrade gcsfuse |& tee -a ~/logs.txt
sudo yum -y upgrade gcsfuse |& tee -a ~/logs.txt
fi

gcsfuse --version |& tee version.txt
Expand Down