Skip to content

Include cycle detected between the same file if taskfile is not set #2204

@Skarlso

Description

@Skarlso

Description

Consider the following task file:

version: '3'

dotenv: ['.env', '.env.local']

includes:
#  tools:
#    taskfile: ./tools.Taskfile.yml
  bindings/go/descriptor/v2:
    optional: true
    dir: ./bindings/go/descriptor/v2
#    taskfile: ./bindings/go/descriptor/v2/Taskfile.yml
  bindings/go/descriptor/runtime:
    optional: true
    dir: ./bindings/go/descriptor/runtime
#    taskfile: ./bindings/go/descriptor/runtime/Taskfile.yml
  bindings/go/runtime:
    optional: true
    dir: ./bindings/go/runtime
#    taskfile: ./bindings/go/runtime/Taskfile.yml
  bindings/go/generator:
    optional: true
    dir: ./bindings/go/generator
#    taskfile: ./bindings/go/generator/Taskfile.yml
  bindings/go/blob:
    optional: true
    dir: ./bindings/go/blob
#    taskfile: ./bindings/go/blob/Taskfile.yml
  bindings/go/ctf:
    optional: true
    dir: ./bindings/go/ctf
#    taskfile: ./bindings/go/ctf/Taskfile.yml
  bindings/go/oci:
    optional: true
    dir: ./bindings/go/oci
#    taskfile: ./bindings/go/oci/Taskfile.yml
  bindings/go/oci/integration:
    optional: true
    dir: ./bindings/go/oci/integration
#    taskfile: ./bindings/go/oci/integration/Taskfile.yml
  bindings/go/dag:
    optional: true
    dir: ./bindings/go/dag
#    taskfile: ./bindings/go/dag/Taskfile.yml
  cli:
    optional: true
    dir: ./cli
#    taskfile: ./cli/Taskfile.yml

#vars:
#  GO_MODULES:
#    sh: find {{ .ROOT_DIR }} -name go.mod -exec dirname {} \; | sed 's|{{ .ROOT_DIR }}/||'


tasks:
  default:
    deps: ["cli:build"]

  go_modules:
    desc: "List all Go Modules available in this project"
    cmd: echo "{{ .GO_MODULES }}"
    silent: true

  test:
    desc: "Run all tests in the project"
    vars:
      TASKS:
        sh: "task -aj | jq -r '.tasks[] | select(.name | endswith(\":test\")) | .name | rtrimstr(\":test\")'"
    cmds:
      - for: { var: TASKS }
        task: '{{.ITEM}}:test'
  test/integration:
    desc: "Run all integration tests in the project, possibly requiring external systems"
    vars:
      TASKS:
        sh: "task -aj | jq -r '.tasks[] | select(.name | endswith(\":test/integration\")) | .name | rtrimstr(\":test/integration\")'"
    cmds:
      - for: { var: TASKS }
        task: '{{.ITEM}}:test/integration'

  init/go.work:
    desc: "Initialize the workspace environment"
    status:
      - find go.work
    cmds:
      - go work init
      - for: { var: GO_MODULES }
        cmd: 'go work use {{.ITEM}}'
      - go work sync

  generate:
    desc: "Run all Code Generators in the project"
    cmds:
      - task: 'bindings/go/generator:ocmtypegen/generate'
      - task: 'tools:deepcopy-gen/generate-deepcopy'
      - task: 'cli:generate/docs'
        vars:
          CLI_DOCUMENTATION_MODE: "markdown"
          CLI_DOCUMENTATION_DIRECTORY: '{{ .ROOT_DIR }}/docs/reference/cli'

I honestly have no idea why this is an import cycle and with taskfile defined, it's not. Please help 🙇

the error:

task: include cycle detected between /home/runner/work/open-component-model/open-component-model/Taskfile.yml <--> /home/runner/work/open-component-model/open-component-model/Taskfile.yml

Version

❯ task --version Task version: 3.42.1 (Homebrew)

Operating system

osx, linux

Experiments Enabled

No response

Example Taskfile

version: '3'

dotenv: ['.env', '.env.local']

includes:
#  tools:
#    taskfile: ./tools.Taskfile.yml
  bindings/go/descriptor/v2:
    optional: true
    dir: ./bindings/go/descriptor/v2
#    taskfile: ./bindings/go/descriptor/v2/Taskfile.yml
  bindings/go/descriptor/runtime:
    optional: true
    dir: ./bindings/go/descriptor/runtime
#    taskfile: ./bindings/go/descriptor/runtime/Taskfile.yml
  bindings/go/runtime:
    optional: true
    dir: ./bindings/go/runtime
#    taskfile: ./bindings/go/runtime/Taskfile.yml
  bindings/go/generator:
    optional: true
    dir: ./bindings/go/generator
#    taskfile: ./bindings/go/generator/Taskfile.yml
  bindings/go/blob:
    optional: true
    dir: ./bindings/go/blob
#    taskfile: ./bindings/go/blob/Taskfile.yml
  bindings/go/ctf:
    optional: true
    dir: ./bindings/go/ctf
#    taskfile: ./bindings/go/ctf/Taskfile.yml
  bindings/go/oci:
    optional: true
    dir: ./bindings/go/oci
#    taskfile: ./bindings/go/oci/Taskfile.yml
  bindings/go/oci/integration:
    optional: true
    dir: ./bindings/go/oci/integration
#    taskfile: ./bindings/go/oci/integration/Taskfile.yml
  bindings/go/dag:
    optional: true
    dir: ./bindings/go/dag
#    taskfile: ./bindings/go/dag/Taskfile.yml
  cli:
    optional: true
    dir: ./cli
#    taskfile: ./cli/Taskfile.yml

#vars:
#  GO_MODULES:
#    sh: find {{ .ROOT_DIR }} -name go.mod -exec dirname {} \; | sed 's|{{ .ROOT_DIR }}/||'


tasks:
  default:
    deps: ["cli:build"]

  go_modules:
    desc: "List all Go Modules available in this project"
    cmd: echo "{{ .GO_MODULES }}"
    silent: true

  test:
    desc: "Run all tests in the project"
    vars:
      TASKS:
        sh: "task -aj | jq -r '.tasks[] | select(.name | endswith(\":test\")) | .name | rtrimstr(\":test\")'"
    cmds:
      - for: { var: TASKS }
        task: '{{.ITEM}}:test'
  test/integration:
    desc: "Run all integration tests in the project, possibly requiring external systems"
    vars:
      TASKS:
        sh: "task -aj | jq -r '.tasks[] | select(.name | endswith(\":test/integration\")) | .name | rtrimstr(\":test/integration\")'"
    cmds:
      - for: { var: TASKS }
        task: '{{.ITEM}}:test/integration'

  init/go.work:
    desc: "Initialize the workspace environment"
    status:
      - find go.work
    cmds:
      - go work init
      - for: { var: GO_MODULES }
        cmd: 'go work use {{.ITEM}}'
      - go work sync

  generate:
    desc: "Run all Code Generators in the project"
    cmds:
      - task: 'bindings/go/generator:ocmtypegen/generate'
      - task: 'tools:deepcopy-gen/generate-deepcopy'
      - task: 'cli:generate/docs'
        vars:
          CLI_DOCUMENTATION_MODE: "markdown"
          CLI_DOCUMENTATION_DIRECTORY: '{{ .ROOT_DIR }}/docs/reference/cli'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions