mirror of
https://github.com/actions/runner-images.git
synced 2026-01-08 11:30:49 +08:00
Add Ubuntu-Slim image definition (#13423)
Add ubuntu-slim image definition
This commit is contained in:
72
images/ubuntu-slim/scripts/build/configure-environment.sh
Normal file
72
images/ubuntu-slim/scripts/build/configure-environment.sh
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash -e
|
||||
################################################################################
|
||||
## File: configure-environment.sh
|
||||
## Desc: Configure system and environment
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/os.sh
|
||||
source $HELPER_SCRIPTS/etc-environment.sh
|
||||
|
||||
whoami
|
||||
|
||||
# Set ImageVersion and ImageOS env variables
|
||||
set_etc_environment_variable "ImageVersion" "${IMAGE_VERSION}"
|
||||
set_etc_environment_variable "ImageOS" "${IMAGE_OS}"
|
||||
|
||||
# Set the ACCEPT_EULA variable to Y value to confirm your acceptance of the End-User Licensing Agreement
|
||||
set_etc_environment_variable "ACCEPT_EULA" "Y"
|
||||
|
||||
# This directory is supposed to be created in $HOME and owned by user(https://github.com/actions/runner-images/issues/491)
|
||||
mkdir -p /etc/skel/.config/configstore
|
||||
set_etc_environment_variable "XDG_CONFIG_HOME" '$HOME/.config'
|
||||
|
||||
# Prepare directory and env variable for toolcache
|
||||
echo "Setting up AGENT_TOOLSDIRECTORY and RUNNER_TOOL_CACHE variable to /opt/hostedtoolcache"
|
||||
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
|
||||
mkdir $AGENT_TOOLSDIRECTORY
|
||||
set_etc_environment_variable "AGENT_TOOLSDIRECTORY" "${AGENT_TOOLSDIRECTORY}"
|
||||
set_etc_environment_variable "RUNNER_TOOL_CACHE" "${AGENT_TOOLSDIRECTORY}"
|
||||
chmod -R 777 $AGENT_TOOLSDIRECTORY
|
||||
|
||||
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
|
||||
# https://www.suse.com/support/kb/doc/?id=000016692
|
||||
echo 'vm.max_map_count=262144' | tee -a /etc/sysctl.conf
|
||||
|
||||
# https://kind.sigs.k8s.io/docs/user/known-issues/#pod-errors-due-to-too-many-open-files
|
||||
echo 'fs.inotify.max_user_watches=655360' | tee -a /etc/sysctl.conf
|
||||
echo 'fs.inotify.max_user_instances=1280' | tee -a /etc/sysctl.conf
|
||||
|
||||
# https://github.com/actions/runner-images/issues/9491
|
||||
echo 'vm.mmap_rnd_bits=28' | tee -a /etc/sysctl.conf
|
||||
|
||||
# https://github.com/actions/runner-images/pull/7860
|
||||
netfilter_rule='/etc/udev/rules.d/50-netfilter.rules'
|
||||
rules_directory="$(dirname "${netfilter_rule}")"
|
||||
mkdir -p $rules_directory
|
||||
touch $netfilter_rule
|
||||
echo 'ACTION=="add", SUBSYSTEM=="module", KERNEL=="nf_conntrack", RUN+="/usr/sbin/sysctl net.netfilter.nf_conntrack_tcp_be_liberal=1"' | tee -a $netfilter_rule
|
||||
|
||||
# Remove fwupd if installed. We're running on VMs in Azure and the fwupd package is not needed.
|
||||
# Leaving it enable means periodic refreshes show in network traffic and firewall logs
|
||||
# Check if fwupd-refresh.timer exists in systemd
|
||||
if systemctl list-unit-files fwupd-refresh.timer &>/dev/null; then
|
||||
echo "Masking fwupd-refresh.timer..."
|
||||
systemctl mask fwupd-refresh.timer
|
||||
fi
|
||||
|
||||
# This is a legacy check, leaving for earlier versions of Ubuntu
|
||||
# If fwupd config still exists, disable the motd updates
|
||||
if [[ -f "/etc/fwupd/daemon.conf" ]]; then
|
||||
sed -i 's/UpdateMotd=true/UpdateMotd=false/g' /etc/fwupd/daemon.conf
|
||||
fi
|
||||
|
||||
# Disable to load providers
|
||||
# https://github.com/microsoft/azure-pipelines-agent/issues/3834
|
||||
if is_ubuntu22; then
|
||||
sed -i 's/openssl_conf = openssl_init/#openssl_conf = openssl_init/g' /etc/ssl/openssl.cnf
|
||||
fi
|
||||
|
||||
# # Disable man-db auto update
|
||||
# echo "set man-db/auto-update false" | debconf-communicate
|
||||
# dpkg-reconfigure man-db
|
||||
Reference in New Issue
Block a user