heroku 8.1.9 → 8.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete-scripts/README.md +7 -0
- package/autocomplete-scripts/bash/heroku.bash +59 -0
- package/autocomplete-scripts/brew/bash +4 -0
- package/autocomplete-scripts/brew/zsh/_heroku +59 -0
- package/autocomplete-scripts/zsh/_heroku +53 -0
- package/bin/bats-test-runner.js +7 -0
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +36 -1
- package/lib/analytics.d.ts +2 -2
- package/lib/analytics.js +3 -4
- package/lib/commands/auth/2fa/disable.d.ts +7 -0
- package/lib/commands/auth/2fa/disable.js +16 -0
- package/lib/commands/auth/2fa/index.d.ts +6 -0
- package/lib/commands/auth/2fa/index.js +18 -0
- package/lib/commands/auth/login.d.ts +8 -0
- package/lib/commands/auth/login.js +25 -0
- package/lib/commands/auth/logout.d.ts +6 -0
- package/lib/commands/auth/logout.js +14 -0
- package/lib/commands/auth/token.d.ts +7 -0
- package/lib/commands/auth/token.js +31 -0
- package/lib/commands/auth/whoami.d.ts +7 -0
- package/lib/commands/auth/whoami.js +26 -0
- package/lib/commands/authorizations/create.d.ts +13 -0
- package/lib/commands/authorizations/create.js +41 -0
- package/lib/commands/authorizations/index.d.ts +9 -0
- package/lib/commands/authorizations/index.js +35 -0
- package/lib/commands/authorizations/info.d.ts +11 -0
- package/lib/commands/authorizations/info.js +25 -0
- package/lib/commands/authorizations/revoke.d.ts +10 -0
- package/lib/commands/authorizations/revoke.js +22 -0
- package/lib/commands/authorizations/rotate.d.ts +8 -0
- package/lib/commands/authorizations/rotate.js +19 -0
- package/lib/commands/authorizations/update.d.ts +13 -0
- package/lib/commands/authorizations/update.js +36 -0
- package/lib/commands/autocomplete/create.d.ts +29 -0
- package/lib/commands/autocomplete/create.js +213 -0
- package/lib/commands/autocomplete/doctor.d.ts +12 -0
- package/lib/commands/autocomplete/doctor.js +97 -0
- package/lib/commands/autocomplete/index.d.ts +12 -0
- package/lib/commands/autocomplete/index.js +67 -0
- package/lib/commands/autocomplete/options.d.ts +25 -0
- package/lib/commands/autocomplete/options.js +210 -0
- package/lib/commands/autocomplete/script.d.ts +10 -0
- package/lib/commands/autocomplete/script.js +23 -0
- package/lib/commands/buildpacks/add.d.ts +13 -0
- package/lib/commands/buildpacks/add.js +43 -0
- package/lib/commands/buildpacks/clear.d.ts +9 -0
- package/lib/commands/buildpacks/clear.js +17 -0
- package/lib/commands/buildpacks/index.d.ts +9 -0
- package/lib/commands/buildpacks/index.js +25 -0
- package/lib/commands/buildpacks/info.d.ts +8 -0
- package/lib/commands/buildpacks/info.js +41 -0
- package/lib/commands/buildpacks/remove.d.ts +13 -0
- package/lib/commands/buildpacks/remove.js +55 -0
- package/lib/commands/buildpacks/search.d.ts +13 -0
- package/lib/commands/buildpacks/search.js +69 -0
- package/lib/commands/buildpacks/set.d.ts +13 -0
- package/lib/commands/buildpacks/set.js +42 -0
- package/lib/commands/buildpacks/versions.d.ts +8 -0
- package/lib/commands/buildpacks/versions.js +56 -0
- package/lib/commands/certs/auto/wait.d.ts +9 -0
- package/lib/commands/certs/auto/wait.js +14 -0
- package/lib/commands/ci/index.d.ts +12 -0
- package/lib/commands/ci/index.js +25 -0
- package/lib/commands/ci/info.d.ts +14 -0
- package/lib/commands/ci/info.js +29 -0
- package/lib/commands/ci/last.d.ts +11 -0
- package/lib/commands/ci/last.js +31 -0
- package/lib/commands/ci/rerun.d.ts +13 -0
- package/lib/commands/ci/rerun.js +53 -0
- package/lib/commands/ci/run.d.ts +10 -0
- package/lib/commands/ci/run.js +42 -0
- package/lib/commands/clients/create.d.ts +14 -0
- package/lib/commands/clients/create.js +37 -0
- package/lib/commands/clients/destroy.d.ts +8 -0
- package/lib/commands/clients/destroy.js +18 -0
- package/lib/commands/clients/index.d.ts +8 -0
- package/lib/commands/clients/index.js +32 -0
- package/lib/commands/clients/info.d.ts +13 -0
- package/lib/commands/clients/info.js +33 -0
- package/lib/commands/clients/rotate.d.ts +12 -0
- package/lib/commands/clients/rotate.js +33 -0
- package/lib/commands/clients/update.d.ts +13 -0
- package/lib/commands/clients/update.js +38 -0
- package/lib/commands/config/edit.d.ts +23 -0
- package/lib/commands/config/edit.js +132 -0
- package/lib/commands/config/get.d.ts +16 -0
- package/lib/commands/config/get.js +35 -0
- package/lib/commands/config/index.d.ts +11 -0
- package/lib/commands/config/index.js +33 -0
- package/lib/commands/config/unset.d.ts +12 -0
- package/lib/commands/config/unset.js +51 -0
- package/lib/commands/console.d.ts +11 -0
- package/lib/commands/console.js +30 -0
- package/lib/commands/domains/add.d.ts +19 -0
- package/lib/commands/domains/add.js +117 -0
- package/lib/commands/domains/clear.d.ts +11 -0
- package/lib/commands/domains/clear.js +26 -0
- package/lib/commands/domains/index.d.ts +40 -0
- package/lib/commands/domains/index.js +79 -0
- package/lib/commands/domains/info.d.ts +14 -0
- package/lib/commands/domains/info.js +25 -0
- package/lib/commands/domains/remove.d.ts +14 -0
- package/lib/commands/domains/remove.js +26 -0
- package/lib/commands/domains/update.d.ts +15 -0
- package/lib/commands/domains/update.js +40 -0
- package/lib/commands/domains/wait.d.ts +13 -0
- package/lib/commands/domains/wait.js +32 -0
- package/lib/commands/git/clone.d.ts +13 -0
- package/lib/commands/git/clone.js +29 -0
- package/lib/commands/git/credentials.d.ts +9 -0
- package/lib/commands/git/credentials.js +32 -0
- package/lib/commands/git/remote.d.ts +11 -0
- package/lib/commands/git/remote.js +44 -0
- package/lib/commands/labs/disable.d.ts +11 -0
- package/lib/commands/labs/disable.js +65 -0
- package/lib/commands/local/index.d.ts +17 -0
- package/lib/commands/local/index.js +75 -0
- package/lib/commands/local/run.d.ts +11 -0
- package/lib/commands/local/run.js +38 -0
- package/lib/commands/local/version.d.ts +5 -0
- package/lib/commands/local/version.js +13 -0
- package/lib/commands/logs.d.ts +16 -0
- package/lib/commands/logs.js +45 -0
- package/lib/commands/pipelines/add.d.ts +14 -0
- package/lib/commands/pipelines/add.js +61 -0
- package/lib/commands/pipelines/connect.d.ts +12 -0
- package/lib/commands/pipelines/connect.js +52 -0
- package/lib/commands/pipelines/create.d.ts +15 -0
- package/lib/commands/pipelines/create.js +91 -0
- package/lib/commands/pipelines/destroy.d.ts +9 -0
- package/lib/commands/pipelines/destroy.js +27 -0
- package/lib/commands/pipelines/diff.d.ts +19 -0
- package/lib/commands/pipelines/diff.js +152 -0
- package/lib/commands/pipelines/index.d.ts +9 -0
- package/lib/commands/pipelines/index.js +27 -0
- package/lib/commands/pipelines/info.d.ts +13 -0
- package/lib/commands/pipelines/info.js +43 -0
- package/lib/commands/pipelines/open.d.ts +9 -0
- package/lib/commands/pipelines/open.js +19 -0
- package/lib/commands/pipelines/promote.d.ts +12 -0
- package/lib/commands/pipelines/promote.js +216 -0
- package/lib/commands/pipelines/remove.d.ts +10 -0
- package/lib/commands/pipelines/remove.js +23 -0
- package/lib/commands/pipelines/rename.d.ts +10 -0
- package/lib/commands/pipelines/rename.js +33 -0
- package/lib/commands/pipelines/setup.d.ts +14 -0
- package/lib/commands/pipelines/setup.js +91 -0
- package/lib/commands/pipelines/transfer.d.ts +13 -0
- package/lib/commands/pipelines/transfer.js +65 -0
- package/lib/commands/pipelines/update.d.ts +11 -0
- package/lib/commands/pipelines/update.js +32 -0
- package/lib/commands/ps/autoscale/disable.d.ts +9 -0
- package/lib/commands/ps/autoscale/disable.js +35 -0
- package/lib/commands/ps/autoscale/enable.d.ts +13 -0
- package/lib/commands/ps/autoscale/enable.js +65 -0
- package/lib/commands/ps/wait.d.ts +12 -0
- package/lib/commands/ps/wait.js +78 -0
- package/lib/commands/rake.d.ts +14 -0
- package/lib/commands/rake.js +46 -0
- package/lib/commands/regions.d.ts +11 -0
- package/lib/commands/regions.js +45 -0
- package/lib/commands/reviewapps/disable.d.ts +17 -0
- package/lib/commands/reviewapps/disable.js +102 -0
- package/lib/commands/reviewapps/enable.d.ts +14 -0
- package/lib/commands/reviewapps/enable.js +89 -0
- package/lib/commands/run/detached.d.ts +15 -0
- package/lib/commands/run/detached.js +56 -0
- package/lib/commands/run/index.d.ts +18 -0
- package/lib/commands/run/index.js +64 -0
- package/lib/commands/run/inside.d.ts +15 -0
- package/lib/commands/run/inside.js +55 -0
- package/lib/commands/sessions/destroy.d.ts +8 -0
- package/lib/commands/sessions/destroy.js +18 -0
- package/lib/commands/sessions/index.d.ts +8 -0
- package/lib/commands/sessions/index.js +31 -0
- package/lib/commands/status.d.ts +8 -0
- package/lib/commands/status.js +46 -0
- package/lib/commands/webhooks/add.d.ts +16 -0
- package/lib/commands/webhooks/add.js +47 -0
- package/lib/commands/webhooks/deliveries/index.d.ts +12 -0
- package/lib/commands/webhooks/deliveries/index.js +80 -0
- package/lib/commands/webhooks/deliveries/info.d.ts +14 -0
- package/lib/commands/webhooks/deliveries/info.js +42 -0
- package/lib/commands/webhooks/events/index.d.ts +11 -0
- package/lib/commands/webhooks/events/index.js +46 -0
- package/lib/commands/webhooks/events/info.d.ts +14 -0
- package/lib/commands/webhooks/events/info.js +31 -0
- package/lib/commands/webhooks/index.d.ts +11 -0
- package/lib/commands/webhooks/index.js +45 -0
- package/lib/commands/webhooks/info.d.ts +14 -0
- package/lib/commands/webhooks/info.js +31 -0
- package/lib/commands/webhooks/remove.d.ts +14 -0
- package/lib/commands/webhooks/remove.js +29 -0
- package/lib/commands/webhooks/update.d.ts +19 -0
- package/lib/commands/webhooks/update.js +41 -0
- package/lib/file.js +2 -3
- package/lib/global_telemetry.d.ts +53 -0
- package/lib/global_telemetry.js +82 -0
- package/lib/hooks/command_not_found/performance_analytics.d.ts +3 -0
- package/lib/hooks/command_not_found/performance_analytics.js +7 -0
- package/lib/hooks/init/terms-of-service.js +3 -4
- package/lib/hooks/init/version.d.ts +2 -1
- package/lib/hooks/init/version.js +1 -2
- package/lib/hooks/postrun/performance_analytics.d.ts +3 -0
- package/lib/hooks/postrun/performance_analytics.js +11 -0
- package/lib/hooks/prerun/analytics.d.ts +2 -1
- package/lib/hooks/prerun/analytics.js +4 -4
- package/lib/hooks/recache.d.ts +3 -0
- package/lib/hooks/recache.js +56 -0
- package/lib/hooks/update/brew.d.ts +2 -1
- package/lib/hooks/update/brew.js +3 -5
- package/lib/hooks/update/completions.d.ts +2 -1
- package/lib/hooks/update/completions.js +2 -3
- package/lib/hooks/update/plugin-migrate.d.ts +2 -1
- package/lib/hooks/update/plugin-migrate.js +3 -5
- package/lib/hooks/update/tidy.d.ts +2 -1
- package/lib/hooks/update/tidy.js +3 -5
- package/lib/lib/authorizations/authorizations.d.ts +2 -0
- package/lib/lib/authorizations/authorizations.js +39 -0
- package/lib/lib/autocomplete/base.d.ts +11 -0
- package/lib/lib/autocomplete/base.js +44 -0
- package/lib/lib/autocomplete/cache.d.ts +2 -0
- package/lib/lib/autocomplete/cache.js +28 -0
- package/lib/lib/autocomplete/completions.d.ts +37 -0
- package/lib/lib/autocomplete/completions.js +261 -0
- package/lib/lib/buildpacks/buildpacks.d.ts +32 -0
- package/lib/lib/buildpacks/buildpacks.js +161 -0
- package/lib/lib/buildpacks/push.d.ts +0 -0
- package/lib/lib/buildpacks/push.js +4 -0
- package/lib/lib/ci/git.d.ts +8 -0
- package/lib/lib/ci/git.js +71 -0
- package/lib/lib/ci/interfaces/kolkrabbi.d.ts +311 -0
- package/lib/lib/ci/interfaces/kolkrabbi.js +7 -0
- package/lib/lib/ci/pipelines.d.ts +3 -0
- package/lib/lib/ci/pipelines.js +57 -0
- package/lib/lib/ci/source.d.ts +2 -0
- package/lib/lib/ci/source.js +42 -0
- package/lib/lib/ci/test-run.d.ts +5 -0
- package/lib/lib/ci/test-run.js +232 -0
- package/lib/lib/clients/clients.d.ts +1 -0
- package/lib/lib/clients/clients.js +25 -0
- package/lib/lib/config/quote.d.ts +2 -0
- package/lib/lib/config/quote.js +33 -0
- package/lib/lib/config/util.d.ts +3 -0
- package/lib/lib/config/util.js +12 -0
- package/lib/lib/domains/wait-for-domain.d.ts +3 -0
- package/lib/lib/domains/wait-for-domain.js +19 -0
- package/lib/lib/git/git.d.ts +8 -0
- package/lib/lib/git/git.js +56 -0
- package/lib/lib/local/fork-foreman.d.ts +1 -0
- package/lib/lib/local/fork-foreman.js +33 -0
- package/lib/lib/local/load-foreman-procfile.d.ts +0 -0
- package/lib/lib/local/load-foreman-procfile.js +2 -0
- package/lib/lib/local/run-foreman.d.ts +0 -0
- package/lib/lib/local/run-foreman.js +2 -0
- package/lib/lib/pipelines/api.d.ts +25 -0
- package/lib/lib/pipelines/api.js +130 -0
- package/lib/lib/pipelines/disambiguate.d.ts +3 -0
- package/lib/lib/pipelines/disambiguate.js +49 -0
- package/lib/lib/pipelines/github-api.d.ts +8 -0
- package/lib/lib/pipelines/github-api.js +18 -0
- package/lib/lib/pipelines/infer.d.ts +1 -0
- package/lib/lib/pipelines/infer.js +11 -0
- package/lib/lib/pipelines/key-by.d.ts +1 -0
- package/lib/lib/pipelines/key-by.js +11 -0
- package/lib/lib/pipelines/kolkrabbi-api.d.ts +14 -0
- package/lib/lib/pipelines/kolkrabbi-api.js +62 -0
- package/lib/lib/pipelines/ownership.d.ts +4 -0
- package/lib/lib/pipelines/ownership.js +40 -0
- package/lib/lib/pipelines/render-pipeline.d.ts +6 -0
- package/lib/lib/pipelines/render-pipeline.js +52 -0
- package/lib/lib/pipelines/setup/create-apps.d.ts +1 -0
- package/lib/lib/pipelines/setup/create-apps.js +44 -0
- package/lib/lib/pipelines/setup/get-ci-settings.d.ts +4 -0
- package/lib/lib/pipelines/setup/get-ci-settings.js +19 -0
- package/lib/lib/pipelines/setup/get-github-token.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-github-token.js +10 -0
- package/lib/lib/pipelines/setup/get-name-and-repo.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-name-and-repo.js +47 -0
- package/lib/lib/pipelines/setup/get-repo.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-repo.js +8 -0
- package/lib/lib/pipelines/setup/get-settings.d.ts +9 -0
- package/lib/lib/pipelines/setup/get-settings.js +39 -0
- package/lib/lib/pipelines/setup/poll-app-setups.d.ts +1 -0
- package/lib/lib/pipelines/setup/poll-app-setups.js +25 -0
- package/lib/lib/pipelines/setup/setup-pipeline.d.ts +1 -0
- package/lib/lib/pipelines/setup/setup-pipeline.js +15 -0
- package/lib/lib/pipelines/setup/validate.d.ts +9 -0
- package/lib/lib/pipelines/setup/validate.js +31 -0
- package/lib/lib/pipelines/stages.d.ts +7 -0
- package/lib/lib/pipelines/stages.js +22 -0
- package/lib/lib/run/colorize.d.ts +2 -0
- package/lib/lib/run/colorize.js +300 -0
- package/lib/lib/run/dyno.d.ts +72 -0
- package/lib/lib/run/dyno.js +397 -0
- package/lib/lib/run/helpers.d.ts +2 -0
- package/lib/lib/run/helpers.js +34 -0
- package/lib/lib/run/line-transform.d.ts +4 -0
- package/lib/lib/run/line-transform.js +26 -0
- package/lib/lib/run/log-displayer.d.ts +10 -0
- package/lib/lib/run/log-displayer.js +79 -0
- package/lib/lib/sessions/sessions.d.ts +7 -0
- package/lib/lib/sessions/sessions.js +2 -0
- package/lib/lib/status/util.d.ts +1 -0
- package/lib/lib/status/util.js +14 -0
- package/lib/lib/webhooks/base.d.ts +13 -0
- package/lib/lib/webhooks/base.js +28 -0
- package/lib/user-config.js +2 -3
- package/oclif.manifest.json +3376 -2
- package/package.json +79 -42
- package/lib/hooks/update/b.d.ts +0 -2
- package/lib/hooks/update/b.js +0 -48
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Kolkrabbi API.
|
|
8
|
+
*/
|
|
9
|
+
export interface KolkrabbiApi {
|
|
10
|
+
'account-link'?: KolkrabbiApiAccountLink;
|
|
11
|
+
'app-json-schema'?: AppJsonSchema;
|
|
12
|
+
'app-json'?: KolkrabbiApiAppJson;
|
|
13
|
+
apps?: KolkrabbiApiApps;
|
|
14
|
+
organization?: HerokuPlatformApiOrganization;
|
|
15
|
+
'pipeline-repository'?: KolkrabbiApiPipelineRepositories;
|
|
16
|
+
pipeline?: HerokuPlatformApiPipeline;
|
|
17
|
+
'pull-requests'?: KolkrabbiApiPullRequests;
|
|
18
|
+
repository?: KolkrabbiApiRepositories;
|
|
19
|
+
[k: string]: any;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An account link represents the relationship between a Heroku user and a GitHub user.
|
|
23
|
+
*/
|
|
24
|
+
export interface KolkrabbiApiAccountLink {
|
|
25
|
+
/**
|
|
26
|
+
* unique identifier of an account link
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Heroku details for the account link
|
|
31
|
+
*/
|
|
32
|
+
heroku?: {
|
|
33
|
+
/**
|
|
34
|
+
* unique identifier of the Heroku user
|
|
35
|
+
*/
|
|
36
|
+
user_id?: string;
|
|
37
|
+
[k: string]: any;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* GitHub details for the account link
|
|
41
|
+
*/
|
|
42
|
+
github?: {
|
|
43
|
+
/**
|
|
44
|
+
* unique identifier of the GitHub user
|
|
45
|
+
*/
|
|
46
|
+
user_id?: number;
|
|
47
|
+
[k: string]: any;
|
|
48
|
+
};
|
|
49
|
+
[k: string]: any;
|
|
50
|
+
}
|
|
51
|
+
export interface AppJsonSchema {
|
|
52
|
+
/**
|
|
53
|
+
* A clean and simple name to identify the template (30 characters max).
|
|
54
|
+
*/
|
|
55
|
+
name?: string;
|
|
56
|
+
/**
|
|
57
|
+
* A brief summary of the app: what it does, who it's for, why it exists, etc.
|
|
58
|
+
*/
|
|
59
|
+
description?: string;
|
|
60
|
+
/**
|
|
61
|
+
* An array of strings describing the app.
|
|
62
|
+
*/
|
|
63
|
+
keywords?: any[];
|
|
64
|
+
/**
|
|
65
|
+
* The project's website.
|
|
66
|
+
*/
|
|
67
|
+
website?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The location of the application's source code, such as a Git URL, GitHub URL, Subversion URL, or Mercurial URL.
|
|
70
|
+
*/
|
|
71
|
+
repository?: string;
|
|
72
|
+
/**
|
|
73
|
+
* The URL of the application's logo image. Dimensions should be square. Format can be SVG, PNG, or JPG.
|
|
74
|
+
*/
|
|
75
|
+
logo?: string;
|
|
76
|
+
/**
|
|
77
|
+
* A URL specifying where to redirect the user once their new app is deployed. If value is a fully-qualified URL, the user should be redirected to that URL. If value begins with a slash `/`, the user should be redirected to that path in their newly deployed app.
|
|
78
|
+
*/
|
|
79
|
+
success_url?: string;
|
|
80
|
+
/**
|
|
81
|
+
* A key-value object specifying scripts or shell commands to execute at different stages in the build/release process. Currently, `postdeploy` is the only supported script.
|
|
82
|
+
*/
|
|
83
|
+
scripts?: {
|
|
84
|
+
[k: string]: any;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* A key-value object for environment variables, or [config vars](https://devcenter.heroku.com/articles/config-vars) in Heroku parlance. Keys are the names of the environment variables. Values can be strings or objects. If the value is a string, it will be used. If the value is an object, it defines specific requirements for that variable:
|
|
88
|
+
*
|
|
89
|
+
* - `description`: a human-friendly blurb about what the value is for and how to determine what it should be
|
|
90
|
+
* - `value`: a default value to use. This should always be a string.
|
|
91
|
+
* - `required`: A boolean indicating whether the given value is required for the app to function (default: `true`).
|
|
92
|
+
* - `generator`: a string representing a function to call to generate the value. Currently the only supported generator is `secret`, which generates a pseudo-random string of characters.
|
|
93
|
+
*/
|
|
94
|
+
env?: {
|
|
95
|
+
[k: string]: any;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* An array of strings specifying Heroku addons to provision on the app before deploying. Each addon should be in the format `addon:plan` or `addon`. If plan is omitted, that addon's default plan will be provisioned.
|
|
99
|
+
*/
|
|
100
|
+
addons?: any[];
|
|
101
|
+
/**
|
|
102
|
+
* An ordered array of objects specifying the buildpacks to be applied to this app
|
|
103
|
+
*/
|
|
104
|
+
buildpacks?: any[];
|
|
105
|
+
/**
|
|
106
|
+
* Dynos to scale on the app before deploying.
|
|
107
|
+
*/
|
|
108
|
+
formation?: {
|
|
109
|
+
[k: string]: any;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export interface KolkrabbiApiAppJson {
|
|
113
|
+
app_json?: AppJsonSchema;
|
|
114
|
+
/**
|
|
115
|
+
* name of branch to commit to
|
|
116
|
+
*/
|
|
117
|
+
branch?: string | null;
|
|
118
|
+
[k: string]: any;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* FIXME
|
|
122
|
+
*/
|
|
123
|
+
export interface KolkrabbiApiApps {
|
|
124
|
+
/**
|
|
125
|
+
* unique identifier of app
|
|
126
|
+
*/
|
|
127
|
+
app_id?: string;
|
|
128
|
+
/**
|
|
129
|
+
* when app was created
|
|
130
|
+
*/
|
|
131
|
+
created_at?: string;
|
|
132
|
+
/**
|
|
133
|
+
* unique identifier of app
|
|
134
|
+
*/
|
|
135
|
+
id?: string;
|
|
136
|
+
/**
|
|
137
|
+
* when app was updated
|
|
138
|
+
*/
|
|
139
|
+
updated_at?: string | null;
|
|
140
|
+
[k: string]: any;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Deprecated: Organizations allow you to manage access to a shared group of applications across your development team.
|
|
144
|
+
*/
|
|
145
|
+
export interface HerokuPlatformApiOrganization {
|
|
146
|
+
/**
|
|
147
|
+
* unique identifier of organization
|
|
148
|
+
*/
|
|
149
|
+
id?: string;
|
|
150
|
+
/**
|
|
151
|
+
* when the organization was created
|
|
152
|
+
*/
|
|
153
|
+
created_at?: string;
|
|
154
|
+
/**
|
|
155
|
+
* whether charges incurred by the org are paid by credit card.
|
|
156
|
+
*/
|
|
157
|
+
credit_card_collections?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* whether to use this organization when none is specified
|
|
160
|
+
*/
|
|
161
|
+
default?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* upper limit of members allowed in an organization.
|
|
164
|
+
*/
|
|
165
|
+
membership_limit?: number | null;
|
|
166
|
+
/**
|
|
167
|
+
* unique name of organization
|
|
168
|
+
*/
|
|
169
|
+
name?: string;
|
|
170
|
+
/**
|
|
171
|
+
* whether the org is provisioned licenses by salesforce.
|
|
172
|
+
*/
|
|
173
|
+
provisioned_licenses?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* role in the organization
|
|
176
|
+
*/
|
|
177
|
+
role?: 'admin' | 'collaborator' | 'member' | 'owner' | null;
|
|
178
|
+
/**
|
|
179
|
+
* type of organization.
|
|
180
|
+
*/
|
|
181
|
+
type?: 'enterprise' | 'team';
|
|
182
|
+
/**
|
|
183
|
+
* when the organization was updated
|
|
184
|
+
*/
|
|
185
|
+
updated_at?: string;
|
|
186
|
+
[k: string]: any;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Pipeline repositories link a pipeline to a Github repository.
|
|
190
|
+
*/
|
|
191
|
+
export interface KolkrabbiApiPipelineRepositories {
|
|
192
|
+
/**
|
|
193
|
+
* whether automatic review apps is enabled
|
|
194
|
+
*/
|
|
195
|
+
automatic_review_apps?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* whether CI is enabled
|
|
198
|
+
*/
|
|
199
|
+
ci?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* unique identifier of a pipeline repository
|
|
202
|
+
*/
|
|
203
|
+
id?: string;
|
|
204
|
+
creator?: KolkrabbiApiAccountLink;
|
|
205
|
+
/**
|
|
206
|
+
* when the pipeline repository was created
|
|
207
|
+
*/
|
|
208
|
+
created_at?: string;
|
|
209
|
+
/**
|
|
210
|
+
* organization tied to this pipeline repository
|
|
211
|
+
*/
|
|
212
|
+
organization?: {
|
|
213
|
+
[k: string]: any;
|
|
214
|
+
} | null;
|
|
215
|
+
owner?: KolkrabbiApiAccountLink;
|
|
216
|
+
pipeline?: HerokuPlatformApiPipeline;
|
|
217
|
+
repository?: KolkrabbiApiRepositories;
|
|
218
|
+
/**
|
|
219
|
+
* whether review apps is enabled
|
|
220
|
+
*/
|
|
221
|
+
review_apps?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* a collection of statuses
|
|
224
|
+
*/
|
|
225
|
+
statuses?: any[];
|
|
226
|
+
/**
|
|
227
|
+
* when pipeline repository was updated
|
|
228
|
+
*/
|
|
229
|
+
updated_at?: string | null;
|
|
230
|
+
[k: string]: any;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A pipeline allows grouping of apps into different stages.
|
|
234
|
+
*/
|
|
235
|
+
export interface HerokuPlatformApiPipeline {
|
|
236
|
+
/**
|
|
237
|
+
* unique identifier of pipeline
|
|
238
|
+
*/
|
|
239
|
+
id?: string;
|
|
240
|
+
[k: string]: any;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* A Repository is a reference to a remote DVCs codebase
|
|
244
|
+
*/
|
|
245
|
+
export interface KolkrabbiApiRepositories {
|
|
246
|
+
/**
|
|
247
|
+
* The id that the remote DVCS uses for the repository
|
|
248
|
+
*/
|
|
249
|
+
id?: number;
|
|
250
|
+
/**
|
|
251
|
+
* The name for the remote DVCS uses for the repository
|
|
252
|
+
*/
|
|
253
|
+
name?: string;
|
|
254
|
+
/**
|
|
255
|
+
* The type of DVCS
|
|
256
|
+
*/
|
|
257
|
+
type?: string;
|
|
258
|
+
/**
|
|
259
|
+
* when the repository reference was created
|
|
260
|
+
*/
|
|
261
|
+
created_at?: string;
|
|
262
|
+
/**
|
|
263
|
+
* when repository was updated
|
|
264
|
+
*/
|
|
265
|
+
updated_at?: string | null;
|
|
266
|
+
[k: string]: any;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* FIXME
|
|
270
|
+
*/
|
|
271
|
+
export interface KolkrabbiApiPullRequests {
|
|
272
|
+
app_setup?: {
|
|
273
|
+
/**
|
|
274
|
+
* unique identifier of app setup
|
|
275
|
+
*/
|
|
276
|
+
id?: string;
|
|
277
|
+
/**
|
|
278
|
+
* the overall status of app setup
|
|
279
|
+
*/
|
|
280
|
+
status?: 'failed' | 'pending' | 'succeeded';
|
|
281
|
+
[k: string]: any;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* when app was created
|
|
285
|
+
*/
|
|
286
|
+
created_at?: string;
|
|
287
|
+
pull_request?: {
|
|
288
|
+
/**
|
|
289
|
+
* unique identifier of pull request
|
|
290
|
+
*/
|
|
291
|
+
id?: number;
|
|
292
|
+
/**
|
|
293
|
+
* pull request number
|
|
294
|
+
*/
|
|
295
|
+
number?: number;
|
|
296
|
+
/**
|
|
297
|
+
* unique name of app
|
|
298
|
+
*/
|
|
299
|
+
ref?: string;
|
|
300
|
+
/**
|
|
301
|
+
* pull request title
|
|
302
|
+
*/
|
|
303
|
+
title?: string;
|
|
304
|
+
[k: string]: any;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* when app was updated
|
|
308
|
+
*/
|
|
309
|
+
updated_at?: string | null;
|
|
310
|
+
[k: string]: any;
|
|
311
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPipeline = exports.disambiguatePipeline = void 0;
|
|
4
|
+
const inquirer_1 = require("inquirer");
|
|
5
|
+
const validator_1 = require("validator");
|
|
6
|
+
async function disambiguatePipeline(pipelineIDOrName, command) {
|
|
7
|
+
const headers = { Accept: 'application/vnd.heroku+json; version=3.pipelines' };
|
|
8
|
+
if ((0, validator_1.isUUID)(pipelineIDOrName)) {
|
|
9
|
+
const { body: pipeline } = await command.heroku.get(`/pipelines/${pipelineIDOrName}`, { headers });
|
|
10
|
+
return pipeline;
|
|
11
|
+
}
|
|
12
|
+
const { body: pipelines } = await command.heroku.get(`/pipelines?eq[name]=${pipelineIDOrName}`, { headers });
|
|
13
|
+
let choices;
|
|
14
|
+
let questions;
|
|
15
|
+
switch (pipelines.length) {
|
|
16
|
+
case 0:
|
|
17
|
+
command.error('Pipeline not found');
|
|
18
|
+
break;
|
|
19
|
+
case 1:
|
|
20
|
+
return pipelines[0];
|
|
21
|
+
default:
|
|
22
|
+
choices = pipelines.map(function (x) {
|
|
23
|
+
return { name: new Date(x.created_at), value: x };
|
|
24
|
+
});
|
|
25
|
+
questions = [{
|
|
26
|
+
type: 'list',
|
|
27
|
+
name: 'pipeline',
|
|
28
|
+
message: `Which ${pipelineIDOrName} pipeline?`,
|
|
29
|
+
choices,
|
|
30
|
+
}];
|
|
31
|
+
return (0, inquirer_1.prompt)(questions);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.disambiguatePipeline = disambiguatePipeline;
|
|
35
|
+
async function getPipeline(flags, command) {
|
|
36
|
+
let pipeline;
|
|
37
|
+
if ((!flags.pipeline) && (!flags.app)) {
|
|
38
|
+
command.error('Required flag: --pipeline PIPELINE or --app APP');
|
|
39
|
+
}
|
|
40
|
+
if (flags && flags.pipeline) {
|
|
41
|
+
pipeline = await disambiguatePipeline(flags.pipeline, command);
|
|
42
|
+
if (pipeline.pipeline) {
|
|
43
|
+
pipeline = pipeline.pipeline;
|
|
44
|
+
} // in case prompt returns an object like { pipeline: { ... } }
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const { body: coupling } = await command.heroku.get(`/apps/${flags.app}/pipeline-couplings`);
|
|
48
|
+
if ((coupling) && (coupling.pipeline)) {
|
|
49
|
+
pipeline = coupling.pipeline;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
command.error(`No pipeline found with application ${flags.app}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return pipeline;
|
|
56
|
+
}
|
|
57
|
+
exports.getPipeline = getPipeline;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSourceBlob = void 0;
|
|
4
|
+
const fs = require("async-file");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const git = require("./git");
|
|
7
|
+
const got = require('got');
|
|
8
|
+
async function uploadArchive(url, filePath) {
|
|
9
|
+
const request = got.stream.put(url, {
|
|
10
|
+
headers: {
|
|
11
|
+
'content-length': (await fs.stat(filePath)).size,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
fs.createReadStream(filePath).pipe(request);
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
request.on('error', reject);
|
|
17
|
+
request.on('response', resolve);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async function prepareSource(ref, command) {
|
|
21
|
+
const filePath = await git.createArchive(ref);
|
|
22
|
+
const { body: source } = await command.heroku.post('/sources');
|
|
23
|
+
await uploadArchive(source.source_blob.put_url, filePath);
|
|
24
|
+
return Promise.resolve(source);
|
|
25
|
+
}
|
|
26
|
+
async function createSourceBlob(ref, command) {
|
|
27
|
+
try {
|
|
28
|
+
const githubRepository = await git.githubRepository();
|
|
29
|
+
const { user, repo } = githubRepository;
|
|
30
|
+
const { body: archiveLink } = await command.heroku.get(`https://kolkrabbi.heroku.com/github/repos/${user}/${repo}/tarball/${ref}`);
|
|
31
|
+
if (await command.heroku.request(archiveLink.archive_link, { method: 'HEAD' })) {
|
|
32
|
+
return archiveLink.archive_link;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// the commit isn't in the repo, we will package the local git commit instead
|
|
37
|
+
core_1.ux.debug(`Commit not found in pipeline repository: ${error}`);
|
|
38
|
+
}
|
|
39
|
+
const sourceBlob = await prepareSource(ref, command);
|
|
40
|
+
return sourceBlob.source_blob.get_url;
|
|
41
|
+
}
|
|
42
|
+
exports.createSourceBlob = createSourceBlob;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
import * as Heroku from '@heroku-cli/schema';
|
|
3
|
+
export declare function renderList(command: Command, testRuns: Heroku.TestRun[], pipeline: Heroku.Pipeline, watchOption: boolean, jsonOption: boolean): Promise<void>;
|
|
4
|
+
export declare function displayAndExit(pipeline: Heroku.Pipeline, number: number, command: Command): Promise<void>;
|
|
5
|
+
export declare function displayTestRunInfo(command: Command, testRun: Heroku.TestRun, testNodes: Heroku.TestNode[], nodeArg: string | undefined): Promise<void>;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayTestRunInfo = exports.displayAndExit = exports.renderList = void 0;
|
|
4
|
+
const color_1 = require("@heroku-cli/color");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const https_1 = require("https");
|
|
7
|
+
const phoenix_1 = require("phoenix");
|
|
8
|
+
const util_1 = require("util");
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
10
|
+
const WebSocket = require("ws");
|
|
11
|
+
const debug = require('debug')('ci');
|
|
12
|
+
const ansiEscapes = require('ansi-escapes');
|
|
13
|
+
const HEROKU_CI_WEBSOCKET_URL = process.env.HEROKU_CI_WEBSOCKET_URL || 'wss://particleboard.heroku.com/socket';
|
|
14
|
+
function logStream(url, fn) {
|
|
15
|
+
return (0, https_1.get)(url, fn);
|
|
16
|
+
}
|
|
17
|
+
function stream(url) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const request = logStream(url, output => {
|
|
20
|
+
output.on('data', data => {
|
|
21
|
+
if (data.toString() === Buffer.from('').toString()) {
|
|
22
|
+
request.abort();
|
|
23
|
+
resolve();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
output.on('end', () => resolve());
|
|
27
|
+
output.on('error', e => reject(e));
|
|
28
|
+
output.pipe(process.stdout);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function statusIcon({ status }) {
|
|
33
|
+
if (!status) {
|
|
34
|
+
return color_1.default.yellow('-');
|
|
35
|
+
}
|
|
36
|
+
switch (status) {
|
|
37
|
+
case 'pending':
|
|
38
|
+
case 'creating':
|
|
39
|
+
case 'building':
|
|
40
|
+
case 'running':
|
|
41
|
+
case 'debugging':
|
|
42
|
+
return color_1.default.yellow('-');
|
|
43
|
+
case 'errored':
|
|
44
|
+
return color_1.default.red('!');
|
|
45
|
+
case 'failed':
|
|
46
|
+
return color_1.default.red('✗');
|
|
47
|
+
case 'succeeded':
|
|
48
|
+
return color_1.default.green('✓');
|
|
49
|
+
case 'cancelled':
|
|
50
|
+
return color_1.default.yellow('!');
|
|
51
|
+
default:
|
|
52
|
+
return color_1.default.yellow('?');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const BUILDING = 'building';
|
|
56
|
+
const RUNNING = 'running';
|
|
57
|
+
const ERRORED = 'errored';
|
|
58
|
+
const FAILED = 'failed';
|
|
59
|
+
const SUCCEEDED = 'succeeded';
|
|
60
|
+
const CANCELLED = 'cancelled';
|
|
61
|
+
const TERMINAL_STATES = [SUCCEEDED, FAILED, ERRORED, CANCELLED];
|
|
62
|
+
const RUNNING_STATES = [RUNNING].concat(TERMINAL_STATES);
|
|
63
|
+
const BUILDING_STATES = [BUILDING, RUNNING].concat(TERMINAL_STATES);
|
|
64
|
+
function printLine(testRun) {
|
|
65
|
+
return `${statusIcon(testRun)} #${testRun.number} ${testRun.commit_branch}:${testRun.commit_sha.slice(0, 7)} ${testRun.status}`;
|
|
66
|
+
}
|
|
67
|
+
function printLineTestNode(testNode) {
|
|
68
|
+
return `${statusIcon(testNode)} #${testNode.index} ${testNode.status}`;
|
|
69
|
+
}
|
|
70
|
+
function processExitCode(command, testNode) {
|
|
71
|
+
if (testNode.exit_code && testNode.exit_code !== 0) {
|
|
72
|
+
command.exit(testNode.exit_code);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function handleTestRunEvent(newTestRun, testRuns) {
|
|
76
|
+
const previousTestRun = testRuns.find(({ id }) => id === newTestRun.id);
|
|
77
|
+
if (previousTestRun) {
|
|
78
|
+
const previousTestRunIndex = testRuns.indexOf(previousTestRun);
|
|
79
|
+
testRuns.splice(previousTestRunIndex, 1);
|
|
80
|
+
}
|
|
81
|
+
testRuns.push(newTestRun);
|
|
82
|
+
return testRuns;
|
|
83
|
+
}
|
|
84
|
+
function sort(testRuns) {
|
|
85
|
+
return testRuns.sort((a, b) => a.number < b.number ? 1 : -1);
|
|
86
|
+
}
|
|
87
|
+
function draw(testRuns, watchOption = false, jsonOption = false, count = 15) {
|
|
88
|
+
const latestTestRuns = sort(testRuns).slice(0, count);
|
|
89
|
+
if (jsonOption) {
|
|
90
|
+
core_1.ux.styledJSON(latestTestRuns);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (watchOption) {
|
|
94
|
+
process.stdout.write(ansiEscapes.eraseDown);
|
|
95
|
+
}
|
|
96
|
+
const data = [];
|
|
97
|
+
latestTestRuns.forEach(testRun => {
|
|
98
|
+
data.push({
|
|
99
|
+
iconStatus: `${statusIcon(testRun)}`,
|
|
100
|
+
number: testRun.number,
|
|
101
|
+
branch: testRun.commit_branch,
|
|
102
|
+
sha: testRun.commit_sha.slice(0, 7),
|
|
103
|
+
status: testRun.status,
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
core_1.ux.table(data, {
|
|
107
|
+
iconStatus: {
|
|
108
|
+
minWidth: 1, header: '', // header '' is to make sure that width is 1 character
|
|
109
|
+
},
|
|
110
|
+
number: {
|
|
111
|
+
header: '', // header '' is to make sure that width is 1 character
|
|
112
|
+
},
|
|
113
|
+
branch: {},
|
|
114
|
+
sha: {},
|
|
115
|
+
status: {},
|
|
116
|
+
}, { printHeader: undefined });
|
|
117
|
+
if (watchOption) {
|
|
118
|
+
process.stdout.write(ansiEscapes.cursorUp(latestTestRuns.length));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function renderList(command, testRuns, pipeline, watchOption, jsonOption) {
|
|
122
|
+
const watchable = (Boolean(watchOption && !jsonOption));
|
|
123
|
+
if (!jsonOption) {
|
|
124
|
+
const header = `${watchOption ? 'Watching' : 'Showing'} latest test runs for the ${pipeline.name} pipeline`;
|
|
125
|
+
core_1.ux.styledHeader(header);
|
|
126
|
+
}
|
|
127
|
+
draw(testRuns, watchOption, jsonOption);
|
|
128
|
+
if (!watchable) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const socket = new phoenix_1.Socket(HEROKU_CI_WEBSOCKET_URL, {
|
|
132
|
+
transport: WebSocket,
|
|
133
|
+
params: {
|
|
134
|
+
token: command.heroku.auth,
|
|
135
|
+
tab_id: `heroku-cli-${(0, uuid_1.v4)()}`,
|
|
136
|
+
},
|
|
137
|
+
logger: (kind, msg, data) => debug(`${kind}: ${msg}\n${(0, util_1.inspect)(data)}`),
|
|
138
|
+
});
|
|
139
|
+
socket.connect();
|
|
140
|
+
const channel = socket.channel(`events:pipelines/${pipeline.id}/test-runs`, {});
|
|
141
|
+
channel.on('create', ({ data }) => {
|
|
142
|
+
testRuns = handleTestRunEvent(data, testRuns);
|
|
143
|
+
draw(testRuns, watchOption);
|
|
144
|
+
});
|
|
145
|
+
channel.on('update', ({ data }) => {
|
|
146
|
+
testRuns = handleTestRunEvent(data, testRuns);
|
|
147
|
+
draw(testRuns, watchOption);
|
|
148
|
+
});
|
|
149
|
+
// eslint-disable-next-line unicorn/require-array-join-separator
|
|
150
|
+
channel.join();
|
|
151
|
+
}
|
|
152
|
+
exports.renderList = renderList;
|
|
153
|
+
async function renderNodeOutput(command, testRun, testNode) {
|
|
154
|
+
if (!testNode) {
|
|
155
|
+
command.error(`Test run ${testRun.number} was ${testRun.status}. No Heroku CI runs found for this pipeline.`);
|
|
156
|
+
}
|
|
157
|
+
await stream(testNode.setup_stream_url);
|
|
158
|
+
await stream(testNode.output_stream_url);
|
|
159
|
+
command.log();
|
|
160
|
+
command.log(printLine(testRun));
|
|
161
|
+
}
|
|
162
|
+
async function waitForStates(states, testRun, command) {
|
|
163
|
+
let newTestRun = testRun;
|
|
164
|
+
while (!states.includes(newTestRun.status.toString())) {
|
|
165
|
+
const { body: bodyTestRun } = await command.heroku.get(`/pipelines/${testRun.pipeline.id}/test-runs/${testRun.number}`);
|
|
166
|
+
newTestRun = bodyTestRun;
|
|
167
|
+
}
|
|
168
|
+
return newTestRun;
|
|
169
|
+
}
|
|
170
|
+
async function display(pipeline, number, command) {
|
|
171
|
+
let { body: testRun } = await command.heroku.get(`/pipelines/${pipeline.id}/test-runs/${number}`);
|
|
172
|
+
if (testRun) {
|
|
173
|
+
core_1.ux.action.start('Waiting for build to start');
|
|
174
|
+
testRun = await waitForStates(BUILDING_STATES, testRun, command);
|
|
175
|
+
core_1.ux.action.stop();
|
|
176
|
+
const { body: testNodes } = await command.heroku.get(`/test-runs/${testRun.id}/test-nodes`);
|
|
177
|
+
let firstTestNode = testNodes[0];
|
|
178
|
+
if (firstTestNode) {
|
|
179
|
+
await stream(firstTestNode.setup_stream_url);
|
|
180
|
+
}
|
|
181
|
+
if (testRun) {
|
|
182
|
+
testRun = await waitForStates(RUNNING_STATES, testRun, command);
|
|
183
|
+
}
|
|
184
|
+
if (firstTestNode) {
|
|
185
|
+
await stream(firstTestNode.output_stream_url);
|
|
186
|
+
}
|
|
187
|
+
if (testRun) {
|
|
188
|
+
testRun = await waitForStates(TERMINAL_STATES, testRun, command);
|
|
189
|
+
}
|
|
190
|
+
// At this point, we know that testRun has a finished status,
|
|
191
|
+
// and we can check for exit_code from firstTestNode
|
|
192
|
+
if (testRun) {
|
|
193
|
+
const { body: newTestNodes } = await command.heroku.get(`/test-runs/${testRun.id}/test-nodes`);
|
|
194
|
+
firstTestNode = newTestNodes[0];
|
|
195
|
+
command.log();
|
|
196
|
+
command.log(printLine(testRun));
|
|
197
|
+
}
|
|
198
|
+
return firstTestNode;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async function displayAndExit(pipeline, number, command) {
|
|
202
|
+
const testNode = await display(pipeline, number, command);
|
|
203
|
+
testNode ? processExitCode(command, testNode) : command.exit(1);
|
|
204
|
+
}
|
|
205
|
+
exports.displayAndExit = displayAndExit;
|
|
206
|
+
async function displayTestRunInfo(command, testRun, testNodes, nodeArg) {
|
|
207
|
+
let testNode;
|
|
208
|
+
if (nodeArg) {
|
|
209
|
+
const nodeIndex = Number.parseInt(nodeArg, 2);
|
|
210
|
+
testNode = testNodes.length > 1 ? testNodes[nodeIndex] : testNodes[0];
|
|
211
|
+
await renderNodeOutput(command, testRun, testNode);
|
|
212
|
+
if (testNodes.length === 1) {
|
|
213
|
+
command.log();
|
|
214
|
+
command.warn('This pipeline doesn\'t have parallel test runs, but you specified a node');
|
|
215
|
+
command.warn('See https://devcenter.heroku.com/articles/heroku-ci-parallel-test-runs for more info');
|
|
216
|
+
}
|
|
217
|
+
processExitCode(command, testNode);
|
|
218
|
+
}
|
|
219
|
+
else if (testNodes.length > 1) {
|
|
220
|
+
command.log(printLine(testRun));
|
|
221
|
+
command.log();
|
|
222
|
+
testNodes.forEach(testNode => {
|
|
223
|
+
command.log(printLineTestNode(testNode));
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
testNode = testNodes[0];
|
|
228
|
+
await renderNodeOutput(command, testRun, testNode);
|
|
229
|
+
processExitCode(command, testNode);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.displayTestRunInfo = displayTestRunInfo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateURL(uri: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateURL = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
5
|
+
function insecureURL(uri) {
|
|
6
|
+
if (uri.protocol === 'https:')
|
|
7
|
+
return false;
|
|
8
|
+
// allow non-https localhost, 10.*, 127.*, and 192.* clients for testing
|
|
9
|
+
if (/^localhost(?:[:]\d+)?$/.test(uri.host))
|
|
10
|
+
return false;
|
|
11
|
+
if (/\.local(?:[:]\d+)?$/.test(uri.host))
|
|
12
|
+
return false;
|
|
13
|
+
if (uri.host.match(/^(10|127|192)\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:[:]\d+)?$/))
|
|
14
|
+
return false;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
function validateURL(uri) {
|
|
18
|
+
const u = new url_1.URL(uri);
|
|
19
|
+
if (!u.protocol)
|
|
20
|
+
throw new Error('Invalid URL');
|
|
21
|
+
if (insecureURL(u))
|
|
22
|
+
throw new Error('Unsupported callback URL. Clients have to use HTTPS for non-local addresses.');
|
|
23
|
+
return uri;
|
|
24
|
+
}
|
|
25
|
+
exports.validateURL = validateURL;
|