@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
40 lines • 2.11 kB
TypeScript
import { HandlerResult } from "@atomist/automation-client/lib/HandlerResult";
import { File as ProjectFile } from "@atomist/automation-client/lib/project/File";
import { GitProject } from "@atomist/automation-client/lib/project/git/GitProject";
import { CommandListenerInvocation } from "../../../api/listener/CommandListener";
import { SoftwareDeliveryMachine } from "../../../api/machine/SoftwareDeliveryMachine";
import { CommandHandlerRegistration } from "../../../api/registration/CommandHandlerRegistration";
export declare const KubernetesSync = "KubernetesSync";
/**
* Command to synchronize the resources in a Kubernetes cluster with
* the resource specs in the configured sync repo. The sync repo will
* be cloned and the resources applied against the Kubernetes API in
* lexical order sorted by file name. If no sync repo is configured
* in the SDM, the command errors. This command is typically executed
* on an interval timer by setting the `intervalMinutes`
* [[KubernetesSyncOptions]].
*
* If the SDM configuration says this packs commands should be added,
* i.e., `sdm.configuration.sdm.k8s.options.addCommands` is `true`,
* the command will have the intent `kube sync SDM_NAME`. Otherwise
* the command will be registered without an intent.
*/
export declare function kubernetesSync(sdm: SoftwareDeliveryMachine): CommandHandlerRegistration;
/**
* Clone the sync repo and apply the specs to the Kubernetes cluster.
*/
export declare function repoSync(cli: CommandListenerInvocation): Promise<HandlerResult>;
/**
* Consume stream of files from project and sort them by their `path`
* property using `localeCompare`. Any file at the root of the
* project, i.e., not in a subdirectory, having the extensions
* ".json", ".yaml", or ".yml` are considered specs.
*
* Essentially, this function converts a FileStream into a Promise of
* sorted ProjectFiles.
*
* @param syncRepo Repository of specs to sort
* @return Sorted array of specs in project
*/
export declare function sortSpecs(syncRepo: GitProject): Promise<ProjectFile[]>;
//# sourceMappingURL=sync.d.ts.map