Skip to content

Commit

Permalink
Setup parca-agent for ci-runs
Browse files Browse the repository at this point in the history
Start collecting profiling data for ci-runs (specifically looking
at longer gating test runs). We want the data for 2 reasons:

 1. See if there are any potential bottlenecks in terms of performance
    that we can see when the jujud and jujud-controller is running.
 2. We can use profile guided optimisations (PGO) from the runs to
    apply to the binaries.

This currently only applies to lxd deployments. For other providers
we will need to install it via cloud-init or bake it into an image.

This is an experiment to see if it's useful or not.
  • Loading branch information
SimonRichardson committed May 22, 2024
1 parent cf273d8 commit 7ffa6bb
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions jobs/ci-run/integration/common/test-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ while sudo lsof /var/lib/apt/lists/lock 2> /dev/null; do
done
sudo apt-get -y update

setup_parca_agent() {
# Parca agent is already installed, then skip it.
if [ "$(which parca-agent >/dev/null 2>&1)" ]; then
return
fi

sudo snap install parca-agent --classic
sudo snap set parca-agent metadata-external-labels="machine=ci-run-${{BOOTSTRAP_PROVIDER}}"

# Hide the setting of the bearer token to the parca agent.
set +x
sudo snap set parca-agent remote-store-bearer-token="${{PARCA_BEARER_TOKEN}}"
set -x
}

# Issue around installing a snap within a privileged container on a host
# fails. There is no real work around once privileged and nesting has been
# set, so retries succeed.
Expand All @@ -55,8 +70,18 @@ while [ $attempts -lt 3 ]; do
if [ ! "$(which microceph >/dev/null 2>&1)" ]; then
sudo snap install microceph || true
fi
# shellcheck disable=SC2193
if [ "${{BOOTSTRAP_PROVIDER:-}}" = "ec2" ]; then

provider="${{BOOTSTRAP_PROVIDER:-}}"
case "$provider" in
"lxd" | "lxd-remote" | "localhost")
setup_parca_agent || true
;;
*)
echo "Skipping parca-agent setup for provider: $provider"
;;
esac

if [ "$provider" = "ec2" ]; then
if [ ! "$(which aws >/dev/null 2>&1)" ]; then
sudo snap install aws-cli --classic || true
fi
Expand All @@ -72,8 +97,8 @@ while [ $attempts -lt 3 ]; do
echo -e "[default]\nregion = us-east-1" > "$HOME"/.aws/config
chmod 600 ~/.aws/*
fi
# shellcheck disable=SC2193
if [ "${{BOOTSTRAP_PROVIDER:-}}" = "azure" ]; then

if [ "$provider" = "azure" ]; then
if [ ! "$(which az >/dev/null 2>&1)" ]; then
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
fi
Expand Down

0 comments on commit 7ffa6bb

Please sign in to comment.