Skip to content

Commit

Permalink
move tools out of /opt/hostedtoolcache due it beeing a mounted volume (
Browse files Browse the repository at this point in the history
…#121)

We can define ACT_TOOLSDIRECTORY back to /opt/hostedtoolcache to revert this
  • Loading branch information
ChristopherHX committed Jan 30, 2024
1 parent 1cb15e3 commit c8a0963
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion linux/ubuntu/scripts/act.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ node_arch() {

ImageOS=ubuntu$(echo "${VERSION_ID}" | cut -d'.' -f 1)
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
ACT_TOOLSDIRECTORY=/opt/acttoolcache
{
echo "IMAGE_OS=$ImageOS"
echo "ImageOS=$ImageOS"
Expand All @@ -30,10 +31,13 @@ AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
echo "DEPLOYMENT_BASEPATH=/opt/runner"
echo "USER=$(whoami)"
echo "RUNNER_USER=$(whoami)"
echo "ACT_TOOLSDIRECTORY=${ACT_TOOLSDIRECTORY}"
} | tee -a "/etc/environment"

mkdir -m 0777 -p "${AGENT_TOOLSDIRECTORY}"
chown -R 1001:1000 "${AGENT_TOOLSDIRECTORY}"
mkdir -m 0777 -p "${ACT_TOOLSDIRECTORY}"
chown -R 1001:1000 "${ACT_TOOLSDIRECTORY}"

mkdir -m 0777 -p /github
chown -R 1001:1000 /github
Expand Down Expand Up @@ -121,7 +125,7 @@ IFS=' ' read -r -a NODE <<<"$NODE_VERSION"
for ver in "${NODE[@]}"; do
printf "\n\t🐋 Installing Node.JS=%s 🐋\t\n" "${ver}"
VER=$(curl https://nodejs.org/download/release/index.json | jq "[.[] | select(.version|test(\"^v${ver}\"))][0].version" -r)
NODEPATH="$AGENT_TOOLSDIRECTORY/node/${VER:1}/$(node_arch)"
NODEPATH="${ACT_TOOLSDIRECTORY}/node/${VER:1}/$(node_arch)"
mkdir -v -m 0777 -p "$NODEPATH"
wget "https://nodejs.org/download/release/latest-v${ver}.x/node-$VER-linux-$(node_arch).tar.xz" -O "node-$VER-linux-$(node_arch).tar.xz"
tar -Jxf "node-$VER-linux-$(node_arch).tar.xz" --strip-components=1 -C "$NODEPATH"
Expand Down
8 changes: 5 additions & 3 deletions linux/ubuntu/scripts/dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
## Must be run as non-root user after homebrew
################################################################################

. /etc/environment

# Install dotnet CLI
. /imagegeneration/installers/helpers/etc-environment.sh

printf "\n\t🐋 Installing .NET 🐋\t\n"
#apt-get install -y dotnet-sdk-7.0 dotnet-sdk-6.0 dotnet-runtime-7.0 dotnet-runtime-6.0
curl -LO https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
cat ./dotnet-install.sh
bash ./dotnet-install.sh --install-dir /opt/hostedtoolcache/dotnet --no-path --channel STS # net 7.0
bash ./dotnet-install.sh --install-dir /opt/hostedtoolcache/dotnet --no-path --channel LTS # net 6.0
bash ./dotnet-install.sh --install-dir ${ACT_TOOLSDIRECTORY}/dotnet --no-path --channel STS # net 7.0
bash ./dotnet-install.sh --install-dir ${ACT_TOOLSDIRECTORY}/dotnet --no-path --channel LTS # net 6.0
rm ./dotnet-install.sh
export DOTNET_ROOT=/opt/hostedtoolcache/dotnet
export DOTNET_ROOT=${ACT_TOOLSDIRECTORY}/dotnet
export PATH=$PATH:$DOTNET_ROOT
{
echo "DOTNET_ROOT=${DOTNET_ROOT}"
Expand Down
2 changes: 1 addition & 1 deletion linux/ubuntu/scripts/go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DEFVER=$(jq -r '.toolcache[] | select(.name == "go") | .default' "/imagegenerati
for V in $(jq -r '.toolcache[] | select(.name == "go") | .versions[]' "/imagegeneration/toolset.json"); do
printf "\n\t🐋 Installing GO=%s 🐋\t\n" "${V}"
VER=$(jq -r "[.[] | select(.version|test(\"^${V}\"))][0].version" "/tmp/go-toolset.json")
GOPATH="$AGENT_TOOLSDIRECTORY/go/${VER}/$(toolcache_arch)"
GOPATH="${ACT_TOOLSDIRECTORY}/go/${VER}/$(toolcache_arch)"

mkdir -v -m 0777 -p "$GOPATH"
DL_VER="${VER}"
Expand Down
2 changes: 1 addition & 1 deletion linux/ubuntu/scripts/java-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ installOpenJDK() {
exit 1
fi

JAVA_TOOLCACHE_PATH="${AGENT_TOOLSDIRECTORY}/Java_${VENDOR_NAME}_jdk"
JAVA_TOOLCACHE_PATH="${ACT_TOOLSDIRECTORY}/Java_${VENDOR_NAME}_jdk"

fullJavaVersion=$(cat "${javaVersionPath}/release" | grep "^SEMANTIC" | cut -d "=" -f 2 | tr -d "\"" | tr "+" "-")

Expand Down
2 changes: 1 addition & 1 deletion linux/ubuntu/scripts/js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ JSON=$(wget -qO- https://nodejs.org/download/release/index.json | jq --compact-o
for V in "${versions[@]}"; do
printf "\n\t🐋 Installing NODE=%s 🐋\t\n" "${V}"
VER=$(echo "${JSON}" | jq "[.[] | select(.version|test(\"^v${V}\"))][0].version" -r)
NODEPATH="$AGENT_TOOLSDIRECTORY/node/${VER:1}/x64"
NODEPATH="${ACT_TOOLSDIRECTORY}/node/${VER:1}/x64"

mkdir -v -m 0777 -p "$NODEPATH"
ARCH=$(uname -m)
Expand Down

0 comments on commit c8a0963

Please sign in to comment.