-
Notifications
You must be signed in to change notification settings - Fork 664
feat(runner): support Ubuntu 24.04 #4246
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
Merged
+99
−39
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
examples/multi-runner/templates/runner-configs/linux-x64-ubuntu-2204.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
matcherConfig: | ||
exactMatch: true | ||
labelMatchers: | ||
- [self-hosted, linux, x64, ubuntu-2204] | ||
fifo: true | ||
redrive_build_queue: | ||
enabled: false | ||
maxReceiveCount: null | ||
runner_config: | ||
runner_os: linux | ||
runner_architecture: x64 | ||
runner_run_as: ubuntu | ||
runner_name_prefix: ubuntu-2204-x64_ | ||
enable_ssm_on_runners: true | ||
credit_specification: standard | ||
instance_types: | ||
- t3a.large | ||
- m5ad.large | ||
- m5a.large | ||
runners_maximum_count: 1 | ||
delay_webhook_event: 0 | ||
scale_down_schedule_expression: cron(* * * * ? *) | ||
userdata_template: ./templates/user-data.sh | ||
ami: | ||
owners: | ||
- "099720109477" # Canonical's Amazon account ID | ||
filter: | ||
name: | ||
- ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-* | ||
state: | ||
- available | ||
block_device_mappings: | ||
- device_name: /dev/sda1 | ||
delete_on_termination: true | ||
volume_type: gp3 | ||
volume_size: 30 | ||
encrypted: true | ||
iops: null | ||
throughput: null | ||
kms_key_id: null | ||
snapshot_id: null | ||
runner_log_files: | ||
- log_group_name: syslog | ||
prefix_log_group: true | ||
file_path: /var/log/syslog | ||
log_stream_name: "{instance_id}" | ||
- log_group_name: user_data | ||
prefix_log_group: true | ||
file_path: /var/log/user-data.log | ||
log_stream_name: "{instance_id}/user_data" | ||
- log_group_name: runner | ||
prefix_log_group: true | ||
file_path: /opt/actions-runner/_diag/Runner_**.log | ||
log_stream_name: "{instance_id}/runner" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,67 +15,72 @@ set -x | |
${pre_install} | ||
|
||
# Install AWS CLI | ||
apt-get update | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
awscli \ | ||
apt-get -q update | ||
DEBIAN_FRONTEND=noninteractive apt-get install -q -y \ | ||
build-essential \ | ||
ca-certificates \ | ||
curl \ | ||
git \ | ||
iptables \ | ||
jq \ | ||
systemd-container \ | ||
uidmap \ | ||
unzip \ | ||
wget | ||
|
||
install -m 0755 -d /etc/apt/keyrings | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | ||
chmod a+r /etc/apt/keyrings/docker.asc | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" > /etc/apt/sources.list.d/docker.list | ||
apt-get -q update | ||
apt-get -q -y install docker-ce docker-ce-cli containerd.io docker-ce-rootless-extras docker-buildx-plugin docker-compose-plugin | ||
systemctl disable --now docker.socket docker.service | ||
|
||
# avoid /tmp, might be mounted no-exec | ||
curl -fsSL -o "awscliv2.zip" "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" | ||
unzip -q awscliv2.zip | ||
aws/install | ||
rm -rf aws awscliv2.zip | ||
|
||
user_name=ubuntu | ||
user_id=$(id -ru $user_name) | ||
|
||
# install and configure cloudwatch logging agent | ||
wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb | ||
dpkg -i -E ./amazon-cloudwatch-agent.deb | ||
amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c ssm:${ssm_key_cloudwatch_agent_config} | ||
curl -fsSL -o "/tmp/amazon-cloudwatch-agent.deb" https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb | ||
dpkg -i -E /tmp/amazon-cloudwatch-agent.deb | ||
rm -f /tmp/amazon-cloudwatch-agent.deb | ||
amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c "ssm:${ssm_key_cloudwatch_agent_config}" | ||
|
||
# configure systemd for running service in users accounts | ||
cat >/etc/systemd/[email protected] <<-EOF | ||
|
||
[Unit] | ||
Description=User Manager for UID %i | ||
After=user-runtime-dir@%i.service | ||
Wants=user-runtime-dir@%i.service | ||
|
||
[Service] | ||
LimitNOFILE=infinity | ||
LimitNPROC=infinity | ||
User=%i | ||
PAMName=systemd-user | ||
Type=notify | ||
|
||
[Install] | ||
WantedBy=default.target | ||
|
||
mkdir -p /etc/systemd/system/user-$user_id.slice.d | ||
bdellegrazie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cat > /etc/systemd/system/user-$user_id.slice.d/resources.conf <<- EOF | ||
[Slice] | ||
TasksMax=infinity | ||
EOF | ||
|
||
echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.bashrc | ||
mkdir -p /home/$user_name/.config/systemd/ | ||
cat > /home/$user_name/.config/systemd/user.conf <<- EOF | ||
[Manager] | ||
DefaultLimitNOFILE=infinity | ||
DefaultLimitNPROC=infinity | ||
EOF | ||
chown $user_name:$user_name /home/$user_name/.config/systemd/user.conf /home/$user_name/.config/systemd /home/$user_name/.config/ | ||
|
||
systemctl daemon-reload | ||
systemctl enable [email protected] | ||
systemctl start [email protected] | ||
|
||
curl -fsSL https://get.docker.com/rootless >>/opt/rootless.sh && chmod 755 /opt/rootless.sh | ||
su -l $user_name -c /opt/rootless.sh | ||
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.bashrc | ||
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.bashrc | ||
echo export XDG_RUNTIME_DIR="/run/user/$user_id" >> "/home/$user_name/.bashrc" | ||
npalm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Run docker service by default | ||
loginctl enable-linger $user_name | ||
su -l $user_name -c "systemctl --user enable docker" | ||
machinectl shell "[email protected]" /usr/bin/dockerd-rootless-setuptool.sh install | ||
echo export DOCKER_HOST="unix:///run/user/$user_id/docker.sock" >> "/home/$user_name/.bashrc" | ||
echo export PATH="/home/$user_name/bin:$PATH" >> "/home/$user_name/.bashrc" | ||
|
||
${install_runner} | ||
|
||
# config runner for rootless docker | ||
cd /opt/actions-runner/ | ||
echo DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>.env | ||
echo PATH=/home/$user_name/bin:$PATH >>.env | ||
echo DOCKER_HOST="unix:///run/user/$user_id/docker.sock" >> .env | ||
echo PATH="/home/$user_name/bin:$PATH" >> .env | ||
|
||
${post_install} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.