Circleci config pack not working

❯ tree src/test
src/test
├── @orb.yml
├── commands.yml
├── executors.yml
└── jobs.yml

0 directories, 4 files
❯ cat src/test/@orb.yml
# TODO foobar

version: 2.1
description: todo

orbs:
  slack: circleci/slack@0.1.10
  aws-cli: circleci/aws-cli@0.1.6
  utils: dialogue/sandbox@dev:utils
❯ cat src/test/commands.yml
aliases:
  - &param_foo
    foo:
      type: string

foo_command:
  parameters:
    <<: *param_foo
  steps:
    - run: echo '<<parameters.foo>>'
❯ cat src/test/executors.yml
python:
  parameters:
    node:
      type: enum
      enum:
        - node
        - node-browsers
        - node-browsers-legacy
      default: node
    version:
      type: enum
      enum:
        - "3.7"
        - "3.7.2"
        - "3.7.1"
        - "3.7.0"
        - "3.6"
        - "3.6.8"
        - "3.6.7"
        - "3.6.6"
        - "3.6.5"
        - "3.6.4"
        - "3.6.3"
      default: "3.7"
  docker:
    - image: circleci/python:<<parameters.version>>-<<parameters.node>>
❯ cat src/test/jobs.yml
aliases:
  - &param_bar
    bar:
      type: string

bar_job:
  parameters:
    <<: *param_bar
  steps:
    - run:
        name: bar job
        commandn: echo '<<parameters.bar>>'

Result

❯ cci config pack src/test
aliases:
- bar:
    type: string
bar_job:
  parameters:
    bar:
      type: string
  steps:
  - run:
      commandn: echo '<<parameters.bar>>'
      name: bar job
description: todo
foo_command:
  parameters:
    foo:
      type: string
  steps:
  - run: echo '<<parameters.foo>>'
orbs:
  aws-cli: circleci/aws-cli@0.1.6
  slack: circleci/slack@0.1.10
  utils: dialogue/sandbox@dev:utils
python:
  docker:
  - image: circleci/python:<<parameters.version>>-<<parameters.node>>
  parameters:
    node:
      default: node
      enum:
      - node
      - node-browsers
      - node-browsers-legacy
      type: enum
    version:
      default: "3.7"
      enum:
      - "3.7"
      - 3.7.2
      - 3.7.1
      - 3.7.0
      - "3.6"
      - 3.6.8
      - 3.6.7
      - 3.6.6
      - 3.6.5
      - 3.6.4
      - 3.6.3
      type: enum
version: 2.1

I expected:

version: 2.1
description: todo

orbs:
  aws-cli: circleci/aws-cli@0.1.6
  slack: circleci/slack@0.1.10
  utils: dialogue/sandbox@dev:utils

jobs:
  bar_job:
    parameters:
      bar:
        type: string
    steps:
      - run:
          commandn: echo '<<parameters.bar>>'
          name: bar job
      
commands:
  foo_command:
    parameters:
      foo:
        type: string
    steps:
      - run: echo '<<parameters.foo>>'
  
executors:
  python:
    docker:
    - image: circleci/python:<<parameters.version>>-<<parameters.node>>
    parameters:
      node:
        default: node
        enum:
        - node
        - node-browsers
        - node-browsers-legacy
        type: enum
      version:
        default: "3.7"
        enum:
        - "3.7"
        - "3.7.2"
        - "3.7.1"
        - "3.7.0"
        - "3.6"
        - "3.6.8"
        - "3.6.7"
        - "3.6.6"
        - "3.6.5"
        - "3.6.4"
        - "3.6.3"
        type: enum

Could you open up a bug report here instead: https://github.com/CircleCI-Public/circleci-cli/issues

@levlaz sure thing

Done https://github.com/CircleCI-Public/circleci-cli/issues/276

Hi @jasonkuhrt, I don’t think config pack will quite work with the file/directory structure you’ve got there.

As far as I understand it and have used it, pack expects each of the top-level CircleCI 2.1 configuration abstraction types (jobs, commands, executors, examples) to have its own sub-directory, with individual elements of each type in their own file within those sub-directories, and the files given the names of the individual elements (e.g., job1.yml, job2.yml in a jobs folder).

There may be other ways of using pack, too—for example, a config can only be partially packed, with some code still living in the top-level @orb.yml or @config.yml—but I did test an example along the lines of what you describe above and saw the same result, which I think is expected.

Take a look at our documentation on config-packing here:

https://circleci.com/docs/2.0/local-cli/#packing-a-config

Thank you!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.