mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 14:17:22 +00:00
Inital commit.
This commit is contained in:
23
images/linux/scripts/helpers/apt.sh
Normal file
23
images/linux/scripts/helpers/apt.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: apt.sh
|
||||
## Desc: This script contains helper functions for using dpkg and apt
|
||||
################################################################################
|
||||
|
||||
## Use dpkg to figure out if a package has already been installed
|
||||
## Example use:
|
||||
## if ! IsInstalled packageName; then
|
||||
## echo "packageName is not installed!"
|
||||
## fi
|
||||
function IsInstalled {
|
||||
dpkg -S $1 &> /dev/null
|
||||
}
|
||||
|
||||
# Configure apt to always assume Y
|
||||
echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
|
||||
|
||||
# Use apt-fast for parallel downloads
|
||||
apt-get install aria2
|
||||
add-apt-repository -y ppa:apt-fast/stable
|
||||
apt-get update
|
||||
apt-get -y install apt-fast
|
||||
31
images/linux/scripts/helpers/containercache.sh
Normal file
31
images/linux/scripts/helpers/containercache.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
source $HELPER_SCRIPTS/apt.sh
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
# Check prereqs
|
||||
echo "Checking prereqs for image pulls"
|
||||
if ! command -v docker; then
|
||||
echo "Docker is not installed, cant pull images"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Information output
|
||||
systemctl status docker --no-pager
|
||||
|
||||
# Pull images
|
||||
images=(
|
||||
docker.io/jekyll/builder
|
||||
mcr.microsoft.com/azure-pipelines/node8-typescript
|
||||
)
|
||||
|
||||
for image in "${images[@]}"; do
|
||||
docker pull "$image"
|
||||
done
|
||||
|
||||
## Add container information to the metadata file
|
||||
DocumentInstalledItem "Cached container images"
|
||||
|
||||
while read -r line; do
|
||||
DocumentInstalledItemIndent "$line"
|
||||
done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')"
|
||||
30
images/linux/scripts/helpers/document.sh
Normal file
30
images/linux/scripts/helpers/document.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: document.sh
|
||||
## Desc: Helper functions for writing information to the metadata document
|
||||
################################################################################
|
||||
|
||||
function WriteItem {
|
||||
if [ -z "$METADATA_FILE" ]; then
|
||||
echo "METADATA_FILE environment variable must be set to output to Metadata Document!"
|
||||
return 1;
|
||||
else
|
||||
echo -e "$1" >> "$METADATA_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
function AddTitle {
|
||||
WriteItem "# $1"
|
||||
}
|
||||
|
||||
function AddSubTitle {
|
||||
WriteItem "## $1"
|
||||
}
|
||||
|
||||
function DocumentInstalledItem {
|
||||
WriteItem "- $1"
|
||||
}
|
||||
|
||||
function DocumentInstalledItemIndent {
|
||||
WriteItem " - $1"
|
||||
}
|
||||
Reference in New Issue
Block a user