Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/sync/diff"

Index

Variables

Const k8sSpecGlob

k8sSpecGlob: "*.@(json|yaml|yml)" = "*.@(json|yaml|yml)"

Glob pattern used to identify Kubernetes spec files in a repository. It only matched JSON and YAML files at the root of the repository.

Const k8sSpecRegExp

k8sSpecRegExp: RegExp = /^[^/]+\.(?:json|ya?ml)$/

Regular expression used to identify Kubernetes spec files in a repository. It only matched JSON and YAML files at the root of the repository.

Functions

compareDiff

diffPush

  • diffPush(project: LocalProject, push: PushFields.Fragment, tag: string, log: ProgressLog): Promise<PushDiff[]>
  • 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.

    Parameters

    • project: LocalProject

      project with the changed Kubernetes resource specs.

    • push: PushFields.Fragment

      git push with changes

    • tag: string

      git commit message tag indicating automated commits that should be ignored

    • log: ProgressLog

      goal execution progress log

    Returns Promise<PushDiff[]>

    sorted resource spec changes

parseNameStatusDiff

  • parseNameStatusDiff(sha: string, diff: string): PushDiff[]
  • Convert output of git diff -z --name-status to a list of file changes. The returned changes are sorted by file path.

    Parameters

    • sha: string

      git commit SHA

    • diff: string

      output from git diff command

    Returns PushDiff[]

    sorted resource spec changes

Generated using TypeDoc