Download runner tools to images

This commit is contained in:
Andrew Ying 2024-11-18 11:15:36 +00:00
parent 86eec19ab6
commit d580a19fba
Signed by: andrew
SSH key fingerprint: SHA256:6goOJXI6ckOipdsJS6oj5gbQYaRmCe37r7bSBnyQLyE
3 changed files with 126 additions and 2 deletions

View file

@ -0,0 +1,46 @@
#!/bin/bash
for tool in $(jq -r '.[]' ./toolchain.json); do
TOOL_NAME=$(echo "$tool" | jq '.name')
[ -z $TOOL_NAME ] && exit 1
TOOL_MANIFEST_URL=$(echo "$tool" | jq '.url')
[ -z $TOOL_MANIFEST_URL ] && exit 1
TOOL_MANIFEST=$(curl -s $TOOL_MANIFEST_URL)
for version in $(echo "$tool" | jq -r '.versions[]'); do
for check_version in $(echo "$TOOL_MANIFEST" | jq -r '.[]'); do
if [[ $(echo "$check_version" | jq '.version') != $version ]]; then
continue
fi
for check_file in $(echo "$check_version" | jq -r '.files[]'); do
TOOL_PLATFORM=$(echo "$tool" | jq '.platform')
TOOL_ARCH=$(echo "$tool" | jq '.arch')
TOOL_PLATFORM_VERSION=$(echo "$tool" | jq '.platform_version')
if [ ! -z $TOOL_PLATFORM ]; then
[ $TOOL_PLATFORM != $(echo "$check_file" | jq '.platform') ] && continue
fi
if [ ! -z $TOOL_ARCH ]; then
[ $TOOL_ARCH != $(echo "$check_file" | jq '.arch') ] && continue
fi
if [ ! -z $TOOL_PLATFORM_VERSION ]; then
[ $TOOL_PLATFORM_VERSION != $(echo "$check_file" | jq '.platform_version') ] && continue
fi
FILENAME=$(echo "$check_file" | jq '.filename')
DOWNLOAD_URL=$(echo "$check_file" | jq '.download_url')
curl -o /tmp/build/$FILENAME $DOWNLOAD_URL || exit 1
mkdir -p /tmp/build/$FILENAME-dir
tar -xzf /tmp/build/$FILENAME -C /tmp/build/$FILENAME-dir
rm /tmp/build/$FILENAME
cd /tmp/build/$FILENAME-dir || exit 1
bash ./setup.sh
cd ..
rm -rf $FILENAME-dir
break
done
done
done
done

View file

@ -46,15 +46,31 @@ ARG PYTHON_VERSION_SHORT
ENV NODEJS_VERSION=22.x
ENV NVM_VERSION=0.40.1
ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
ENV RUNNER_TOOL_CACHE=/opt/hostedtoolcache
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
&& apt-get install --no-install-recommends --no-install-suggests -y \
RUN cat <<EOF >> /etc/apt/apt.conf.d/10dpkg-options
Dpkg::Options {
"--force-confdef";
"--force-confold";
}
EOF
RUN cat <<EOF >> /etc/apt/apt.conf.d/02autoremove
APT::Get::AutomaticRemove "0";
APT::Get::HideAutoRemove "1";
EOF
RUN echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80retries \
&& echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests \
apt-transport-https \
ca-certificates \
curl \
gcc \
gnupg \
jq \
libbz2-1.0 \
libev4 \
libffi8 \
@ -139,5 +155,16 @@ RUN echo 'session required pam_limits.so' >> /etc/pam.d/common-session \
&& echo '* soft stack 16384' >> /etc/security/limits.conf \
&& echo '* hard stack 16384' >> /etc/security/limits.conf
COPY ../helpers/linux-install-tools /tmp/build/
COPY toolchain.json /tmp/build/
RUN set -x \
&& mkdir -p ${AGENT_TOOLSDIRECTORY} \
&& mkdir -p ${AGENT_TOOLSDIRECTORY} \
&& chown -R runner:runner ${AGENT_TOOLSDIRECTORY} \
&& chmod -R 0777 ${AGENT_TOOLSDIRECTORY} \
&& cd /tmp/build \
&& chmod +x linux-install-tools \
&& bash ./linux-install-tools
USER runner
WORKDIR /workspace

View file

@ -0,0 +1,51 @@
[
{
"name": "Python",
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
"platform" : "linux",
"platform_version": "22.04",
"arch": "x64",
"versions": [
"3.7.*",
"3.8.*",
"3.9.*",
"3.10.*",
"3.11.*",
"3.12.*"
]
},
{
"name": "PyPy",
"arch": "x64",
"platform" : "linux",
"versions": [
"3.7",
"3.8",
"3.9",
"3.10"
]
},
{
"name": "node",
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
"platform" : "linux",
"arch": "x64",
"versions": [
"18.*",
"20.*",
"22.*"
]
},
{
"name": "go",
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "linux",
"versions": [
"1.21.*",
"1.22.*",
"1.23.*"
],
"default": "1.23.*"
}
]