Skip to content

Commit

Permalink
Allow using LXD image mirror
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gabriel-samfira committed Aug 14, 2024
1 parent 3b1e3c7 commit f5992b7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:

- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: latest/stable

- name: Install dependencies
run: |
Expand All @@ -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]
Expand All @@ -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: |
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/integration/config/garm-provider-lxd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/integration/external_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/organizations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion test/integration/scripts/setup-garm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f5992b7

Please sign in to comment.