Skip to content

feat(ci): add --skip-tasks flag to bit ci pr#10436

Open
davidfirst wants to merge 4 commits into
masterfrom
optimize-ci-pr-skip-tasks
Open

feat(ci): add --skip-tasks flag to bit ci pr#10436
davidfirst wants to merge 4 commits into
masterfrom
optimize-ci-pr-skip-tasks

Conversation

@davidfirst

@davidfirst davidfirst commented Jun 22, 2026

Copy link
Copy Markdown
Member

Exposes the builder's existing skipTasks mechanism on bit ci pr via a new --skip-tasks <names> flag (comma-separated task names or aspect-ids). It reaches both the build pipeline and the snap/tag pipeline, so it can skip build artifacts and publishing.

The schema/preview artifacts and the npm publish are generally useful (browsable preview, API schema, installable lane packages), but on our PR validation lane we deliberately trade them for speed — they're produced again on the final export to main. The bit_pr CI job now skips ExtractSchema, GeneratePreview, GenerateEnvTemplate and PublishComponents (~8-10m saved). The flag itself is general and user-facing, useful for anyone wanting faster PR builds.

Stacks on top of the --skip-cleanup work (#10431).

e2e: a control run proves the tasks run by default (non-vacuous), then --skip-tasks is asserted to omit them while a non-skipped sibling (PackComponents) confirms the pipeline still ran.

Exposes the existing builder skipTasks mechanism on `bit ci pr`, letting a
PR build skip named build/publish tasks. On the throwaway PR lane the schema
and preview artifacts and the npm publish aren't needed (they're regenerated
on the final export to main), so skipping them speeds up the job.

Wire bit_pr CI to skip ExtractSchema, GeneratePreview, GenerateEnvTemplate
and PublishComponents (~8-10m). Flag is general/user-facing and reaches both
the build and snap/tag pipelines.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

feat(ci): add --skip-tasks to bit ci pr and speed up PR CI runs
✨ Enhancement ⚙️ Configuration changes 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

Description

• Add --skip-tasks flag to bit ci pr to omit named build/publish tasks during snap/export.
• Propagate skipTasks through CI runtime and apply it in the CircleCI bit_pr job.
• Update CLI references and add e2e coverage for default vs skipped task execution.
Diagram

graph TD
  A["CircleCI bit_pr job"] --> B["bit ci pr --skip-tasks"] --> C["CiPrCmd"] --> D["CiMain"] --> E["Snap/Export pipeline"] --> F["Builder task filter"] --> G[("Bit Cloud / NPM")]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Parse/validate skip list early (array + known-task checks)
  • ➕ Catches typos immediately (fail-fast) instead of silently not skipping
  • ➕ Allows clearer help output (e.g., echo back normalized task ids)
  • ➕ Easier to extend to repeated flags or structured config later
  • ➖ Requires maintaining a source of truth for task names/aspect-ids
  • ➖ More coupling between CLI layer and builder internals
2. Support repeated flags (`--skip-task X --skip-task Y`)
  • ➕ More shell-friendly (no comma parsing/quoting issues)
  • ➕ Easier to compose in CI templates and partial overrides
  • ➖ Slightly larger CLI surface area
  • ➖ Still needs internal parsing/merging logic
3. CI-only mechanism via env var or config file
  • ➕ Avoids expanding the user-facing CLI surface if intended only for CI
  • ➕ Centralizes CI tuning without changing command invocations
  • ➖ Less discoverable; harder for users to leverage locally
  • ➖ Adds another configuration channel to document and maintain

Recommendation: Current approach (a single --skip-tasks flag that plumbs through to existing skipTasks) is the best fit for this PR: it reuses proven builder behavior, improves CI speed immediately, and remains generally useful to end users. If follow-up work is planned, consider adding light validation/normalization of the skip list (and optionally a repeated-flag variant) to reduce typo-driven surprises.

Files changed (7) +86 / -11

Enhancement (2) +17 / -0
ci.main.runtime.tsPlumb 'skipTasks' through CI PR flows into pipeline execution +10/-0

Plumb 'skipTasks' through CI PR flows into pipeline execution

• Adds 'skipTasks' to the 'ci pr' runtime options and forwards it into both the existing-lane and temp-lane snap/export paths. Ensures the skip list reaches the underlying pipeline execution call that honors 'skipTasks'.

scopes/git/ci/ci.main.runtime.ts

pr.cmd.tsAdd '--skip-tasks' CLI option to 'bit ci pr' +7/-0

Add '--skip-tasks' CLI option to 'bit ci pr'

• Defines the new 'skip-tasks <tasks>' option (CSV of task names/aspect-ids) on the PR command. Passes the parsed value through to the CI runtime invocation.

scopes/git/ci/commands/pr.cmd.ts

Tests (1) +50 / -0
ci-commands.e2e.tsAdd e2e coverage for 'bit ci pr --skip-tasks' +50/-0

Add e2e coverage for 'bit ci pr --skip-tasks'

• Introduces an e2e scenario with a control run proving tasks execute by default, then a run with '--skip-tasks' asserting named tasks are omitted. Also asserts a non-skipped sibling task still runs to ensure the pipeline wasn’t short-circuited.

e2e/harmony/ci-commands.e2e.ts

Documentation (3) +16 / -10
CLI_REFERENCE.mdDocument '--skip-tasks' in 'bit ci pr' flags list +1/-1

Document '--skip-tasks' in 'bit ci pr' flags list

• Extends the 'bit ci pr' documentation to include the new '--skip-tasks <tasks>' option.

contrib/claude-skill-bit-cli/CLI_REFERENCE.md

cli-reference.jsonUpdate generated CLI reference JSON for '--skip-tasks' +5/-0

Update generated CLI reference JSON for '--skip-tasks'

• Adds the 'skip-tasks <tasks>' option entry and description to the machine-readable CLI reference for 'bit ci pr'.

scopes/harmony/cli-reference/cli-reference.json

cli-reference.mdxUpdate CLI reference MDX with '--skip-tasks' option +10/-9

Update CLI reference MDX with '--skip-tasks' option

• Extends the 'bit ci pr' options table to include '--skip-tasks <tasks>' with guidance and an example list.

scopes/harmony/cli-reference/cli-reference.mdx

Other (1) +3 / -1
config.ymlSpeed up 'bit ci pr' by skipping schema/preview and publish tasks +3/-1

Speed up 'bit ci pr' by skipping schema/preview and publish tasks

• Updates the 'bit_pr' CircleCI job to pass '--skip-tasks' for ExtractSchema, GeneratePreview, GenerateEnvTemplate, and PublishComponents. Documents why the tasks are safe to skip on throwaway PR lanes and calls out the expected time savings.

.circleci/config.yml

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Unvalidated skip-tasks names 🐞 Bug ☼ Reliability
Description
bit ci pr --skip-tasks accepts any comma-separated string, but the builder pipeline only filters
tasks by string match and does not validate that the requested task names/aspect-ids exist. If a
task name is misspelled or renamed, it will silently run anyway (including PublishComponents,
which performs npm publish).
Code

scopes/git/ci/commands/pr.cmd.ts[R39-43]

+    [
+      '',
+      'skip-tasks <tasks>',
+      `Comma-separated list of build/publish task names (or aspect-ids) to skip during snap, e.g. "ExtractSchema,GeneratePreview,GenerateEnvTemplate,PublishComponents". Speeds up PR builds by trading optional artifacts (schema/preview) and publishing for build time; they are produced on the final export to main`,
+    ],
Evidence
CI now depends on --skip-tasks ... PublishComponents to avoid publishing, but the pipeline skip
implementation only filters and never errors on unknown skip entries, so a typo/rename would still
execute the publish task. The publish task explicitly runs npm publish, making the fail-open
behavior meaningful.

.circleci/config.yml[754-762]
scopes/pipelines/builder/build-pipeline-order.ts[75-95]
scopes/pkg/pkg/publish.task.ts[6-36]
scopes/git/ci/commands/pr.cmd.ts[23-44]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`--skip-tasks` currently fails open: unknown task names are silently ignored, so the tasks still execute. This is risky for CI usage (e.g. skipping `PublishComponents` to avoid `npm publish`) because a typo or a future rename will re-enable the task without any explicit failure.
### Issue Context
- `bit ci pr` exposes `--skip-tasks` and CI now relies on it to skip publish/schema/preview tasks.
- The builder pipeline applies `skipTasks` via filtering but does not check that each requested skip name/aspect-id is present in the pipeline.
### Fix Focus Areas
- scopes/pipelines/builder/build-pipeline-order.ts[46-97]
### Proposed fix
- In `calculatePipelineOrder(...)`, compute `available = new Set([...flattenedPipeline task.name and task.aspectId])`.
- If `skipTasks.length > 0`, compute `unknown = skipTasks.filter(t => !available.has(t))`.
- If `unknown.length > 0`, throw an Error (preferred for CI safety) listing the unknown entries and the available tasks (reuse `getAvailableTaskNames(flattenedPipeline)`), or at minimum `console.warn`/logger warning + continue.
- Add/adjust an e2e/unit test to assert unknown skip tasks fail fast (or warn) to prevent silent regressions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit 08ae96c

Results up to commit 4511d7d


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Unvalidated skip-tasks names 🐞 Bug ☼ Reliability
Description
bit ci pr --skip-tasks accepts any comma-separated string, but the builder pipeline only filters
tasks by string match and does not validate that the requested task names/aspect-ids exist. If a
task name is misspelled or renamed, it will silently run anyway (including PublishComponents,
which performs npm publish).
Code

scopes/git/ci/commands/pr.cmd.ts[R39-43]

+    [
+      '',
+      'skip-tasks <tasks>',
+      `Comma-separated list of build/publish task names (or aspect-ids) to skip during snap, e.g. "ExtractSchema,GeneratePreview,GenerateEnvTemplate,PublishComponents". Speeds up PR builds by trading optional artifacts (schema/preview) and publishing for build time; they are produced on the final export to main`,
+    ],
Evidence
CI now depends on --skip-tasks ... PublishComponents to avoid publishing, but the pipeline skip
implementation only filters and never errors on unknown skip entries, so a typo/rename would still
execute the publish task. The publish task explicitly runs npm publish, making the fail-open
behavior meaningful.

.circleci/config.yml[754-762]
scopes/pipelines/builder/build-pipeline-order.ts[75-95]
scopes/pkg/pkg/publish.task.ts[6-36]
scopes/git/ci/commands/pr.cmd.ts[23-44]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`--skip-tasks` currently fails open: unknown task names are silently ignored, so the tasks still execute. This is risky for CI usage (e.g. skipping `PublishComponents` to avoid `npm publish`) because a typo or a future rename will re-enable the task without any explicit failure.
### Issue Context
- `bit ci pr` exposes `--skip-tasks` and CI now relies on it to skip publish/schema/preview tasks.
- The builder pipeline applies `skipTasks` via filtering but does not check that each requested skip name/aspect-id is present in the pipeline.
### Fix Focus Areas
- scopes/pipelines/builder/build-pipeline-order.ts[46-97]
### Proposed fix
- In `calculatePipelineOrder(...)`, compute `available = new Set([...flattenedPipeline task.name and task.aspectId])`.
- If `skipTasks.length > 0`, compute `unknown = skipTasks.filter(t => !available.has(t))`.
- If `unknown.length > 0`, throw an Error (preferred for CI safety) listing the unknown entries and the available tasks (reuse `getAvailableTaskNames(flattenedPipeline)`), or at minimum `console.warn`/logger warning + continue.
- Add/adjust an e2e/unit test to assert unknown skip tasks fail fast (or warn) to prevent silent regressions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 9e9b50b


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Unvalidated skip-tasks names 🐞 Bug ☼ Reliability
Description
bit ci pr --skip-tasks accepts any comma-separated string, but the builder pipeline only filters
tasks by string match and does not validate that the requested task names/aspect-ids exist. If a
task name is misspelled or renamed, it will silently run anyway (including PublishComponents,
which performs npm publish).
Code

scopes/git/ci/commands/pr.cmd.ts[R39-43]

+    [
+      '',
+      'skip-tasks <tasks>',
+      `Comma-separated list of build/publish task names (or aspect-ids) to skip during snap, e.g. "ExtractSchema,GeneratePreview,GenerateEnvTemplate,PublishComponents". Speeds up PR builds by trading optional artifacts (schema/preview) and publishing for build time; they are produced on the final export to main`,
+    ],
Evidence
CI now depends on --skip-tasks ... PublishComponents to avoid publishing, but the pipeline skip
implementation only filters and never errors on unknown skip entries, so a typo/rename would still
execute the publish task. The publish task explicitly runs npm publish, making the fail-open
behavior meaningful.

.circleci/config.yml[754-762]
scopes/pipelines/builder/build-pipeline-order.ts[75-95]
scopes/pkg/pkg/publish.task.ts[6-36]
scopes/git/ci/commands/pr.cmd.ts[23-44]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`--skip-tasks` currently fails open: unknown task names are silently ignored, so the tasks still execute. This is risky for CI usage (e.g. skipping `PublishComponents` to avoid `npm publish`) because a typo or a future rename will re-enable the task without any explicit failure.

### Issue Context
- `bit ci pr` exposes `--skip-tasks` and CI now relies on it to skip publish/schema/preview tasks.
- The builder pipeline applies `skipTasks` via filtering but does not check that each requested skip name/aspect-id is present in the pipeline.

### Fix Focus Areas
- scopes/pipelines/builder/build-pipeline-order.ts[46-97]

### Proposed fix
- In `calculatePipelineOrder(...)`, compute `available = new Set([...flattenedPipeline task.name and task.aspectId])`.
- If `skipTasks.length > 0`, compute `unknown = skipTasks.filter(t => !available.has(t))`.
- If `unknown.length > 0`, throw an Error (preferred for CI safety) listing the unknown entries and the available tasks (reuse `getAvailableTaskNames(flattenedPipeline)`), or at minimum `console.warn`/logger warning + continue.
- Add/adjust an e2e/unit test to assert unknown skip tasks fail fast (or warn) to prevent silent regressions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit f70e7c7


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review
Qodo Logo

The schema/preview artifacts and npm publish are generally useful (browsable
preview, API schema, installable packages); we're deliberately skipping them
on the PR validation lane to optimize for speed, not because they're never
needed. They're still produced on the final export to main.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 9e9b50b

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4511d7d

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 08ae96c

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.

1 participant