Skip to content

Commit

Permalink
ci: unified-agent: export preset name (#8518)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitka authored Aug 30, 2024
1 parent 01c9738 commit efd441b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ydb/ci/gh-runner-controller/src/scaler/cloud_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import yaml


def create_userdata(repo_url, gh_token, runner_name, runner_labels, ssh_keys, agent_mirror_url_prefix):
def create_userdata(repo_url, gh_token, runner_name, runner_labels, ssh_keys, agent_mirror_url_prefix, preset_name):
runner_username = "runner"

install_script = pkgutil.get_data(__name__, "scripts/install_runner.sh")
Expand All @@ -17,6 +17,7 @@ def create_userdata(repo_url, gh_token, runner_name, runner_labels, ssh_keys, ag
RUNNER_NAME="{runner_name}"
RUNNER_LABELS="{runner_labels}"
AGENT_MIRROR_URL_PREFIX="{agent_mirror_url_prefix}"
PRESET_NAME="{preset_name}"
""".strip().encode(
"utf8"
)
Expand Down
2 changes: 1 addition & 1 deletion ydb/ci/gh-runner-controller/src/scaler/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def start_runner(self, preset_name: str):

vm_labels = {self.prefix: runner_name}
user_data = create_userdata(self.gh.html_url, new_runner_token, runner_name, labels, self.cfg.ssh_keys,
self.cfg.agent_mirror_url_prefix)
self.cfg.agent_mirror_url_prefix, preset_name)

placement = random.choice(self.cfg.yc_zones)
zone_id = placement['zone_id']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ systemctl daemon-reload || fail "failed to reload systemd"
systemctl enable $SVC_NAME
systemctl start $SVC_NAME

echo "GH_RUNNER_NAME=${RUNNER_NAME}"> /etc/default/unified_agent
cat <<EOF > /etc/default/unified_agent
GH_RUNNER_NAME=${RUNNER_NAME}
GH_PRESET_NAME=${PRESET_NAME}
EOF

systemctl restart unified-agent.service
2 changes: 1 addition & 1 deletion ydb/ci/gh-runner-image/conf/unified-agent-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ channels:
plugin: transform_metric_labels
config:
labels:
- gh_runner_name: "{$env('GH_RUNNER_NAME')}"
- gh_preset: "{$env('GH_PRESET_NAME')}"
output:
plugin: yc_metrics
config:
Expand Down

0 comments on commit efd441b

Please sign in to comment.