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

ci(deployment): only install ansible and terraform if not available #8169

Merged
merged 1 commit into from
Aug 19, 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
22 changes: 13 additions & 9 deletions packages/deployment/scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TERRAFORM_RELEASE=terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS}_${TERRAFORM_ARC
TERRAFORM_URL=https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/${TERRAFORM_RELEASE}.zip

# Extract, then delete temporary file.
(
[ -f /usr/local/bin/terraform ] && (/usr/local/bin/terraform -version; true) | head -1 | grep -q "v$TERRAFORM_VERSION" || (
trap 'echo "Removing $terraform_zip"; rm -f "$terraform_zip"' EXIT
terraform_zip=$(mktemp -t terraformXXXXXX)
curl "$TERRAFORM_URL" > "$terraform_zip"
Expand Down Expand Up @@ -53,15 +53,19 @@ esac

# Install Ansible.
if test -d /etc/apt; then
echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu $VERSION_CODENAME main" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
apt-get update --allow-releaseinfo-change -y
apt-get install -y ansible rsync curl sudo gnupg2 jq libbsd-dev
apt-get clean -y
dpkg-query -W ansible rsync curl sudo gnupg2 jq libbsd-dev >/dev/null || {
echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu $VERSION_CODENAME main" > /etc/apt/sources.list.d/ansible.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
apt-get update --allow-releaseinfo-change -y
apt-get install -y ansible rsync curl sudo gnupg2 jq libbsd-dev
apt-get clean -y
}
elif test "$uname_s" == darwin; then
brew update
brew install ansible rsync curl gnupg2 jq
brew cleanup
brew list ansible rsync curl gnupg2 jq >/dev/null || {
brew update
brew install ansible rsync curl gnupg2 jq
brew cleanup
}
else
echo "Don't know how to install Ansible, so I'm skipping..."
exit 1
Expand Down