Skip to content

Commit

Permalink
Merge pull request #8169 from Agoric/mhofman/dont-reinstall-deploymen…
Browse files Browse the repository at this point in the history
…t-test-deps

ci(deployment): only install ansible and terraform if not available
  • Loading branch information
mhofman authored Aug 19, 2023
2 parents a3d49e5 + e68b29d commit 4b52dd6
Showing 1 changed file with 13 additions and 9 deletions.
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

0 comments on commit 4b52dd6

Please sign in to comment.