1 | import { GitProject, HandlerContext } from "@atomist/automation-client";
|
2 | import { ExecuteGoal, SdmGoalEvent } from "@atomist/sdm";
|
3 | export interface DockerRegistry {
|
4 | /**
|
5 | * Push Url for this registry
|
6 | */
|
7 | url: string;
|
8 | /**
|
9 | * Should this registry be displayed with the goal status after a push? Default true.
|
10 | */
|
11 | display?: boolean;
|
12 | /**
|
13 | * Display Url - ie the url humans can go to
|
14 | * assumes <url>/<image>
|
15 | */
|
16 | displayUrl?: string;
|
17 | /**
|
18 | * If specified, this will replace the label version details (eg <image><:version>)
|
19 | * For example, for Dockerhub the correct value would be `/tags`, with a displayUrl set
|
20 | * to https://hub.docker.com/r/<user/org>; will result in:
|
21 | * https://hub.docker.com/r/<user/org>/<image>/tags as the link URL
|
22 | *
|
23 | */
|
24 | displayBrowsePath?: string;
|
25 | /**
|
26 | * How should urls to this registry be labeled?
|
27 | * ie DockerHub, ECR, etc (friendly name instead of big tag string)
|
28 | * if not supplied, we'll display the tag
|
29 | */
|
30 | label?: string;
|
31 | username?: string;
|
32 | password?: string;
|
33 | }
|
34 | /**
|
35 | * Options to configure the Docker image build
|
36 | */
|
37 | export interface DockerOptions {
|
38 | /**
|
39 | * Provide the image tag for the docker image to build
|
40 | */
|
41 | dockerImageNameCreator?: DockerImageNameCreator;
|
42 | /**
|
43 | * True if the docker image should be pushed to the registry
|
44 | */
|
45 | push?: boolean;
|
46 | /**
|
47 | * Optional Docker config in json as alternative to running
|
48 | * 'docker login' with provided registry, user and password.
|
49 | */
|
50 | config?: string;
|
51 | /**
|
52 | * Optional registries to push the docker image too.
|
53 | * Needs to set when push === true
|
54 | */
|
55 | registries?: DockerRegistry[];
|
56 | /**
|
57 | * Find the Dockerfile within the project
|
58 | * @param p the project
|
59 | */
|
60 | dockerfileFinder?: (p: GitProject) => Promise<string>;
|
61 | /**
|
62 | * Optionally specify what docker image builder to use.
|
63 | * Defaults to "docker"
|
64 | */
|
65 | builder?: "docker" | "kaniko";
|
66 | /**
|
67 | * Optional arguments passed to the docker image builder
|
68 | */
|
69 | builderArgs?: string[];
|
70 | }
|
71 | export declare type DockerImageNameCreator = (p: GitProject, sdmGoal: SdmGoalEvent, options: DockerOptions, ctx: HandlerContext) => Promise<{
|
72 | name: string;
|
73 | tags: string[];
|
74 | }>;
|
75 | /**
|
76 | * Execute a Docker build for the project
|
77 | * @param {DockerOptions} options
|
78 | * @returns {ExecuteGoal}
|
79 | */
|
80 | export declare function executeDockerBuild(options: DockerOptions): ExecuteGoal;
|
81 | export declare const DefaultDockerImageNameCreator: DockerImageNameCreator;
|