mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Add template for minimal image and update tutorial (#7461)
This commit is contained in:
committed by
GitHub
parent
8ff6083faf
commit
e62bcae84b
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
################################################################################
|
||||
## File: basic.sh
|
||||
## File: apt-common.sh
|
||||
## Desc: Installs basic command line utilities and dev packages
|
||||
################################################################################
|
||||
source $HELPER_SCRIPTS/install.sh
|
||||
9
images/linux/scripts/installers/apt-vital.sh
Normal file
9
images/linux/scripts/installers/apt-vital.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
################################################################################
|
||||
## File: apt-vital.sh
|
||||
## Desc: Installs vital command line utilities
|
||||
################################################################################
|
||||
source $HELPER_SCRIPTS/install.sh
|
||||
|
||||
vital_packages=$(get_toolset_value .apt.vital_packages[])
|
||||
apt-get install -y --no-install-recommends $vital_packages
|
||||
@@ -29,23 +29,27 @@ systemctl is-enabled --quiet docker.service || systemctl enable docker.service
|
||||
sleep 10
|
||||
docker info
|
||||
|
||||
# If credentials are provided, attempt to log into Docker Hub
|
||||
# with a paid account to avoid Docker Hub's rate limit.
|
||||
if [ "${DOCKERHUB_LOGIN}" ] && [ "${DOCKERHUB_PASSWORD}" ]; then
|
||||
docker login --username "${DOCKERHUB_LOGIN}" --password "${DOCKERHUB_PASSWORD}"
|
||||
if [ "${DOCKERHUB_PULL_IMAGES:-yes}" -eq "yes" ]; then
|
||||
# If credentials are provided, attempt to log into Docker Hub
|
||||
# with a paid account to avoid Docker Hub's rate limit.
|
||||
if [ "${DOCKERHUB_LOGIN}" ] && [ "${DOCKERHUB_PASSWORD}" ]; then
|
||||
docker login --username "${DOCKERHUB_LOGIN}" --password "${DOCKERHUB_PASSWORD}"
|
||||
fi
|
||||
|
||||
# Pull images
|
||||
images=$(get_toolset_value '.docker.images[]')
|
||||
for image in $images; do
|
||||
docker pull "$image"
|
||||
done
|
||||
|
||||
# Always attempt to logout so we do not leave our credentials on the built
|
||||
# image. Logout _should_ return a zero exit code even if no credentials were
|
||||
# stored from earlier.
|
||||
docker logout
|
||||
else
|
||||
echo "Skipping docker images pulling"
|
||||
fi
|
||||
|
||||
# Pull images
|
||||
images=$(get_toolset_value '.docker.images[]')
|
||||
for image in $images; do
|
||||
docker pull "$image"
|
||||
done
|
||||
|
||||
# Always attempt to logout so we do not leave our credentials on the built
|
||||
# image. Logout _should_ return a zero exit code even if no credentials were
|
||||
# stored from earlier.
|
||||
docker logout
|
||||
|
||||
# Install amazon-ecr-credential-helper
|
||||
aws_latest_release_url="https://api.github.com/repos/awslabs/amazon-ecr-credential-helper/releases/latest"
|
||||
aws_helper_url=$(curl "${authString[@]}" -sL $aws_latest_release_url | jq -r '.body' | awk -F'[()]' '/linux-amd64/ {print $2}')
|
||||
@@ -53,3 +57,6 @@ download_with_retries "$aws_helper_url" "/usr/bin" docker-credential-ecr-login
|
||||
chmod +x /usr/bin/docker-credential-ecr-login
|
||||
|
||||
invoke_tests "Tools" "Docker"
|
||||
if [ "${DOCKERHUB_PULL_IMAGES:-yes}" -eq "yes" ]; then
|
||||
invoke_tests "Tools" "Docker images"
|
||||
fi
|
||||
|
||||
@@ -24,5 +24,11 @@ echo "PATH=$ENVPATH" | sudo tee -a /etc/environment
|
||||
echo "Updated /etc/environment: $(cat /etc/environment)"
|
||||
|
||||
# Clean yarn and npm cache
|
||||
yarn cache clean
|
||||
npm cache clean --force
|
||||
if yarn --version > /dev/null
|
||||
then
|
||||
yarn cache clean
|
||||
fi
|
||||
if npm --version
|
||||
then
|
||||
npm cache clean --force
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||
|
||||
$cmd = (Get-ToolsetContent).apt.cmd_packages
|
||||
$cmd = (Get-ToolsetContent).apt.cmd_packages + (Get-ToolsetContent).apt.vital_packages
|
||||
|
||||
Describe "Apt" {
|
||||
|
||||
|
||||
@@ -79,13 +79,13 @@ Describe "Docker" {
|
||||
It "docker-credential-ecr-login" {
|
||||
"docker-credential-ecr-login -v" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Context "docker images" {
|
||||
$testCases = (Get-ToolsetContent).docker.images | ForEach-Object { @{ ImageName = $_ } }
|
||||
Describe "Docker images" {
|
||||
$testCases = (Get-ToolsetContent).docker.images | ForEach-Object { @{ ImageName = $_ } }
|
||||
|
||||
It "<ImageName>" -TestCases $testCases {
|
||||
sudo docker images "$ImageName" --format "{{.Repository}}" | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It "<ImageName>" -TestCases $testCases {
|
||||
sudo docker images "$ImageName" --format "{{.Repository}}" | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user