Skip to content

Feat: jobs#2

Open
AxiosLeo wants to merge 8 commits intomasterfrom
feat/jobs
Open

Feat: jobs#2
AxiosLeo wants to merge 8 commits intomasterfrom
feat/jobs

Conversation

@AxiosLeo
Copy link
Copy Markdown
Owner

@AxiosLeo AxiosLeo commented Apr 2, 2026

Note

Medium Risk
Introduces a new deployment executor that performs git merges and runs arbitrary configured scripts across multiple job targets; errors or misconfiguration could impact deployment correctness and execute unintended commands.

Overview
Adds multi-job deployment support via a new Deployment class (src/deploy.js) that selects merge requests per job (with include/exclude branch wildcards), merges them into per-target temporary branches, reloads .cd.yml, injects env, and runs pre_deploy/deploy.steps/post_deploy/cleanup scripts.

Refactors the workflow (src/flow.js) to a simpler init + run pipeline that clones/resets the repo once and delegates all merge+deploy work to Deployment, and moves branch-pattern matching utilities into src/utils.js.

Extends TypeScript declarations (index.d.ts) with deployment/job configuration types and adds an example config (examples/.cd.jobs.yml) demonstrating jobs-based deployments.

Written by Cursor Bugbot for commit 37b046b. This will update automatically on new commits. Configure here.

@AxiosLeo
Copy link
Copy Markdown
Owner Author

AxiosLeo commented Apr 2, 2026

@

@AxiosLeo AxiosLeo closed this Apr 2, 2026
@AxiosLeo AxiosLeo reopened this Apr 2, 2026
Comment thread src/deploy.js
Comment thread src/deploy.js Outdated
Comment thread src/flow.js
Comment thread src/deploy.js Outdated
Comment thread index.d.ts Outdated
Comment thread src/deploy.js
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread src/deploy.js
printer.warning('没有找到 .cd.yml 文件,可能已被删除,请检查文件是否存在');
return;
}
deployConfig = await _yaml(ymlConfigFile);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reading YAML overwrites per-job config with top-level config

High Severity

When using multi-job configs, deployConfig = await _yaml(ymlConfigFile) replaces the per-job deployConfig (which contains that job's deploy and scripts) with the entire YAML file contents. For jobs-based configs, the top level has only name, env, and jobs — no scripts or deploy. So deployConfig.scripts and deployConfig.deploy resolve to undefined, and all deployment steps and scripts are silently skipped while reporting success.

Additional Locations (1)
Fix in Cursor Fix in Web

Comment thread index.d.ts
export interface DeployJob {
items: DeployItem[];
deployConfig: DeployConfig;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeployJob type missing target field used at runtime

Medium Severity

The DeployJob interface lacks a target property, but the runtime code in resolveJobs pushes objects with target: job.target, and execJobs destructures target from each job. Any consumer relying on this type definition would not know target exists, leading to incorrect type-checking and missing IDE support for a critical field.

Fix in Cursor Fix in Web

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