Skip to content

Commit ddf1354

Browse files
committed
fix: resolve GitHub Actions workflow failure in LXD provisioning test
- Create static cloud-init.yml fixture without template variables - Update workflow to use static fixture instead of dynamic template - Add comprehensive workflow documentation explaining purpose and scope - Fix OpenTofu validation error caused by missing cloud-init.yml file The workflow now uses fixtures/tofu/lxd/cloud-init.yml as a static configuration for testing LXD container provisioning in CI environments. This avoids coupling with application-specific template variables while maintaining infrastructure validation coverage.
1 parent a13493a commit ddf1354

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.github/workflows/test-lxd-provision.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# LXD Container Provisioning Test Workflow
2+
#
3+
# This workflow tests that LXD container provisioning works correctly in GitHub Actions runners.
4+
# It's a continuous integration test to ensure our OpenTofu LXD provider configuration is valid
5+
# and can successfully create containers in shared CI environments.
6+
#
7+
# PURPOSE:
8+
# - Validates OpenTofu configuration syntax and LXD provider integration
9+
# - Tests container creation, initialization, and basic functionality
10+
# - Ensures cloud-init scripts work properly in containerized environments
11+
# - Provides confidence that LXD provisioning works in CI/CD pipelines
12+
#
13+
# SCOPE:
14+
# - Uses static configuration fixtures (no dynamic templating) to avoid application coupling
15+
# - Tests infrastructure provisioning only (no application deployment)
16+
# - Focuses on LXD container lifecycle management and basic system validation
17+
#
18+
# This is NOT a full end-to-end test but a focused infrastructure validation workflow.
19+
120
name: Test LXD Container Provisioning
221

322
# NOTE: This workflow uses CI-specific approaches like 'sudo chmod 666' on the LXD socket
@@ -45,9 +64,11 @@ jobs:
4564
run: |
4665
# Build the template system and render the static templates
4766
cargo build --release
48-
# For this workflow, we need static templates only (no runtime variables)
67+
# For this workflow, we use static fixtures without variables for testing
4968
mkdir -p build
5069
cp -r templates/* build/
70+
# Override the dynamic cloud-init template with static fixture
71+
cp fixtures/tofu/lxd/cloud-init.yml build/tofu/lxd/cloud-init.yml
5172
5273
- name: Verify installations
5374
run: |

fixtures/tofu/lxd/cloud-init.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#cloud-config
2+
# Static cloud-init configuration for LXD provisioning tests
3+
# This is used by GitHub Actions workflow to test LXD container provisioning
4+
# No SSH keys needed as we don't connect via SSH in the test workflow
5+
6+
# Commented out for faster container creation during CI testing
7+
# package_update: true
8+
# package_upgrade: true
9+
10+
# packages:
11+
# - curl
12+
# - wget
13+
# - git
14+
# - htop
15+
# - vim
16+
17+
users:
18+
- name: torrust
19+
groups: sudo
20+
shell: /bin/bash
21+
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
22+
23+
runcmd:
24+
- echo "Container provisioned successfully" > /tmp/provision_complete
25+
- systemctl enable ssh
26+
- systemctl start ssh

0 commit comments

Comments
 (0)