Allow using LXD image mirror

This change allows GARM tests to use a mirror for LXD images, allowing
for faster image downloads.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2024-08-14 19:32:14 +00:00
parent 3b1e3c77e1
commit f5992b7344
6 changed files with 13 additions and 9 deletions

View file

@ -18,6 +18,8 @@ jobs:
- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: latest/stable
- name: Install dependencies
run: |
@ -42,9 +44,9 @@ jobs:
echo "GARM_BASE_URL=$GARM_BASE_URL" >> $GITHUB_ENV
cat <<EOF | sudo tee /etc/systemd/system/localshow-tunnel.service
cat <<EOF | sudo tee /etc/systemd/system/garm-tunnel.service
[Unit]
Description=Localshow tunnel
Description=GARM tunnel
After=network.target
[Service]
@ -57,8 +59,8 @@ jobs:
EOF
sudo systemctl daemon-reload
sudo systemctl enable localshow-tunnel
sudo systemctl start localshow-tunnel
sudo systemctl enable garm-tunnel
sudo systemctl start garm-tunnel
- name: Generate secrets
run: |
@ -90,6 +92,7 @@ jobs:
CREDENTIALS_NAME: test-garm-creds
WORKFLOW_FILE_NAME: test.yml
GH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}
LXD_REMOTE_SERVER: ${{ secrets.LXD_REMOTE_SERVER }}
- name: Show GARM logs
if: always()

View file

@ -5,7 +5,7 @@ secure_boot = false
project_name = "default"
[image_remotes]
[image_remotes.ubuntu]
addr = "https://cloud-images.ubuntu.com/releases"
addr = "${LXD_REMOTE_SERVER}"
public = true
protocol = "simplestreams"
skip_verify = false

View file

@ -22,7 +22,7 @@ func (suite *GarmSuite) TestExternalProvider() {
MaxRunners: 2,
MinIdleRunners: 0,
Flavor: "default",
Image: "ubuntu:22.04",
Image: "ubuntu:24.04",
OSType: commonParams.Linux,
OSArch: commonParams.Amd64,
ProviderName: "test_external",

View file

@ -29,7 +29,7 @@ func (suite *GarmSuite) TestOrganizations() {
MaxRunners: 2,
MinIdleRunners: 0,
Flavor: "default",
Image: "ubuntu:22.04",
Image: "ubuntu:24.04",
OSType: commonParams.Linux,
OSArch: commonParams.Amd64,
ProviderName: "lxd_local",

View file

@ -57,7 +57,7 @@ func (suite *GarmSuite) TestRepositories() {
MaxRunners: 2,
MinIdleRunners: 0,
Flavor: "default",
Image: "ubuntu:22.04",
Image: "ubuntu:24.04",
OSType: commonParams.Linux,
OSArch: commonParams.Amd64,
ProviderName: "lxd_local",

View file

@ -14,6 +14,7 @@ export RUN_USER=${RUN_USER:-$USER}
export GARM_PORT=${GARM_PORT:-"9997"}
export GARM_SERVICE_NAME=${GARM_SERVICE_NAME:-"garm"}
export GARM_CONFIG_FILE=${GARM_CONFIG_FILE:-"${GARM_CONFIG_DIR}/config.toml"}
export LXD_REMOTE_SERVER=${LXD_REMOTE_SERVER:-"https://cloud-images.ubuntu.com/releases"}
if [ -f "$GITHUB_ENV" ];then
echo "export GARM_CONFIG_DIR=${GARM_CONFIG_DIR}" >> $GITHUB_ENV
@ -66,7 +67,7 @@ sudo chown -R $RUN_USER:$RUN_USER ${GARM_CONFIG_DIR}
export LXD_PROVIDER_EXECUTABLE="$PROVIDER_BIN_DIR/garm-provider-lxd"
export LXD_PROVIDER_CONFIG="${GARM_CONFIG_DIR}/garm-provider-lxd.toml"
sudo cp $CONFIG_DIR/garm-provider-lxd.toml $LXD_PROVIDER_CONFIG
cat $CONFIG_DIR/garm-provider-lxd.toml| envsubst | sudo tee $LXD_PROVIDER_CONFIG > /dev/null
function clone_and_build_lxd_provider() {
git clone https://github.com/cloudbase/garm-provider-lxd ~/garm-provider-lxd