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

Setup parca-agent for ci-runs #187

Closed
wants to merge 1 commit into from
Closed
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
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}}"
Copy link
Member

Choose a reason for hiding this comment

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

Just a thought, we could add some labels like TEST_RUNNER_NAME to make it easier to correlate to issues we eventually find?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe, I think we just care about the provider/substrate rather what test is running. Otherwise we might start gaming for a specific test and not juju as a whole.

Copy link
Member

Choose a reason for hiding this comment

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

AIUI, this actually sets it up on the host whenever we have an lxd run, is that correct? So this isn't setting up parca-agent in lxd, it is setting up parca-agent on hosts that run lxd.
I have a slight concern about side effects if you are trying to run the CI suite locally. In general, we might want to have a CI step for Jenkins ephemeral bots to install and configure parca-agent, but I'm kind of against doing it as a side effect of running a test.


# 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
Loading