Skip to content

Commit f22d88f

Browse files
committed
refactor: remove deprecated stage concept from codebase
- Remove all 'stage = "..."' fields from logging statements throughout src/ - Remove 'stages = N' fields from workflow logging - Remove Stage N: comments as functions are now self-explanatory - Update documentation references from 'stages' to 'workflows' - Update template renderer comments to use 'deployment workflows' terminology - Update template module to use 'sequential template resolution' This aligns the codebase with the three-level architecture (commands, steps, remote actions) documented in docs/three-level-architecture.md, removing references to the old stage concept.
1 parent 3bfb4d7 commit f22d88f

22 files changed

+15
-66
lines changed

docs/current-implementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ These features are fully working in the E2E test environment:
9696

9797
### 4. State Management
9898

99-
- **Deployment States**: Track progression through deployment stages
99+
- **Deployment States**: Track progression through deployment workflow
100100
- **State Persistence**: Save/load state between command invocations
101101
- **State Validation**: Ensure commands are run in correct sequence
102102
- **Error Recovery**: Handle partial deployments and failures

docs/decisions/docker-testing-rejection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Despite Docker's speed advantage, the performance difference is not significant
157157
**Approach**: Mock Docker daemon and systemd services in Docker containers
158158
**Rejection Reason**: Testing mocks instead of real services provides false confidence
159159

160-
### 2. Staged Testing Pipeline
160+
### 2. Sequential Testing Pipeline
161161

162162
**Approach**: Basic tests in Docker, comprehensive tests in LXD
163163
**Rejection Reason**: Dual infrastructure complexity outweighs benefits; inconsistent results between environments

src/ansible/template_renderer.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! # Ansible Template Renderer
22
//!
3-
//! This module handles `Ansible` template rendering for deployment stages.
3+
//! This module handles `Ansible` template rendering for deployment workflows.
44
//! It manages the creation of build directories, copying static template files (playbooks and configs),
55
//! and processing dynamic Tera templates with runtime variables (like inventory.yml.tera).
66
//!
@@ -111,7 +111,7 @@ pub enum ConfigurationTemplateError {
111111

112112
/// Renders `Ansible` configuration templates to a build directory
113113
///
114-
/// This collaborator is responsible for preparing `Ansible` templates for deployment stages.
114+
/// This collaborator is responsible for preparing `Ansible` templates for deployment workflows.
115115
/// It handles both static files (playbooks, configuration) and dynamic Tera templates that
116116
/// require runtime variable substitution (inventory files with IP addresses).
117117
pub struct AnsibleTemplateRenderer {
@@ -174,7 +174,6 @@ impl AnsibleTemplateRenderer {
174174
inventory_context: &InventoryContext,
175175
) -> Result<(), ConfigurationTemplateError> {
176176
tracing::info!(
177-
stage = "configuration_rendering",
178177
template_type = "ansible",
179178
"Rendering configuration templates with variables"
180179
);
@@ -194,26 +193,22 @@ impl AnsibleTemplateRenderer {
194193
.await?;
195194

196195
tracing::debug!(
197-
stage = "configuration_rendering",
198196
template_type = "ansible",
199197
output_dir = %build_ansible_dir.display(),
200198
"Configuration templates rendered"
201199
);
202200
tracing::debug!(
203-
stage = "configuration_rendering",
204201
template_type = "ansible_inventory",
205202
ansible_host = %inventory_context.ansible_host(),
206203
"Inventory rendered with IP"
207204
);
208205
tracing::debug!(
209-
stage = "configuration_rendering",
210206
template_type = "ansible_inventory",
211207
ssh_key = %inventory_context.ansible_ssh_private_key_file(),
212208
"Inventory rendered with SSH key"
213209
);
214210

215211
tracing::info!(
216-
stage = "configuration_rendering",
217212
template_type = "ansible",
218213
status = "complete",
219214
"Configuration templates ready"

src/bin/e2e_tests.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ async fn main() -> Result<()> {
7373
(Ok(_), Err(validation_err)) => {
7474
error!(
7575
test_suite = "e2e_tests",
76-
stage = "validation",
7776
status = "failed",
7877
error = %validation_err,
7978
"Deployment succeeded but validation failed"
@@ -83,7 +82,6 @@ async fn main() -> Result<()> {
8382
(Err(deployment_err), Ok(())) => {
8483
error!(
8584
test_suite = "e2e_tests",
86-
stage = "deployment",
8785
status = "failed",
8886
error = %deployment_err,
8987
"Deployment failed"
@@ -93,7 +91,6 @@ async fn main() -> Result<()> {
9391
(Err(deployment_err), Err(_)) => {
9492
error!(
9593
test_suite = "e2e_tests",
96-
stage = "deployment",
9794
status = "failed",
9895
error = %deployment_err,
9996
"Deployment failed (validation skipped)"
@@ -116,21 +113,14 @@ async fn run_full_deployment_test(env: &TestEnvironment) -> Result<IpAddr> {
116113
info!(
117114
test_type = "full_deployment",
118115
workflow = "template_based",
119-
stages = 3,
120116
"Starting full deployment E2E test"
121117
);
122118

123-
// Stage 1: Provision infrastructure (includes template rendering, infrastructure creation, SSH wait, and Ansible template rendering)
124119
let instance_ip = provision_infrastructure(env).await?;
125120

126-
// Stage 2: Configure infrastructure (wait for cloud-init and install Docker/Docker Compose)
127121
configure_infrastructure(env)?;
128122

129-
info!(
130-
stage = "deployment",
131-
status = "success",
132-
"Deployment stages completed successfully"
133-
);
123+
info!(status = "success", "Deployment completed successfully");
134124

135125
info!(
136126
test_type = "full_deployment",

src/commands/configure.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ impl ConfigureCommand {
4141
pub fn execute(&self) -> Result<(), ConfigureCommandError> {
4242
info!(
4343
command = "configure",
44-
stage = "starting",
4544
"Starting complete infrastructure configuration workflow"
4645
);
4746

@@ -51,7 +50,6 @@ impl ConfigureCommand {
5150

5251
info!(
5352
command = "configure",
54-
stage = "completed",
5553
"Infrastructure configuration completed successfully"
5654
);
5755

src/commands/provision.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ impl ProvisionCommand {
108108
pub async fn execute(&self) -> Result<IpAddr, ProvisionCommandError> {
109109
info!(
110110
command = "provision",
111-
stage = "starting",
112111
"Starting complete infrastructure provisioning workflow"
113112
);
114113

@@ -139,7 +138,6 @@ impl ProvisionCommand {
139138

140139
info!(
141140
command = "provision",
142-
stage = "completed",
143141
instance_ip = %instance_ip,
144142
"Infrastructure provisioning completed successfully"
145143
);

src/commands/test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ impl TestCommand {
5353
pub async fn execute(&self) -> Result<(), TestCommandError> {
5454
info!(
5555
command = "test",
56-
stage = "starting",
5756
instance_ip = %self.instance_ip,
5857
"Starting complete infrastructure testing workflow"
5958
);
@@ -74,7 +73,6 @@ impl TestCommand {
7473

7574
info!(
7675
command = "test",
77-
stage = "completed",
7876
instance_ip = %self.instance_ip,
7977
"Infrastructure testing workflow completed successfully"
8078
);

src/e2e/tasks/configure_infrastructure.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ use crate::e2e::environment::TestEnvironment;
1313
/// - `ConfigureCommand` execution fails
1414
/// - Infrastructure configuration fails
1515
pub fn configure_infrastructure(env: &TestEnvironment) -> Result<()> {
16-
info!(
17-
stage = "infrastructure_configuration",
18-
"Configuring test infrastructure"
19-
);
16+
info!("Configuring test infrastructure");
2017

2118
// Use the new ConfigureCommand to handle all infrastructure configuration steps
2219
let configure_command = ConfigureCommand::new(Arc::clone(&env.services.ansible_client));
@@ -27,7 +24,6 @@ pub fn configure_infrastructure(env: &TestEnvironment) -> Result<()> {
2724
.context("Failed to configure infrastructure")?;
2825

2926
info!(
30-
stage = "infrastructure_configuration",
3127
status = "complete",
3228
"Infrastructure configuration completed successfully"
3329
);

src/e2e/tasks/provision_infrastructure.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ use crate::e2e::environment::TestEnvironment;
1515
/// - Infrastructure provisioning fails
1616
/// - IP address cannot be obtained from `OpenTofu` outputs
1717
pub async fn provision_infrastructure(env: &TestEnvironment) -> Result<IpAddr> {
18-
info!(
19-
stage = "infrastructure_provisioning",
20-
"Provisioning test infrastructure"
21-
);
18+
info!("Provisioning test infrastructure");
2219

2320
// Use the new ProvisionCommand to handle all infrastructure provisioning steps
2421
let provision_command = ProvisionCommand::new(
@@ -36,7 +33,6 @@ pub async fn provision_infrastructure(env: &TestEnvironment) -> Result<IpAddr> {
3633
.context("Failed to provision infrastructure")?;
3734

3835
info!(
39-
stage = "infrastructure_provisioning",
4036
status = "complete",
4137
opentofu_ip = %opentofu_instance_ip,
4238
"Infrastructure provisioned successfully"

src/e2e/tasks/validate_deployment.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::e2e::environment::TestEnvironment;
1313
/// - `TestCommand` execution fails
1414
/// - Any validation check fails
1515
pub async fn validate_deployment(env: &TestEnvironment, instance_ip: &IpAddr) -> Result<()> {
16-
info!(stage = "validation", "Starting deployment validation");
16+
info!("Starting deployment validation");
1717

1818
// Use the new TestCommand to handle all infrastructure validation steps
1919
let test_command = TestCommand::new(env.config.ssh_credentials.clone(), *instance_ip);
@@ -24,10 +24,6 @@ pub async fn validate_deployment(env: &TestEnvironment, instance_ip: &IpAddr) ->
2424
.map_err(anyhow::Error::from)
2525
.context("Failed to validate deployment")?;
2626

27-
info!(
28-
stage = "validation",
29-
status = "success",
30-
"All deployment validations passed"
31-
);
27+
info!(status = "success", "All deployment validations passed");
3228
Ok(())
3329
}

0 commit comments

Comments
 (0)