@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
92 lines • 4.8 kB
TypeScript
import { HandlerContext } from "@atomist/automation-client/lib/HandlerContext";
import { Project } from "@atomist/automation-client/lib/project/Project";
import { GoalInvocation } from "../../../api/goal/GoalInvocation";
import { SdmGoalEvent } from "../../../api/goal/SdmGoalEvent";
import { KubernetesApplication } from "../kubernetes/request";
import { KubernetesDeploy, KubernetesDeployRegistration } from "./goal";
/**
* JSON propery under the goal event data where the
* [[KubernetesDeployment]] goal [[KubernetesApplication]] data are
* stored, i.e., the value of `goal.data[sdmPackK8s]`.
*/
export declare const sdmPackK8s = "@atomist/sdm-pack-k8s";
/**
* Generate KubernetesApplication from goal, goal registration,
* project, and goal invocation. The priority of the various sources
* of KubernetesApplication data are, from lowest to highest:
*
* 1. Starting point is `{ ns: defaultNamespace }`
* 2. [[KubernetesDeployDataSources.SdmConfiguration]]
* 3. [[defaultKubernetesApplication]]
* 4. [[KubernetesDeployDataSources.Dockerfile]]
* 5. The various partial Kubernetes specs under `.atomist/kubernetes`
* 6. [[KubernetesDeployDataSources.GoalEvent]]
* 7. [[KubernetesDeployRegistration.applicationData]]
*
* Specific sources can be enabled/disabled via the
* [[KubernetesDeployRegistration.dataSources]].
*
* @param k8Deploy Kubernetes deployment goal
* @param registration Goal registration/configuration for `k8Deploy`
* @param goalInvocation The Kubernetes deployment goal currently triggered.
* @return The SdmGoalEvent augmented with [[KubernetesApplication]] in the data
*/
export declare function generateKubernetesGoalEventData(k8Deploy: KubernetesDeploy, registration: KubernetesDeployRegistration, goalInvocation: GoalInvocation): Promise<SdmGoalEvent>;
/**
* Fetch [[KubernetesApplication]] from goal event. If the goal event
* does not contain Kubernetes application information in its data
* property, `undefined` is returned. If the value of the goal event
* data cannot be parsed as JSON, an error is thrown.
*
* @param goalEvent SDM goal event to retrieve the Kubernetes application data from
* @return Parsed [[KubernetesApplication]] object
*/
export declare function getKubernetesGoalEventData(goalEvent: SdmGoalEvent): KubernetesApplication | undefined;
/**
* Given the goal event, [[KubernetesDeploy]] goal, and
* handler context generate a default [[KubernetesApplication]] object.
*
* This function uses [[defaultImage]] to determine the image.
*
* @param goalEvent SDM Kubernetes deployment goal event
* @param k8Deploy Kubernetes deployment goal configuration
* @param context Handler context
* @return a valid default KubernetesApplication for this SDM goal deployment event
*/
export declare function defaultKubernetesApplication(goalEvent: SdmGoalEvent, k8Deploy: KubernetesDeploy, context: HandlerContext): Promise<Partial<KubernetesApplication>>;
/**
* Parse Dockerfile and return port of first argument to the first
* EXPOSE command. it can suggessfully convert to an integer. If
* there are no EXPOSE commands or if it cannot successfully convert
* the EXPOSE arguments to an integer, `undefined` is returned.
*
* @param p Project to look for Dockerfile in
* @return port number or `undefined` if no EXPOSE commands are found
*/
export declare function dockerPort(p: Project): Promise<number | undefined>;
/**
* Read configured Kubernetes partial specs from repository.
*
* @param p Project to look for specs
* @param registration Configuration of KubernetesDeploy goal
* @return KubernetesApplication object with requested specs populated
*/
export declare function repoSpecsKubernetsApplication(p: Project, r: KubernetesDeployRegistration): Promise<Partial<KubernetesApplication>>;
/**
* Determine the best default value for the image property for this
* Kubernetes deployment goal event. If there is no image associated
* with the after commit of the push, it checks if a Docker registry
* is provided at `sdm.configuration.sdm.docker.registry` and uses
* that and the repo name to return an image. If neither of those
* exist, a Docker Hub-like image name generated from the repository
* owner and name. In the latter two cases, it tries to read a
* version for this commit from the graph. If it exists it uses it at
* the image tag. If it does not, it uses the tag "latest".
*
* @param goalEvent SDM Kubernetes deployment goal event
* @param k8Deploy Kubernetes deployment goal object
* @param context Handler context
* @return Docker image associated with goal push after commit, or best guess
*/
export declare function defaultImage(goalEvent: SdmGoalEvent, k8Deploy: KubernetesDeploy, context: HandlerContext): Promise<string>;
//# sourceMappingURL=data.d.ts.map