Skip to content

Component dependency ordering#3

Merged
russellseymour merged 9 commits into
mainfrom
feature/affected-order
Nov 24, 2025
Merged

Component dependency ordering#3
russellseymour merged 9 commits into
mainfrom
feature/affected-order

Conversation

@russellseymour

Copy link
Copy Markdown
Contributor

Pull Request: Add Project Order Support and Migrate to Eirctl

📲 What

This PR implements the following changes:

  1. Project Order Feature: Added an order field to project configuration that allows projects to be executed in a specific sequence when affected by changes
  2. Migration from Taskctl to Eirctl: Migrated the build tooling from Taskctl to Eirctl for better consistency across the organization
  3. Documentation Updates: Updated usage documentation to reflect the new order feature and added comprehensive Copilot instructions for the project

🤔 Why

Project Order Feature

In monorepo scenarios, projects often have dependencies on each other. For example, infrastructure resources (like Terraform state storage) need to be deployed before other infrastructure components. Without execution ordering, there's no guarantee that projects will build in the correct sequence, potentially causing build failures when dependencies aren't met.

Eirctl Migration

The migration from Taskctl to Eirctl aligns the project with organizational standards and provides better build tooling consistency across Ensono Stacks projects.

🛠 How

Project Order Implementation

  • Added Order int field to the Project struct in internal/config/project.go
  • Added Order int field to the SpawnBuild model in internal/models/spawn_build.go
  • Modified internal/affected/affected.go to:
    • Import the sort package
    • Populate the Order field when creating SpawnBuild instances
    • Sort the spawns slice by Order (ascending) before execution using sort.Slice()
  • Updated configuration file schema to support the order attribute (defaults to 0 if not specified)

Eirctl Migration

  • Renamed taskctl.yamleirctl.yaml
  • Moved build configuration from build/taskctl/build/eirctl/
  • Created new build/eirctl/contexts.yaml for environment-specific settings
  • Updated GitHub Actions workflow to use install-eirctl action instead of install-taskctl
  • Modified build scripts (Invoke-Compile.ps1, Invoke-IntegrationTests.ps1) to call eirctl commands
  • Removed old Taskctl configuration files and GitHub action template

Documentation

  • Updated docs/usage.adoc to document the order attribute in the configuration file settings table
  • Added example YAML showing order usage (tfstate with order: 0, ancillary with order: 1)
  • Created .github/copilot-instructions.md with comprehensive project documentation for AI-assisted development

👀 Evidence

Files Changed: 16 files modified

  • Core implementation: affected.go, project.go, spawn_build.go
  • Build tooling: Migration from Taskctl to Eirctl
  • Documentation: usage.adoc, copilot-instructions.md
  • Configuration: eirctl.yaml, GitHub Actions workflow

Key Commits:

  • db19f56 - Added order property to projects
  • f7032a9 - Migrated from Taskctl to Eirctl
  • 5b02d19 - Updated docs and added Copilot instructions

🕵️ How to test

Testing the Order Feature

  1. Create a test configuration with multiple projects having different order values:
projects:
  - name: infrastructure
    folder: src/infrastructure
    patterns: [".*\\.tf"]
    build:
      cmd: echo "Building infrastructure"
    order: 0
    
  - name: application
    folder: src/app
    patterns: [".*\\.go"]
    build:
      cmd: echo "Building application"
    order: 1
  1. Make changes to both folders to trigger both projects:
touch src/infrastructure/main.tf
touch src/app/main.go
  1. Run mrbuild with dry-run to verify order:
mrbuild affected -c ./mrbuild.yaml --dryrun --loglevel debug
  1. Verify that "Building infrastructure" is queued before "Building application"

Testing Eirctl Migration

  1. Run the compilation:
eirctl _compile
  1. Run integration tests:
eirctl _integration
  1. Verify that builds complete successfully without errors

Testing Documentation

  1. Review docs/usage.adoc to ensure the order field is properly documented
  2. Review .github/copilot-instructions.md for completeness and accuracy

Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
… correct order when analysed

Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
@ensonostacks

Copy link
Copy Markdown

No description provided.

@RichardSlater RichardSlater left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Predominantly need tests to cover happy and unhappy path, also some mild inefficiency / cartesian bomb.

Comment thread build/github/templates/install-eirctl/action.yaml Outdated
Comment thread internal/affected/affected.go Outdated
Comment thread internal/affected/affected.go
Added tests for the ordering of projects
Moved ordering of the projects

Signed by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
@ensonostacks

Copy link
Copy Markdown

No description provided.

@RichardSlater RichardSlater left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@russellseymour russellseymour merged commit d58ba0e into main Nov 24, 2025
4 checks passed
@russellseymour russellseymour deleted the feature/affected-order branch November 24, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants