heroku 8.7.1 → 9.0.0-alpha.1

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.
Files changed (96) hide show
  1. package/README.md +4 -1
  2. package/lib/commands/apps/create.d.ts +28 -0
  3. package/lib/commands/apps/create.js +194 -0
  4. package/lib/commands/apps/destroy.d.ts +14 -0
  5. package/lib/commands/apps/destroy.js +46 -0
  6. package/lib/commands/apps/errors.d.ts +12 -0
  7. package/lib/commands/apps/errors.js +119 -0
  8. package/lib/commands/apps/favorites/add.d.ts +9 -0
  9. package/lib/commands/apps/favorites/add.js +37 -0
  10. package/lib/commands/apps/favorites/index.d.ts +9 -0
  11. package/lib/commands/apps/favorites/index.js +25 -0
  12. package/lib/commands/apps/favorites/remove.d.ts +9 -0
  13. package/lib/commands/apps/favorites/remove.js +27 -0
  14. package/lib/commands/apps/index.d.ts +16 -0
  15. package/lib/commands/apps/index.js +119 -0
  16. package/lib/commands/apps/info.d.ts +18 -0
  17. package/lib/commands/apps/info.js +163 -0
  18. package/lib/commands/apps/open.d.ts +14 -0
  19. package/lib/commands/apps/open.js +29 -0
  20. package/lib/commands/apps/rename.d.ts +15 -0
  21. package/lib/commands/apps/rename.js +50 -0
  22. package/lib/commands/apps/stacks/index.d.ts +10 -0
  23. package/lib/commands/apps/stacks/index.js +43 -0
  24. package/lib/commands/apps/stacks/set.d.ts +14 -0
  25. package/lib/commands/apps/stacks/set.js +41 -0
  26. package/lib/commands/auth/logout.js +1 -0
  27. package/lib/commands/ci/config/get.d.ts +16 -0
  28. package/lib/commands/ci/config/get.js +37 -0
  29. package/lib/commands/ci/config/index.d.ts +12 -0
  30. package/lib/commands/ci/config/index.js +43 -0
  31. package/lib/commands/ci/config/set.d.ts +12 -0
  32. package/lib/commands/ci/config/set.js +48 -0
  33. package/lib/commands/ci/config/unset.d.ts +13 -0
  34. package/lib/commands/ci/config/unset.js +35 -0
  35. package/lib/commands/ci/debug.d.ts +13 -0
  36. package/lib/commands/ci/debug.js +105 -0
  37. package/lib/commands/ci/index.js +1 -1
  38. package/lib/commands/ci/info.js +1 -1
  39. package/lib/commands/ci/last.js +1 -1
  40. package/lib/commands/ci/migrate-manifest.d.ts +7 -0
  41. package/lib/commands/ci/migrate-manifest.js +74 -0
  42. package/lib/commands/ci/open.d.ts +12 -0
  43. package/lib/commands/ci/open.js +23 -0
  44. package/lib/commands/ci/rerun.js +1 -1
  45. package/lib/commands/ci/run.js +1 -1
  46. package/lib/commands/config/set.d.ts +11 -0
  47. package/lib/commands/config/set.js +59 -0
  48. package/lib/commands/domains/index.d.ts +1 -1
  49. package/lib/commands/drains/add.d.ts +11 -0
  50. package/lib/commands/drains/add.js +22 -0
  51. package/lib/commands/drains/index.d.ts +10 -0
  52. package/lib/commands/drains/index.js +49 -0
  53. package/lib/commands/drains/remove.d.ts +12 -0
  54. package/lib/commands/drains/remove.js +21 -0
  55. package/lib/commands/pipelines/add.js +1 -1
  56. package/lib/commands/pipelines/connect.js +1 -1
  57. package/lib/commands/pipelines/create.js +1 -1
  58. package/lib/commands/pipelines/destroy.js +1 -1
  59. package/lib/commands/pipelines/diff.js +1 -1
  60. package/lib/commands/pipelines/info.js +1 -1
  61. package/lib/commands/pipelines/promote.js +1 -1
  62. package/lib/commands/pipelines/remove.js +1 -1
  63. package/lib/commands/pipelines/rename.js +1 -1
  64. package/lib/commands/pipelines/setup.js +1 -1
  65. package/lib/commands/pipelines/transfer.js +1 -1
  66. package/lib/commands/pipelines/update.js +1 -1
  67. package/lib/lib/{pipelines/api.d.ts → api.d.ts} +10 -5
  68. package/lib/lib/{pipelines/api.js → api.js} +48 -4
  69. package/lib/lib/apps/confirm-app.d.ts +1 -0
  70. package/lib/lib/apps/confirm-app.js +23 -0
  71. package/lib/lib/apps/error_info.d.ts +7 -0
  72. package/lib/lib/apps/error_info.js +185 -0
  73. package/lib/lib/buildpacks/buildpacks.js +3 -4
  74. package/lib/lib/ci/git.d.ts +7 -1
  75. package/lib/lib/ci/git.js +44 -1
  76. package/lib/lib/ci/pipelines.d.ts +3 -3
  77. package/lib/lib/ci/pipelines.js +10 -9
  78. package/lib/lib/ci/test-run.d.ts +1 -0
  79. package/lib/lib/ci/test-run.js +2 -1
  80. package/lib/lib/ci/validate.d.ts +2 -0
  81. package/lib/lib/ci/validate.js +10 -0
  82. package/lib/lib/git/git.d.ts +11 -0
  83. package/lib/lib/git/git.js +38 -0
  84. package/lib/lib/git/push.d.ts +1 -0
  85. package/lib/lib/git/push.js +6 -0
  86. package/lib/lib/pipelines/disambiguate.js +1 -1
  87. package/lib/lib/pipelines/ownership.js +1 -1
  88. package/lib/lib/pipelines/setup/create-apps.d.ts +2 -1
  89. package/lib/lib/pipelines/setup/create-apps.js +1 -1
  90. package/lib/lib/pipelines/setup/poll-app-setups.js +1 -1
  91. package/lib/lib/types/favorites.d.ts +7 -0
  92. package/lib/lib/types/favorites.js +2 -0
  93. package/oclif.manifest.json +879 -11
  94. package/package.json +8 -4
  95. package/lib/lib/buildpacks/push.d.ts +0 -0
  96. package/lib/lib/buildpacks/push.js +0 -4
@@ -4,7 +4,7 @@ const color_1 = require("@heroku-cli/color");
4
4
  const command_1 = require("@heroku-cli/command");
5
5
  const core_1 = require("@oclif/core");
6
6
  const http_call_1 = require("http-call");
7
- const api_1 = require("../../lib/pipelines/api");
7
+ const api_1 = require("../../lib/api");
8
8
  const kolkrabbi_api_1 = require("../../lib/pipelines/kolkrabbi-api");
9
9
  const PROMOTION_ORDER = ['development', 'staging', 'production'];
10
10
  async function diff(targetApp, downstreamApp, githubToken, herokuUserAgent) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@heroku-cli/command");
4
4
  const core_1 = require("@oclif/core");
5
- const api_1 = require("../../lib/pipelines/api");
5
+ const api_1 = require("../../lib/api");
6
6
  const disambiguate_1 = require("../../lib/pipelines/disambiguate");
7
7
  const render_pipeline_1 = require("../../lib/pipelines/render-pipeline");
8
8
  class PipelinesInfo extends command_1.Command {
@@ -8,7 +8,7 @@ const assert = require("assert");
8
8
  const node_fetch_1 = require("node-fetch");
9
9
  const Stream = require("stream");
10
10
  const util = require("util");
11
- const api_1 = require("../../lib/pipelines/api");
11
+ const api_1 = require("../../lib/api");
12
12
  const key_by_1 = require("../../lib/pipelines/key-by");
13
13
  const sleep = (time) => {
14
14
  return new Promise(resolve => setTimeout(resolve, time));
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const color_1 = require("@heroku-cli/color");
4
4
  const command_1 = require("@heroku-cli/command");
5
5
  const core_1 = require("@oclif/core");
6
- const api_1 = require("../../lib/pipelines/api");
6
+ const api_1 = require("../../lib/api");
7
7
  class PipelinesRemove extends command_1.Command {
8
8
  async run() {
9
9
  const { flags: { app } } = await this.parse(PipelinesRemove);
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const color_1 = require("@heroku-cli/color");
4
4
  const command_1 = require("@heroku-cli/command");
5
5
  const core_1 = require("@oclif/core");
6
- const api_1 = require("../../lib/pipelines/api");
6
+ const api_1 = require("../../lib/api");
7
7
  const disambiguate_1 = require("../../lib/pipelines/disambiguate");
8
8
  class PipelinesRename extends command_1.Command {
9
9
  async run() {
@@ -5,7 +5,7 @@ const command_1 = require("@heroku-cli/command");
5
5
  const core_1 = require("@oclif/core");
6
6
  const open = require("open");
7
7
  const debug_1 = require("debug");
8
- const api_1 = require("../../lib/pipelines/api");
8
+ const api_1 = require("../../lib/api");
9
9
  const github_api_1 = require("../../lib/pipelines/github-api");
10
10
  const kolkrabbi_api_1 = require("../../lib/pipelines/kolkrabbi-api");
11
11
  const create_apps_1 = require("../../lib/pipelines/setup/create-apps");
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const color_1 = require("@heroku-cli/color");
4
4
  const command_1 = require("@heroku-cli/command");
5
5
  const core_1 = require("@oclif/core");
6
- const api_1 = require("../../lib/pipelines/api");
6
+ const api_1 = require("../../lib/api");
7
7
  const disambiguate_1 = require("../../lib/pipelines/disambiguate");
8
8
  const render_pipeline_1 = require("../../lib/pipelines/render-pipeline");
9
9
  async function getTeamOwner(heroku, name) {
@@ -4,7 +4,7 @@ const color_1 = require("@heroku-cli/color");
4
4
  const command_1 = require("@heroku-cli/command");
5
5
  const completions_1 = require("@heroku-cli/command/lib/completions");
6
6
  const core_1 = require("@oclif/core");
7
- const api_1 = require("../../lib/pipelines/api");
7
+ const api_1 = require("../../lib/api");
8
8
  class PipelinesUpdate extends command_1.Command {
9
9
  async run() {
10
10
  const { flags } = await this.parse(PipelinesUpdate);
@@ -5,10 +5,10 @@ export declare const FILTERS_HEADER: string;
5
5
  export declare const PIPELINES_HEADER: string;
6
6
  export declare function createAppSetup(heroku: APIClient, body: {
7
7
  body: any;
8
- }): Promise<import("http-call").HTTP<unknown>>;
8
+ }): Promise<import("http-call").HTTP<Heroku.AppSetup>>;
9
9
  export declare function postCoupling(heroku: APIClient, pipeline: any, app: any, stage: string): Promise<import("http-call").HTTP<unknown>>;
10
10
  export declare function createCoupling(heroku: APIClient, pipeline: any, app: string, stage: string): Promise<import("http-call").HTTP<unknown>>;
11
- export declare function createPipeline(heroku: APIClient, name: any, owner: any): Promise<import("http-call").HTTP<unknown>>;
11
+ export declare function createPipeline(heroku: APIClient, name: any, owner: any): Promise<import("http-call").HTTP<Heroku.Pipeline>>;
12
12
  export declare function createPipelineTransfer(heroku: APIClient, pipeline: Heroku.Pipeline): Promise<import("http-call").HTTP<unknown>>;
13
13
  export declare function destroyPipeline(heroku: APIClient, name: any, pipelineId: any): Promise<import("http-call").HTTP<unknown>>;
14
14
  export declare function findPipelineByName(heroku: APIClient, idOrName: string): Promise<import("http-call").HTTP<Heroku.Pipeline[]>>;
@@ -17,9 +17,14 @@ export declare function getPipeline(heroku: APIClient, id: string): Promise<impo
17
17
  export declare function updatePipeline(heroku: APIClient, id: string, body: Heroku.Pipeline): Promise<import("http-call").HTTP<Heroku.Pipeline>>;
18
18
  export declare function getTeam(heroku: APIClient, teamId: any): Promise<import("http-call").HTTP<Heroku.Team>>;
19
19
  export declare function getAccountInfo(heroku: APIClient, id?: string): Promise<import("http-call").HTTP<Heroku.Account>>;
20
- export declare function getAppSetup(heroku: APIClient, buildId: any): Promise<import("http-call").HTTP<unknown>>;
20
+ export declare function getAppSetup(heroku: APIClient, buildId: any): Promise<import("http-call").HTTP<Heroku.AppSetup>>;
21
21
  export declare function listPipelineApps(heroku: APIClient, pipelineId: string): Promise<Array<Heroku.App>>;
22
- export declare function patchCoupling(heroku: APIClient, id: string, stage: string): Promise<import("http-call").HTTP<unknown>>;
22
+ export declare function patchCoupling(heroku: APIClient, id: string, stage: string): Promise<import("http-call").HTTP<Heroku.PipelineCoupling>>;
23
23
  export declare function removeCoupling(heroku: APIClient, app: string): Promise<import("http-call").HTTP<unknown>>;
24
- export declare function updateCoupling(heroku: APIClient, app: string, stage: string): Promise<import("http-call").HTTP<unknown>>;
24
+ export declare function updateCoupling(heroku: APIClient, app: string, stage: string): Promise<import("http-call").HTTP<Heroku.PipelineCoupling>>;
25
25
  export declare function getReleases(heroku: APIClient, appId: string): Promise<import("http-call").HTTP<Heroku.Release[]>>;
26
+ export declare function getPipelineConfigVars(heroku: APIClient, pipelineID: string): Promise<import("http-call").HTTP<Heroku.ConfigVars>>;
27
+ export declare function setPipelineConfigVars(heroku: APIClient, pipelineID: string, body: Heroku.ConfigVars | Record<string, null>): Promise<import("http-call").HTTP<Heroku.ConfigVars>>;
28
+ export declare function createTestRun(heroku: APIClient, body: Heroku.TestRun): Promise<import("http-call").HTTP<Heroku.TestRun>>;
29
+ export declare function getTestNodes(heroku: APIClient, testRunIdD: string): Promise<import("http-call").HTTP<Heroku.TestRun>>;
30
+ export declare function updateTestRun(heroku: APIClient, id: string, body: Heroku.TestRun): Promise<import("http-call").HTTP<Heroku.TestRun>>;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getReleases = exports.updateCoupling = exports.removeCoupling = exports.patchCoupling = exports.listPipelineApps = exports.getAppSetup = exports.getAccountInfo = exports.getTeam = exports.updatePipeline = exports.getPipeline = exports.getCoupling = exports.findPipelineByName = exports.destroyPipeline = exports.createPipelineTransfer = exports.createPipeline = exports.createCoupling = exports.postCoupling = exports.createAppSetup = exports.PIPELINES_HEADER = exports.FILTERS_HEADER = exports.V3_HEADER = void 0;
3
+ exports.updateTestRun = exports.getTestNodes = exports.createTestRun = exports.setPipelineConfigVars = exports.getPipelineConfigVars = exports.getReleases = exports.updateCoupling = exports.removeCoupling = exports.patchCoupling = exports.listPipelineApps = exports.getAppSetup = exports.getAccountInfo = exports.getTeam = exports.updatePipeline = exports.getPipeline = exports.getCoupling = exports.findPipelineByName = exports.destroyPipeline = exports.createPipelineTransfer = exports.createPipeline = exports.createCoupling = exports.postCoupling = exports.createAppSetup = exports.PIPELINES_HEADER = exports.FILTERS_HEADER = exports.V3_HEADER = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  exports.V3_HEADER = 'application/vnd.heroku+json; version=3';
6
6
  exports.FILTERS_HEADER = `${exports.V3_HEADER}.filters`;
7
7
  exports.PIPELINES_HEADER = `${exports.V3_HEADER}.pipelines`;
8
+ const CI_HEADER = `${exports.V3_HEADER}.ci`;
8
9
  function createAppSetup(heroku, body) {
9
10
  return heroku.post('/app-setups', { body });
10
11
  }
@@ -68,9 +69,6 @@ function updatePipeline(heroku, id, body) {
68
69
  });
69
70
  }
70
71
  exports.updatePipeline = updatePipeline;
71
- // function getApp(heroku: APIClient, app) {
72
- // return heroku.get(`/apps/${app}`)
73
- // }
74
72
  function getTeam(heroku, teamId) {
75
73
  return heroku.get(`/teams/${teamId}`);
76
74
  }
@@ -128,3 +126,49 @@ function getReleases(heroku, appId) {
128
126
  });
129
127
  }
130
128
  exports.getReleases = getReleases;
129
+ function getPipelineConfigVars(heroku, pipelineID) {
130
+ return heroku.request(`/pipelines/${pipelineID}/stage/test/config-vars`, {
131
+ method: 'GET',
132
+ headers: { Accept: exports.PIPELINES_HEADER },
133
+ });
134
+ }
135
+ exports.getPipelineConfigVars = getPipelineConfigVars;
136
+ function setPipelineConfigVars(heroku, pipelineID, body) {
137
+ return heroku.request(`/pipelines/${pipelineID}/stage/test/config-vars`, {
138
+ method: 'PATCH',
139
+ headers: { Accept: exports.PIPELINES_HEADER },
140
+ path: `/pipelines/${pipelineID}/stage/test/config-vars`,
141
+ body,
142
+ });
143
+ }
144
+ exports.setPipelineConfigVars = setPipelineConfigVars;
145
+ async function createTestRun(heroku, body) {
146
+ const headers = {
147
+ Accept: CI_HEADER,
148
+ };
149
+ return heroku.request('/test-runs', {
150
+ headers,
151
+ method: 'POST',
152
+ body,
153
+ });
154
+ }
155
+ exports.createTestRun = createTestRun;
156
+ async function getTestNodes(heroku, testRunIdD) {
157
+ return heroku.request(`/test-runs/${testRunIdD}/test-nodes`, {
158
+ headers: {
159
+ Authorization: `Bearer ${heroku.auth}`,
160
+ Accept: CI_HEADER,
161
+ },
162
+ });
163
+ }
164
+ exports.getTestNodes = getTestNodes;
165
+ function updateTestRun(heroku, id, body) {
166
+ return heroku.request(`/test-runs/${id}`, {
167
+ body,
168
+ method: 'PATCH',
169
+ headers: {
170
+ Accept: CI_HEADER,
171
+ },
172
+ });
173
+ }
174
+ exports.updateTestRun = updateTestRun;
@@ -0,0 +1 @@
1
+ export default function confirmApp(app: string, confirm?: string, message?: string): Promise<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const core_1 = require("@oclif/core");
5
+ async function confirmApp(app, confirm, message) {
6
+ if (confirm) {
7
+ if (confirm === app)
8
+ return;
9
+ throw new Error(`Confirmation ${color_1.default.bold.red(confirm)} did not match ${color_1.default.bold.red(app)}. Aborted.`);
10
+ }
11
+ if (!message) {
12
+ message = `WARNING: Destructive Action
13
+ This command will affect the app ${color_1.default.bold.red(app)}`;
14
+ }
15
+ core_1.ux.warn(message);
16
+ console.error();
17
+ const entered = await core_1.ux.prompt(`To proceed, type ${color_1.default.bold.red(app)} or re-run this command with ${color_1.default.bold.red('--confirm', app)}`, { required: true });
18
+ if (entered === app) {
19
+ return;
20
+ }
21
+ throw new Error(`Confirmation did not match ${color_1.default.bold.red(app)}. Aborted.`);
22
+ }
23
+ exports.default = confirmApp;
@@ -0,0 +1,7 @@
1
+ export declare type ErrorInfo = {
2
+ name: string;
3
+ title: string;
4
+ level: string;
5
+ };
6
+ declare const ERROR_INFO: ErrorInfo[];
7
+ export default ERROR_INFO;
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ERROR_INFO = [
4
+ {
5
+ name: 'H10',
6
+ title: 'App Crashed',
7
+ level: 'critical',
8
+ },
9
+ {
10
+ name: 'H11',
11
+ title: 'Backlog too deep',
12
+ level: 'critical',
13
+ },
14
+ {
15
+ name: 'H12',
16
+ title: 'Request Timeout',
17
+ level: 'critical',
18
+ },
19
+ {
20
+ name: 'H13',
21
+ title: 'Connection closed without response',
22
+ level: 'critical',
23
+ },
24
+ {
25
+ name: 'H14',
26
+ title: 'No web dynos running',
27
+ level: 'critical',
28
+ },
29
+ {
30
+ name: 'H15',
31
+ title: 'Idle connection',
32
+ level: 'warning',
33
+ },
34
+ {
35
+ name: 'H16',
36
+ title: 'Redirect to herokuapp.com',
37
+ level: 'warning',
38
+ },
39
+ {
40
+ name: 'H17',
41
+ title: 'Poorly formatted HTTP response',
42
+ level: 'warning',
43
+ },
44
+ {
45
+ name: 'H18',
46
+ title: 'Server Request Interrupted',
47
+ level: 'critical',
48
+ },
49
+ {
50
+ name: 'H19',
51
+ title: 'Backend connection timeout',
52
+ level: 'critical',
53
+ },
54
+ {
55
+ name: 'H20',
56
+ title: 'App boot timeout',
57
+ level: 'critical',
58
+ },
59
+ {
60
+ name: 'H21',
61
+ title: 'Backend connection refused',
62
+ level: 'critical',
63
+ },
64
+ {
65
+ name: 'H22',
66
+ title: 'Connection limit reached',
67
+ level: 'critical',
68
+ },
69
+ {
70
+ name: 'H23',
71
+ title: 'Endpoint misconfigured',
72
+ level: 'critical',
73
+ },
74
+ {
75
+ name: 'H24',
76
+ title: 'Forced close',
77
+ level: 'critical',
78
+ },
79
+ {
80
+ name: 'H25',
81
+ title: 'HTTP Restriction',
82
+ level: 'critical',
83
+ },
84
+ {
85
+ name: 'H26',
86
+ title: 'Request Error',
87
+ level: 'critical',
88
+ },
89
+ {
90
+ name: 'H27',
91
+ title: 'Client Request Interrupted',
92
+ level: 'info',
93
+ },
94
+ {
95
+ name: 'H28',
96
+ title: 'Client Connection Idle',
97
+ level: 'warning',
98
+ },
99
+ {
100
+ name: 'H31',
101
+ title: 'Misdirected Request',
102
+ level: 'critical',
103
+ },
104
+ {
105
+ name: 'H80',
106
+ title: 'Maintenance Mode',
107
+ level: 'warning',
108
+ },
109
+ {
110
+ name: 'H81',
111
+ title: 'Blank app',
112
+ level: 'info',
113
+ },
114
+ {
115
+ name: 'H82',
116
+ title: "You've used up your dyno hour pool",
117
+ level: 'info',
118
+ },
119
+ {
120
+ name: 'H99',
121
+ title: 'Platform error',
122
+ level: 'critical',
123
+ },
124
+ {
125
+ name: 'R10',
126
+ title: 'Boot timeout',
127
+ level: 'critical',
128
+ },
129
+ {
130
+ name: 'R12',
131
+ title: 'Exit timeout',
132
+ level: 'warning',
133
+ },
134
+ {
135
+ name: 'R13',
136
+ title: 'Attach error',
137
+ level: 'warning',
138
+ },
139
+ {
140
+ name: 'R14',
141
+ title: 'Memory quota exceeded',
142
+ level: 'critical',
143
+ },
144
+ {
145
+ name: 'R15',
146
+ title: 'Memory quota vastly exceeded',
147
+ level: 'critical',
148
+ },
149
+ {
150
+ name: 'R151',
151
+ title: 'Memory quota vastly exceeded',
152
+ level: 'warning',
153
+ },
154
+ {
155
+ name: 'R16',
156
+ title: 'Detached',
157
+ level: 'warning',
158
+ },
159
+ {
160
+ name: 'R99',
161
+ title: 'Platform error',
162
+ level: 'warning',
163
+ },
164
+ {
165
+ name: 'L10',
166
+ title: 'Drain buffer overflow',
167
+ level: 'warning',
168
+ },
169
+ {
170
+ name: 'L11',
171
+ title: 'Tail buffer overflow',
172
+ level: 'warning',
173
+ },
174
+ {
175
+ name: 'L12',
176
+ title: 'Local buffer overflow',
177
+ level: 'warning',
178
+ },
179
+ {
180
+ name: 'L13',
181
+ title: 'Local delivery error',
182
+ level: 'critical',
183
+ },
184
+ ];
185
+ exports.default = ERROR_INFO;
@@ -6,8 +6,7 @@ const buildpack_registry_1 = require("@heroku/buildpack-registry");
6
6
  const core_1 = require("@oclif/core");
7
7
  const lodash_1 = require("lodash");
8
8
  const true_myth_1 = require("true-myth");
9
- // eslint-disable-next-line node/no-missing-require
10
- const push = require('./push');
9
+ const push_1 = require("../git/push");
11
10
  const validUrl = require('valid-url');
12
11
  class BuildpackCommand {
13
12
  constructor(heroku) {
@@ -103,12 +102,12 @@ class BuildpackCommand {
103
102
  displayUpdate(app, remote, buildpacks, action) {
104
103
  if (buildpacks.length === 1) {
105
104
  core_1.ux.log(`Buildpack ${action}. Next release on ${app} will use ${this.registryUrlToName(buildpacks[0].buildpack.url)}.`);
106
- core_1.ux.log(`Run ${color_1.default.magenta(push(remote))} to create a new release using this buildpack.`);
105
+ core_1.ux.log(`Run ${color_1.default.magenta((0, push_1.default)(remote))} to create a new release using this buildpack.`);
107
106
  }
108
107
  else {
109
108
  core_1.ux.log(`Buildpack ${action}. Next release on ${app} will use:`);
110
109
  this.display(buildpacks, ' ');
111
- core_1.ux.log(`Run ${color_1.default.magenta(push(remote))} to create a new release using these buildpacks.`);
110
+ core_1.ux.log(`Run ${color_1.default.magenta((0, push_1.default)(remote))} to create a new release using these buildpacks.`);
112
111
  }
113
112
  }
114
113
  registryUrlToName(buildpack, registryOnly = false) {
@@ -5,4 +5,10 @@ declare function readCommit(commit: string): Promise<{
5
5
  ref: string | undefined;
6
6
  message: string | undefined;
7
7
  }>;
8
- export { createArchive, githubRepository, readCommit, };
8
+ declare function sshGitUrl(app: string): string;
9
+ declare function gitUrl(app?: string): string;
10
+ declare function listRemotes(): Promise<string[][]>;
11
+ declare function inGitRepo(): true | undefined;
12
+ declare function rmRemote(remote: string): Promise<string>;
13
+ declare function createRemote(remote: string, url: string): Promise<string | null>;
14
+ export { createArchive, githubRepository, readCommit, sshGitUrl, gitUrl, createRemote, listRemotes, rmRemote, inGitRepo, };
package/lib/lib/ci/git.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readCommit = exports.githubRepository = exports.createArchive = void 0;
3
+ exports.inGitRepo = exports.rmRemote = exports.listRemotes = exports.createRemote = exports.gitUrl = exports.sshGitUrl = exports.readCommit = exports.githubRepository = exports.createArchive = void 0;
4
4
  const fs = require("fs-extra");
5
+ const command_1 = require("@heroku-cli/command");
5
6
  const gh = require('github-url-to-object');
6
7
  const spawn = require('child_process').spawn;
7
8
  const tmp = require('tmp');
@@ -69,3 +70,45 @@ async function readCommit(commit) {
69
70
  });
70
71
  }
71
72
  exports.readCommit = readCommit;
73
+ function sshGitUrl(app) {
74
+ return `git@${command_1.vars.gitHost}:${app}.git`;
75
+ }
76
+ exports.sshGitUrl = sshGitUrl;
77
+ function gitUrl(app) {
78
+ return `https://${command_1.vars.httpGitHost}/${app}.git`;
79
+ }
80
+ exports.gitUrl = gitUrl;
81
+ async function listRemotes() {
82
+ return runGit('remote', '-v').then(remotes => remotes.trim().split('\n').map(r => r.split(/\s/)));
83
+ }
84
+ exports.listRemotes = listRemotes;
85
+ function inGitRepo() {
86
+ try {
87
+ fs.lstatSync('.git');
88
+ return true;
89
+ }
90
+ catch (error) {
91
+ if (error.code !== 'ENOENT')
92
+ throw error;
93
+ }
94
+ }
95
+ exports.inGitRepo = inGitRepo;
96
+ function rmRemote(remote) {
97
+ return runGit('remote', 'rm', remote);
98
+ }
99
+ exports.rmRemote = rmRemote;
100
+ function hasGitRemote(remote) {
101
+ return runGit('remote')
102
+ .then(remotes => remotes.split('\n'))
103
+ .then(remotes => remotes.find(r => r === remote));
104
+ }
105
+ function createRemote(remote, url) {
106
+ return hasGitRemote(remote)
107
+ .then(exists => {
108
+ if (!exists) {
109
+ return runGit('remote', 'add', remote, url);
110
+ }
111
+ return null;
112
+ });
113
+ }
114
+ exports.createRemote = createRemote;
@@ -1,3 +1,3 @@
1
- import { Command } from '@heroku-cli/command';
2
- export declare function disambiguatePipeline(pipelineIDOrName: any, command: Command): Promise<any>;
3
- export declare function getPipeline(flags: any, command: Command): Promise<any>;
1
+ import { APIClient } from '@heroku-cli/command';
2
+ export declare function disambiguatePipeline(pipelineIDOrName: any, herokuAPI: APIClient): Promise<any>;
3
+ export declare function getPipeline(flags: any, herokuAPI: APIClient): Promise<any>;
@@ -3,18 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPipeline = exports.disambiguatePipeline = void 0;
4
4
  const inquirer_1 = require("inquirer");
5
5
  const validator_1 = require("validator");
6
- async function disambiguatePipeline(pipelineIDOrName, command) {
6
+ const core_1 = require("@oclif/core");
7
+ async function disambiguatePipeline(pipelineIDOrName, herokuAPI) {
7
8
  const headers = { Accept: 'application/vnd.heroku+json; version=3.pipelines' };
8
9
  if ((0, validator_1.isUUID)(pipelineIDOrName)) {
9
- const { body: pipeline } = await command.heroku.get(`/pipelines/${pipelineIDOrName}`, { headers });
10
+ const { body: pipeline } = await herokuAPI.get(`/pipelines/${pipelineIDOrName}`, { headers });
10
11
  return pipeline;
11
12
  }
12
- const { body: pipelines } = await command.heroku.get(`/pipelines?eq[name]=${pipelineIDOrName}`, { headers });
13
+ const { body: pipelines } = await herokuAPI.get(`/pipelines?eq[name]=${pipelineIDOrName}`, { headers });
13
14
  let choices;
14
15
  let questions;
15
16
  switch (pipelines.length) {
16
17
  case 0:
17
- command.error('Pipeline not found');
18
+ core_1.ux.error('Pipeline not found');
18
19
  break;
19
20
  case 1:
20
21
  return pipelines[0];
@@ -32,24 +33,24 @@ async function disambiguatePipeline(pipelineIDOrName, command) {
32
33
  }
33
34
  }
34
35
  exports.disambiguatePipeline = disambiguatePipeline;
35
- async function getPipeline(flags, command) {
36
+ async function getPipeline(flags, herokuAPI) {
36
37
  let pipeline;
37
38
  if ((!flags.pipeline) && (!flags.app)) {
38
- command.error('Required flag: --pipeline PIPELINE or --app APP');
39
+ core_1.ux.error('Required flag: --pipeline PIPELINE or --app APP');
39
40
  }
40
41
  if (flags && flags.pipeline) {
41
- pipeline = await disambiguatePipeline(flags.pipeline, command);
42
+ pipeline = await disambiguatePipeline(flags.pipeline, herokuAPI);
42
43
  if (pipeline.pipeline) {
43
44
  pipeline = pipeline.pipeline;
44
45
  } // in case prompt returns an object like { pipeline: { ... } }
45
46
  }
46
47
  else {
47
- const { body: coupling } = await command.heroku.get(`/apps/${flags.app}/pipeline-couplings`);
48
+ const { body: coupling } = await herokuAPI.get(`/apps/${flags.app}/pipeline-couplings`);
48
49
  if ((coupling) && (coupling.pipeline)) {
49
50
  pipeline = coupling.pipeline;
50
51
  }
51
52
  else {
52
- command.error(`No pipeline found with application ${flags.app}`);
53
+ core_1.ux.error(`No pipeline found with application ${flags.app}`);
53
54
  }
54
55
  }
55
56
  return pipeline;
@@ -1,5 +1,6 @@
1
1
  import { Command } from '@heroku-cli/command';
2
2
  import * as Heroku from '@heroku-cli/schema';
3
3
  export declare function renderList(command: Command, testRuns: Heroku.TestRun[], pipeline: Heroku.Pipeline, watchOption: boolean, jsonOption: boolean): Promise<void>;
4
+ export declare function waitForStates(states: string[], testRun: Heroku.TestRun, command: Command): Promise<Heroku.TestRun>;
4
5
  export declare function displayAndExit(pipeline: Heroku.Pipeline, number: number, command: Command): Promise<void>;
5
6
  export declare function displayTestRunInfo(command: Command, testRun: Heroku.TestRun, testNodes: Heroku.TestNode[], nodeArg: string | undefined): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.displayTestRunInfo = exports.displayAndExit = exports.renderList = void 0;
3
+ exports.displayTestRunInfo = exports.displayAndExit = exports.waitForStates = exports.renderList = void 0;
4
4
  const color_1 = require("@heroku-cli/color");
5
5
  const core_1 = require("@oclif/core");
6
6
  const https_1 = require("https");
@@ -167,6 +167,7 @@ async function waitForStates(states, testRun, command) {
167
167
  }
168
168
  return newTestRun;
169
169
  }
170
+ exports.waitForStates = waitForStates;
170
171
  async function display(pipeline, number, command) {
171
172
  let { body: testRun } = await command.heroku.get(`/pipelines/${pipeline.id}/test-runs/${number}`);
172
173
  if (testRun) {
@@ -0,0 +1,2 @@
1
+ import { ParserOutput } from '@oclif/core/lib/interfaces/parser';
2
+ export declare const validateArgvPresent: (argv: ParserOutput['argv'], isUnset?: boolean) => void;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateArgvPresent = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const validateArgvPresent = (argv, isUnset = false) => {
6
+ if (argv.length === 0) {
7
+ core_1.ux.error(`Usage: heroku ci:config:${isUnset ? 'unset' : 'set'} KEY1 [KEY2 ...]\nMust specify KEY to ${isUnset ? 'unset' : 'set'}.`, { exit: 1 });
8
+ }
9
+ };
10
+ exports.validateArgvPresent = validateArgvPresent;
@@ -5,4 +5,15 @@ export default class Git {
5
5
  httpGitUrl(app: string): string;
6
6
  remoteUrl(name: string): Promise<string>;
7
7
  url(app: string): string;
8
+ getBranch(symbolicRef: string): Promise<string>;
9
+ getRef(branch: string): Promise<string>;
10
+ getCommitTitle(ref: string): Promise<string>;
11
+ readCommit(commit: string): Promise<{
12
+ branch: string;
13
+ ref: string;
14
+ message: string;
15
+ }>;
16
+ inGitRepo(): true | undefined;
17
+ hasGitRemote(remote: string): Promise<boolean>;
18
+ createRemote(remote: string, url: string): Promise<string | null>;
8
19
  }