Skip to content

Two silent regressions in 1.0.x-pre config subcommands (validate ignores positional path; pack changed indentation) #1636

Description

@markarce

We maintain our CircleCI config as a split file tree and pack it in a pre-commit hook, which also validates the packed output by path. Upgrading the circleci@next CLI broke that hook in two independent ways, both in config subcommands and both silent (no error, no warning). Filing them together since they came from the same version bump, but happy to split.

1. config validate ignores the positional <path> argument

circleci config validate <path> no longer reads the path you give it. It always loads .circleci/config.yml relative to the current directory and ignores the positional argument. When a .circleci/config.yml happens to exist in the working dir, it validates that file and reports success, so you get a green result for a file that was never looked at.

Repro:

mkdir -p /tmp/demo/.circleci
cat > /tmp/demo/.circleci/config.yml <<'EOF'
version: 2.1
jobs:
  build:
    docker:
      - image: cimg/base:2024.01
    steps:
      - checkout
workflows:
  main:
    jobs:
      - build
EOF

cd /tmp/demo
circleci config validate /path/that/does/not/exist.yml

1.0.45351-pre:

Config file at ".circleci/config.yml" is valid.

It reports success for a path that doesn't exist. Running the same command from a directory with no .circleci/config.yml gives No config file found at ".circleci/config.yml". Again, the passed-in path is ignored either way.

0.1.38646 honors the path:

Error: failed to load yaml config from config path provider: Could not load config file at /path/that/does/not/exist.yml: open /path/that/does/not/exist.yml: no such file or directory

--config works on both, so circleci config validate --config <path> is the workaround.

Expected: honor the positional path like 0.1.x does (its --help documents Usage: circleci config validate <path> [flags]). If the positional was intentionally dropped for --config, then error on the unexpected argument instead of silently ignoring it; the current --help says "Reads .circleci/config.yml by default. Pass --config to specify a different file", but nothing warns existing callers that a positional path is now a no-op.

2. config pack changed its output indentation (4 spaces → 2 spaces)

circleci config pack <dir> now emits 2-space indentation where 0.1.x used 4 spaces. The content is identical; only whitespace changed. Any packed file that was generated and committed with the old CLI now gets rewritten end to end the first time someone re-packs with the new one, and it flips back for anyone still on the old CLI, causing churn/conflicts.

Repro:

mkdir -p /tmp/packdemo/jobs
printf 'version: 2.1\n' > /tmp/packdemo/@config.yml
cat > /tmp/packdemo/jobs/build.yml <<'EOF'
docker:
  - image: cimg/base:2024.01
steps:
  - checkout
EOF

circleci config pack /tmp/packdemo

0.1.38646:

jobs:
    build:
        docker:
            - image: cimg/base:2024.01
        steps:
            - checkout
version: 2.1

1.0.45351-pre:

jobs:
  build:
    docker:
      - image: cimg/base:2024.01
    steps:
      - checkout
version: 2.1

Expected: keep config pack output byte-stable with 0.1.x (4-space indentation), or if this is a deliberate change, please call it out in the release notes and ideally offer a flag, so teams with committed packed configs can migrate in one intentional commit rather than getting surprise whole-file diffs.

Environment

  • Broken: 1.0.45218-pre, still broken on 1.0.45351-pre (current tip of the circleci@next Homebrew cask). Verified on both.
  • Works: 0.1.38646 (Homebrew circleci formula).
  • macOS, Apple Silicon.

The newest pre-release on GitHub is 1.0.45445-pre, which isn't in Homebrew yet; nothing in the notes between 45351 and 45445 looks related, but I haven't been able to test it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions