Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ reference the Azure mirror directly are not changed.
Set `enable_workaround_azure_mirror: 'false'` in the step's `with:` block to
disable the workaround.

## CirrOS prefetch

By default, the action downloads the CirrOS `uec.tar.gz` and `disk.img` images
from GitHub Releases into `devstack/files/` before running devstack. Devstack
skips its own download when the file is already there. This avoids timeouts
from `download.cirros-cloud.net`, which the Ironic devstack plugin hardcodes.
The version comes from `CIRROS_VERSION` in `conf_overrides`, or from devstack's
`stackrc`. A failed download only logs a warning, and devstack then downloads
the image itself.

Set `prefetch_cirros: 'false'` in the step's `with:` block to disable it.

## Usage

Example of Github Action step:
Expand Down
29 changes: 29 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ inputs:
force:
description: 'Allow running devstack on unsupported distro'
default: 'no'
prefetch_cirros:
description: 'Download the CirrOS images from GitHub Releases before running devstack'
default: 'true'
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -98,6 +101,32 @@ runs:
EOF_CONF_OVERRIDES
working-directory: ./devstack
shell: bash
- name: Prefetch CirrOS images
if: ${{ inputs.prefetch_cirros == 'true' }}
run: |
# The Ironic devstack plugin hardcodes http://download.cirros-cloud.net,
# which often times out from GitHub runners. Devstack skips its own
# download when the file is already in files/.
conf_value() { sed -nE "s/^$1=\"?([^\"]+)\"?\$/\1/p" local.conf | tail -1; }
version=$(conf_value CIRROS_VERSION)
version=${version:-$(sed -nE 's/^CIRROS_VERSION=\$\{CIRROS_VERSION:-"?([^"}]+)"?\}.*/\1/p' stackrc)}
arch=$(conf_value CIRROS_ARCH)
arch=${arch:-$(uname -m)}
mkdir -p files
for name in "cirros-${version}-${arch}-uec.tar.gz" "cirros-${version}-${arch}-disk.img"; do
[[ -s "files/${name}" ]] && continue
# Download to a temporary name so devstack never sees a partial file.
if curl -fsSL --retry 5 --retry-all-errors --connect-timeout 30 \
-o "files/${name}.tmp" \
"https://github.com/cirros-dev/cirros/releases/download/${version}/${name}"; then
mv "files/${name}.tmp" "files/${name}"
else
rm -f "files/${name}.tmp"
echo "::warning::Could not prefetch ${name}; devstack will download it itself."
fi
done
working-directory: ./devstack
shell: bash
- name: Dump local.conf
run: |
cat local.conf
Expand Down
Loading