Skip to content

feat: Support CircleCI CLI v1 - #44

Draft
zahorniak wants to merge 6 commits into
masterfrom
feat/circleci-cli-v1-support
Draft

feat: Support CircleCI CLI v1#44
zahorniak wants to merge 6 commits into
masterfrom
feat/circleci-cli-v1-support

Conversation

@zahorniak

Copy link
Copy Markdown
Owner

Summary

Closes #43.

  • Add a shared module circleci_cli.py. It detects the installed CLI generation at run time (legacy 0.1.x or CLI v1) and builds generation-correct commands.
  • All four hooks translate their arguments automatically:
    • validate path: positional on legacy, --config <path> on v1 (v1 silently ignores a positional path, so this prevents wrong-file validation)
    • --org-slug/--org-id--org (translation works in both directions, so one .pre-commit-config.yaml works for a team with mixed CLI versions)
    • --verbose--debug on v1
  • Fix an existing bug: the pack hook forwarded --org-slug/--org-id, but circleci config pack rejects these flags on both CLI generations. The hook now warns and does not forward them.
  • Set CIRCLECI_CLI_SKIP_UPDATE_CHECK=true for all CLI calls. This makes legacy hook runs faster.
  • README: link the new CLI download page (https://cli.circleci.com/), keep a legacy-labeled link, and document CLI version support and the v1 API-token requirement.

Test plan

  • Full pytest suite: 87 passed (35 new/updated tests: detection, builders, per-hook translation on both generations)
  • Smoke test with the real legacy binary (0.1.34038): validate exit 0, pack exit 0
  • Smoke test with the real CLI v1 binary (1.0.46087-pre): validate reaches the API token gate with translated flags (no "unknown flag" error), pack exit 0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to CircleCI CLI v1

1 participant