Skip to content

Add E2E CI artifact dependency generation and validation tooling#47814

Draft
pducolin wants to merge 1 commit intomainfrom
pducolin/e2e-manifest-generation
Draft

Add E2E CI artifact dependency generation and validation tooling#47814
pducolin wants to merge 1 commit intomainfrom
pducolin/e2e-manifest-generation

Conversation

@pducolin
Copy link
Collaborator

@pducolin pducolin commented Mar 13, 2026

What does this PR do?

Introduces tooling to generate and validate E2E test artifact dependencies from GitLab CI configuration. This establishes the GitLab CI configuration (.gitlab/test/e2e/e2e.yml) as the source of truth, with manifests (e2e-dependencies.yaml) serving as documentation of what artifacts each test area needs. Next we'll generate the e2e.yml from these manifest, migrating the source of truth closer to tests.

New Commands:

  • dda e2e generate-manifests - Generate manifests from current CI configuration
  • dda e2e generate-ci-deps - Validate CI configuration against manifests #TODO remove this, have a --validate in previous command

Key Features:

  • Handles GitLab !reference tags and template inheritance
  • Resolves variables from extended templates (e.g., TARGETS from .new_e2e_template_needs_*)
  • Detects init jobs (no artifacts needed)
  • Supports test-specific artifact overrides via pattern matching
  • Handles jobs without test patterns via MANUAL: prefix for manual review
  • Comprehensive validation workflow with detailed error reporting

Generated Artifacts:

  • 12 e2e-dependencies.yaml manifests across test areas
  • Pre-commit hook to validate E2E CI dependencies
  • Updated E2E documentation reflecting CI-as-source-of-truth workflow

Motivation

E2E tests depend on specific GitLab CI build artifacts (e.g., qa_agent_linux, agent_deb, deploy_*). Previously, these dependencies were implicit in CI job needs: sections, making it difficult to:

  • Understand what artifacts a test area needs
  • Detect missing or incorrect dependencies
  • Track changes to artifact requirements over time

This tooling makes dependencies explicit and provides automated validation.

Describe how you validated your changes

1. Manifest Generation:

dda e2e generate-manifests
  • Generated manifests for all 12 test areas
  • Each manifest correctly extracted default artifacts from CI configuration
  • Test-specific patterns correctly identified (e.g., Docker vs ECS in containers)
  • Init jobs correctly detected and handled

2. Validation:

dda e2e generate-ci-deps --validate
  • All 12 manifests validate successfully against current CI configuration
  • Verified exact artifact matching between manifests and CI

3. Template Variable Resolution:

  • Tested with agent-platform area where jobs inherit TARGETS from templates
  • Correctly resolved variables through template inheritance chain
  • MANUAL: patterns correctly generated for jobs without --run patterns

4. Edge Cases:

  • Init jobs (e.g., new-e2e-containers-init) correctly detected via:
    • -init suffix
    • E2E_INIT_ONLY=true variable
    • e2e_init stage
  • GitLab !reference tags correctly parsed and resolved
  • Multiple jobs with different artifacts in same area handled via test-specific patterns
  • Jobs without test patterns flagged with MANUAL: prefix for review

5. Pre-commit Hook:

  • Added validation hook runs successfully on commit
  • Catches mismatches between CI and manifests

6. Documentation:

  • Updated all E2E docs to reflect correct workflow
  • Verified MANIFESTS-STATUS.md accurately reflects current state

Additional Notes

Non-Functional Change: This PR only adds tooling and documentation. It does not modify any test code or CI job behavior. Labels:

  • qa/no-code-change - No runtime code changes
  • changelog/no-changelog - Tooling/documentation only

Future Work:

  • Consider adding CI job to automatically validate dependencies on PR
  • Add dda e2e update-ci-deps to automatically update CI from manifests (if workflow reverses)
  • Extend validation to check for unused artifacts

Files Changed:

  • .dda/extend/commands/e2e/generate_manifests/__init__.py - Manifest generation command
  • .dda/extend/commands/e2e/generate_ci_deps/__init__.py - Validation command
  • test/new-e2e/tests/*/e2e-dependencies.yaml - 12 manifest files
  • test/new-e2e/E2E-CI-DEPENDENCIES.md - Updated workflow documentation
  • .pre-commit-config.yaml - Added validation hook

This PR introduces tooling to generate and validate E2E test artifact
dependencies from GitLab CI configuration. The CI configuration
(.gitlab/test/e2e/e2e.yml) is the source of truth, and manifests
(e2e-dependencies.yaml) document what artifacts each test area needs.

Changes:
- Add `dda e2e generate-manifests` command to generate manifests from CI
- Add `dda e2e generate-ci-deps` command to validate CI against manifests
- Generate 12 e2e-dependencies.yaml manifests for test areas
- Add pre-commit hook to validate E2E CI dependencies
- Update E2E documentation to reflect CI-as-source-of-truth workflow

Key features:
- Handles GitLab !reference tags and template inheritance
- Resolves variables from extended templates
- Detects init jobs (no artifacts needed)
- Supports test-specific artifact overrides via pattern matching
- Handles jobs without test patterns via MANUAL: prefix
- Comprehensive validation workflow

Validation:
- Generated manifests for all 12 test areas
- Ran `dda e2e generate-ci-deps --validate` - all pass
- Verified template variable resolution works correctly
- Tested MANUAL: pattern handling for jobs without --run flags
- Confirmed init job detection (suffix, variable, stage)
@pducolin pducolin added changelog/no-changelog No changelog entry needed qa/no-code-change No code change in Agent code requiring validation labels Mar 13, 2026
@pducolin pducolin requested review from a team as code owners March 13, 2026 13:35
@github-actions github-actions bot added the long review PR is complex, plan time to review it label Mar 13, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 302ebf2263

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +277 to +279
# Skip MANUAL: patterns - they can't be automatically matched
if pattern.startswith("MANUAL:"):
continue

Choose a reason for hiding this comment

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

P1 Badge Handle MANUAL patterns when test pattern is absent

This logic unconditionally skips MANUAL: overrides, and because it only evaluates test_specific entries when test_pattern is present, jobs without a --run flag always fall back to default_artifacts. In the added manifests this already affects test/new-e2e/tests/agent-platform/e2e-dependencies.yaml (the MANUAL:new-e2e-package-signing-suse-a7-x86_64 entry), so --validate reports a mismatch for the SUSE package-signing job and the suggested non-validate "fix" path would push the wrong artifact set.

Useful? React with 👍 / 👎.

Comment on lines +199 to +203
for template_name in extends:
if template_name in ci_config:
template = ci_config[template_name]
if isinstance(template, dict) and "variables" in template:
merged_vars.update(template["variables"])

Choose a reason for hiding this comment

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

P2 Badge Recurse through extended templates when collecting variables

Variable resolution only reads templates listed directly in extends, so it misses values inherited through a parent template chain. In .gitlab/test/e2e/e2e.yml, new-e2e-ssi-eks extends .new-e2e_ssi_extra_distribution, which gets TARGETS from .new-e2e_ssi; with the current implementation TARGETS is nil, so the job is skipped during manifest generation/validation and that area's dependencies are silently incomplete.

Useful? React with 👍 / 👎.

Comment on lines +402 to +404
# Add new artifacts
for artifact in sorted(artifacts):
new_needs.append(artifact)

Choose a reason for hiding this comment

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

P2 Badge Preserve optional needs metadata when rewriting artifacts

When applying updates, artifact dependencies are re-added as bare strings, which strips optional: true from any artifact originally expressed as {"job": ..., "optional": true}. If a mismatch is fixed in write mode, jobs with optional artifact needs (for example Windows artifacts in E2E jobs) become hard requirements, which can break pipelines that intentionally allow those producers to be absent.

Useful? React with 👍 / 👎.

@agent-platform-auto-pr
Copy link
Contributor

Files inventory check summary

File checks results against ancestor 88d4c44f:

Results for datadog-agent_7.78.0~devel.git.530.302ebf2.pipeline.102361774-1_amd64.deb:

No change detected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant