Skip to content

Commit

Permalink
Allow private track repos in Vagrant (elastic#376)
Browse files Browse the repository at this point in the history
Deploy Rally private key to allow use of e.g. the observability logging
track from the elastic/rally-internal-tracks private repo.

While at it, fix warnings by removing the (now default) explicit use
of the `2020-resolver` pip feature.
  • Loading branch information
dliappis authored Feb 5, 2021
1 parent 5cf3dbe commit 04180eb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions night_rally/fixtures/ansible/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ def install_vault
EOF
end

def install_rally_ssh_key
# Deploy a key that allows us to read from private GH track repos like elastic/rally-internal-tracks
<<~EOF
set -eo pipefail
cd /var/lib/jenkins
sudo -iu jenkins bash -c "vault read -field=private-key /secret/rally/ssh-keypairs/rally >~/.ssh/id_rsa && chmod 0600 ~/.ssh/id_rsa && ssh-keyscan github.com >> ~/.ssh/known_hosts"
EOF
end

def install_rally_source(rally_repo, rally_branch, rally_sha)
# Remove OS packages for python3-pip and python3-setuptools; we prefer per account installation of pip3
<<~EOF
Expand All @@ -117,7 +126,7 @@ def install_rally_source(rally_repo, rally_branch, rally_sha)
#{curl_wrapper} https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer -o pyenv-installer
bash ./pyenv-installer
rm pyenv-installer
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> /var/lib/jenkins/.profile
echo 'export PATH="$HOME/.pyenv/bin:$HOME/.local/bin:$PATH"' >> /var/lib/jenkins/.profile
echo 'eval "\$(pyenv init -)"' >> /var/lib/jenkins/.profile
echo 'eval "\$(pyenv virtualenv-init -)"' >> /var/lib/jenkins/.profile
source /var/lib/jenkins/.profile
Expand All @@ -130,7 +139,7 @@ def install_rally_source(rally_repo, rally_branch, rally_sha)
cd rally
if [[ ! -z \"#{rally_sha}\" ]]; then git checkout #{rally_sha}; fi
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --quiet --user --upgrade --editable . --use-feature=2020-resolver
python3 -m pip install --quiet --user --upgrade --editable .
cd /var/lib/jenkins
ln -s $PWD/src/rally/rally $PWD/bin/rally
ln -s $PWD/src/rally/rallyd $PWD/bin/rallyd
Expand Down Expand Up @@ -319,6 +328,7 @@ Vagrant.configure(2) do |config|
EOF

node_config.vm.provision "shell", inline: install_ansible("2.9.6")
node_config.vm.provision "shell", inline: install_rally_ssh_key
end

node_config.vm.provision "shell", inline: install_night_rally_test_script(base_ip, target_node_ip_addresses)
Expand Down

0 comments on commit 04180eb

Please sign in to comment.