UNPKG

@atomist/sdm

Version:

Atomist Software Delivery Machine SDK

55 lines 2.48 kB
import { LocalProject } from "@atomist/automation-client/lib/project/local/LocalProject"; import { SdmGoalEvent } from "../../../api/goal/SdmGoalEvent"; import { ProgressLog } from "../../../spi/log/ProgressLog"; import { ChangeType } from "./change"; /** * Glob pattern used to identify Kubernetes spec files in a * repository. It only matched JSON and YAML files at the root of the * repository. */ export declare const k8sSpecGlob = "*.@(json|yaml|yml)"; /** * Regular expression used to identify Kubernetes spec files in a * repository. It only matched JSON and YAML files at the root of the * repository. */ export declare const k8sSpecRegExp: RegExp; /** Container for changes in a commit. */ export interface PushDiff { /** Whether to apply or delete the change. */ change: ChangeType; /** Path to spec relative to the project base directory. */ path: string; /** Git SHA of change. */ sha: string; } /** * Determine all changed Kubernetes resource spec files in a push. A * file is considered a Kubernetes resource spec if it matches * [[k8sSpecRegExp]]. Changes are returned in commit order, with the * commit order unchanged from the push event sent by cortex, which it * typically chronologically with the oldest commit first. Within a * commit, the changes are sorted first by operation, with deletes * before applies, and then by path using `sort(localCompare)`. * Deletes are sorted first because renames are processed as adds and * deletes and we want to avoid a rename resulting in a resource being * deleted. If you want to control the order of operations, spread * the operations across multiple commits in the same push. * * @param project project with the changed Kubernetes resource specs. * @param push git push with changes * @param tag git commit message tag indicating automated commits that should be ignored * @param log goal execution progress log * @return sorted resource spec changes */ export declare function diffPush(project: LocalProject, push: SdmGoalEvent["push"], tag: string, log: ProgressLog): Promise<PushDiff[]>; /** * Convert output of `git diff -z --name-status` to a list of file * changes. The returned changes are sorted by file path. * * @param sha git commit SHA * @param diff output from git diff command * @return sorted resource spec changes */ export declare function parseNameStatusDiff(sha: string, diff: string): PushDiff[]; //# sourceMappingURL=diff.d.ts.map