Skip to content

Package can't import a component from a different package that shares a dependency #3448

@daniel-s-palmer

Description

@daniel-s-palmer

Environment

Zarf version: v0.47.0

Steps to reproduce

  1. setup the following files/folder structsure:
├── child-component
│   └── zarf.yaml
├── jq
│   └── zarf.yaml
└── zarf.yaml

zarf.yaml:

---
kind: ZarfPackageConfig
metadata:
  name: example-package

components:
  # JQ
  - name: jq-amd64
    required: true
    import:
      path: jq

  - name: jq-darwin
    required: true
    import:
      path: jq

  - name: child-jq-command
    required: true
    import:
      path: child-component

  - name: jq-command    
    actions:
      onDeploy:
        defaults:
          mute: true
        before:
          - cmd: |
              echo "I'm doing something cool with JQ too!"
              echo "{}" | ./bin/jq

./jq/zarf.yaml:

---
kind: ZarfPackageConfig
metadata:
  name: jq
  description: Deploys the jq bin to the ./bin directory for use with other packages.

components:
  - name: jq-amd64
    only:
      localOS: linux
    required: true
    description: Deploy ./bin/jq bin for use in other components
    files:
      - source: https://github.com/stedolan/jq/releases/latest/download/jq-linux64
        target: ./bin/jq
        executable: true
  - name: jq-darwin
    only:
      localOS: darwin
    required: true
    description: Deploy ./bin/jq bin for use in other components
    files:
      - source: https://github.com/stedolan/jq/releases/latest/download/jq-osx-amd64
        target: ./bin/jq
        executable: true

./child-component/zarf.yaml

---
kind: ZarfPackageConfig
metadata:
  name: child-component

components:
  # JQ
  - name: jq-amd64
    required: true
    import:
      path: ../jq

  - name: jq-darwin
    required: true
    import:
      path: ../jq

  - name: child-jq-command
    actions:
      onDeploy:
        defaults:
          mute: true
        before:
          - cmd: |
              echo "I'm doing something cool with JQ"
              echo "{}" | ./bin/jq
  1. run zarf package create

Expected result

Package successfully creates as the package does not import the any component twice.

Actual Result

Package fails to create with the following error:

ERR failed to create package: package jq imported in cycle by child-component in component jq-amd64

Visual Proof (screenshots, videos, text, etc)

Severity/Priority

High

I can't build packages anymore

Additional Context

Add any other context or screenshots about the technical debt here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions