Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@
"lint": "eslint . --ext .ts --config .eslintrc.cjs",
"lint:fix": "eslint . --ext .ts --config .eslintrc.cjs --fix --quiet",
"lint:fix:all": "eslint . --ext .ts --config .eslintrc.cjs --fix",
"coverage": "c8 --reporter=lcov --reporter=text-summary npm run test",
"coverage:html": "c8 --reporter=html --reporter=text-summary npm run test",
"coverage": "c8 --all --reporter=lcov --reporter=text-summary npm run test",
"coverage:html": "c8 --all --reporter=html --reporter=text-summary npm run test",
"create-shrinkwrap": "npm shrinkwrap",
"prepublishOnly": "npm run create-shrinkwrap",
"postpublish": "rm -f oclif.manifest.json",
Expand Down
3 changes: 0 additions & 3 deletions src/commands/pipelines/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ export default class PipelinesAdd extends Command {
required: true,
}),
}

static description = `add this app to a pipeline
The app and pipeline names must be specified.
The stage of the app will be guessed based on its name if not specified.`

static examples = [
color.command('heroku pipelines:add my-pipeline -a my-app -s production'),
]

static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
Expand Down
3 changes: 0 additions & 3 deletions src/commands/pipelines/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ export default class Connect extends Command {
required: true,
}),
}

static description = 'connect a GitHub repo to an existing pipeline'

static examples = [
color.command('heroku pipelines:connect my-pipeline -r githuborg/reponame'),
]

static flags = {
repo: flags.string({
char: 'r',
Expand Down
3 changes: 0 additions & 3 deletions src/commands/pipelines/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@ export default class Create extends Command {
required: false,
}),
}

static description = `create a new pipeline
An existing app must be specified as the first app in the pipeline.
The pipeline name will be inferred from the app name if not specified.
The stage of the app will be guessed based on its name if not specified.
The pipeline owner will be the user creating the pipeline if not specified with -t for teams or -o for orgs.`

static examples = [
color.command('heroku pipelines:create -a my-app-staging'),
color.command('heroku pipelines:create my-pipeline -a my-app-staging'),
]

static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
Expand Down
2 changes: 0 additions & 2 deletions src/commands/pipelines/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export default class PipelinesDestroy extends Command {
required: true,
}),
}

static description = 'destroy a pipeline'

static examples = [
color.command('heroku pipelines:destroy my-pipeline'),
]
Expand Down
13 changes: 4 additions & 9 deletions src/commands/pipelines/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ const PROMOTION_ORDER = ['development', 'staging', 'production']

export default class PipelinesDiff extends Command {
static description = 'compares the latest release of this app to its downstream app(s)'

static examples = [
color.command('heroku pipelines:diff -a my-app-staging'),
]

static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
}

getAppInfo = async (appName: string, appId: string, generation: GenerationKind): Promise<AppInfo> => {
// Find GitHub connection for the app
const githubApp = await this.kolkrabbi.getAppLink(appId)
Expand Down Expand Up @@ -70,7 +67,6 @@ export default class PipelinesDiff extends Command {

return {hash: commit, name: appName, repo: githubApp.repo}
}

kolkrabbi: KolkrabbiAPI = new KolkrabbiAPI(this.config.userAgent, () => this.heroku.auth)

async run() {
Expand Down Expand Up @@ -113,11 +109,12 @@ export default class PipelinesDiff extends Command {

// Fetch GitHub repo/latest release hash for [target, downstream[0], .., downstream[n]] apps
const appInfoPromises = [this.getAppInfo(targetAppName, targetAppId, generation)]
downstreamApps.forEach(app => {
for (const app of downstreamApps) {
if (app.name && app.id) {
appInfoPromises.push(this.getAppInfo(app.name, app.id, generation))
}
})
}

ux.action.start('Fetching release info for all apps')
const appInfo = await Promise.all(appInfoPromises)
ux.action.stop()
Expand All @@ -138,9 +135,7 @@ export default class PipelinesDiff extends Command {
// Diff [{target, downstream[0]}, {target, downstream[1]}, .., {target, downstream[n]}]
const downstreamAppsInfo = appInfo.slice(1)
for (const downstreamAppInfo of downstreamAppsInfo) {
await diff(
targetAppInfo, downstreamAppInfo, githubAccount.github.token, this.config.userAgent,
)
await diff(targetAppInfo, downstreamAppInfo, githubAccount.github.token, this.config.userAgent)
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/commands/pipelines/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import {ux} from '@oclif/core/ux'

export default class Pipelines extends Command {
static description = 'list pipelines you have access to'

static examples = [
color.command('heroku pipelines'),
]

static flags = {
json: flags.boolean({description: 'output in json format'}),
}
Expand Down
5 changes: 1 addition & 4 deletions src/commands/pipelines/info.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {color, hux} from '@heroku/heroku-cli-util'
import {Command, flags} from '@heroku-cli/command'
import * as Heroku from '@heroku-cli/schema'
import {color, hux} from '@heroku/heroku-cli-util'
import {Args} from '@oclif/core'

import {listPipelineApps} from '../../lib/api.js'
Expand All @@ -14,13 +14,10 @@ export default class PipelinesInfo extends Command {
required: true,
}),
}

static description = 'show list of apps in a pipeline'

static examples = [
color.command('heroku pipelines:info my-pipeline'),
]

static flags = {
json: flags.boolean({
description: 'output in json format',
Expand Down
2 changes: 0 additions & 2 deletions src/commands/pipelines/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export default class Open extends Command {
static args = {
pipeline: Args.string({description: 'name of pipeline', required: true}),
}

static description = 'open a pipeline in dashboard'

static examples = [color.command('heroku pipelines:open my-pipeline')]

async run() {
Expand Down
14 changes: 5 additions & 9 deletions src/commands/pipelines/promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {APIClient, Command, flags} from '@heroku-cli/command'
import * as Heroku from '@heroku-cli/schema'
import {color, hux} from '@heroku/heroku-cli-util'
import {ux} from '@oclif/core/ux'
import assert from 'assert'
import fetch from 'node-fetch'
import * as Stream from 'stream'
import * as util from 'util'
import assert from 'node:assert'
import * as Stream from 'node:stream'
import {promisify} from 'node:util'

import {AppWithPipelineCoupling, listPipelineApps} from '../../lib/api.js'
import keyBy from '../../lib/pipelines/key-by.js'
Expand All @@ -27,11 +27,9 @@ const wait = (ms = 100) => new Promise(resolve => setTimeout(resolve, ms))

export default class Promote extends Command {
static description = 'promote the latest release of this app to its downstream app(s)'

static examples = [
color.command('heroku pipelines:promote -a my-app-staging'),
]

static flags = {
app: flags.app({
required: true,
Expand Down Expand Up @@ -89,9 +87,7 @@ export default class Promote extends Command {
promotionActionName = `Starting promotion to ${targetStage}`
}

const promotion = await promote(
this.heroku, promotionActionName, coupling.pipeline!.id!, coupling.app!.id!, targetApps,
)
const promotion = await promote(this.heroku, promotionActionName, coupling.pipeline!.id!, coupling.app!.id!, targetApps)

const pollLoop = pollPromotionStatus(this.heroku, promotion.id!, true)
ux.stdout('Waiting for promotion to complete...')
Expand Down Expand Up @@ -228,7 +224,7 @@ async function streamReleaseCommand(heroku: APIClient, targets: Array<Heroku.App
ux.stdout('Running release command...')

async function streamReleaseOutput(releaseStreamUrl: string) {
const finished = util.promisify(Stream.finished)
const finished = promisify(Stream.finished)
const fetchResponse = await fetch(releaseStreamUrl)

if (fetchResponse.status >= 400) {
Expand Down
2 changes: 0 additions & 2 deletions src/commands/pipelines/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import {removeCoupling} from '../../lib/api.js'

export default class PipelinesRemove extends Command {
static description = 'remove this app from its pipeline'

static examples = [
color.command('heroku pipelines:remove -a my-app'),
]

static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
Expand Down
2 changes: 0 additions & 2 deletions src/commands/pipelines/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export default class PipelinesRename extends Command {
}),
}
/* eslint-enable perfectionist/sort-objects */

static description = 'rename a pipeline'

static examples = [
color.command('heroku pipelines:rename my-pipeline new-pipeline-name'),
]
Expand Down
13 changes: 3 additions & 10 deletions src/commands/pipelines/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as color from '@heroku/heroku-cli-util/color'

import {Command, flags} from '@heroku-cli/command'
import * as color from '@heroku/heroku-cli-util/color'
import {Args, ux} from '@oclif/core'
import debug from 'debug'
import openBrowser from 'open'
Expand All @@ -16,7 +15,7 @@ import getRepo from '../../lib/pipelines/setup/get-repo.js'
import getSettings from '../../lib/pipelines/setup/get-settings.js'
import pollAppSetups from '../../lib/pipelines/setup/poll-app-setups.js'
import setupPipeline from '../../lib/pipelines/setup/setup-pipeline.js'
import {STAGING_APP_INDICATOR, nameAndRepo} from '../../lib/pipelines/setup/validate.js'
import {nameAndRepo, STAGING_APP_INDICATOR} from '../../lib/pipelines/setup/validate.js'

const pipelineDebug = debug('pipelines:setup')

Expand All @@ -31,12 +30,9 @@ export default class Setup extends Command {
required: false,
}),
}

static description
= 'bootstrap a new pipeline with common settings and create a production and staging app (requires a fully formed app.json in the repo)'

static examples = [color.command('heroku pipelines:setup my-pipeline githuborg/reponame -t my-team')]

static flags = {
team: flags.team({
description: 'the team to assign pipeline ownership to (defaults to current user)',
Expand All @@ -47,7 +43,6 @@ export default class Setup extends Command {
description: 'accept all default settings without prompting',
}),
}

static open = openBrowser

async run() {
Expand Down Expand Up @@ -92,9 +87,7 @@ export default class Setup extends Command {
const appSetupsResult: any = await createApps(this.heroku, archiveURL, pipeline, pipelineName, stagingAppName, team)
const appSetups = appSetupsResult.map((result: any) => result.body)

ux.action.start(
`Creating production and staging apps (${color.app(pipelineName)} and ${color.app(stagingAppName)})`,
)
ux.action.start(`Creating production and staging apps (${color.app(pipelineName)} and ${color.app(stagingAppName)})`)
await pollAppSetups(this.heroku, appSetups)
ux.action.stop()

Expand Down
5 changes: 1 addition & 4 deletions src/commands/pipelines/transfer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {color, hux} from '@heroku/heroku-cli-util'
import {APIClient, Command, flags} from '@heroku-cli/command'
import {color, hux} from '@heroku/heroku-cli-util'
import {Args, ux} from '@oclif/core'

import {
Expand Down Expand Up @@ -36,14 +36,11 @@ export default class PipelinesTransfer extends Command {
required: true,
}),
}

static description = 'transfer ownership of a pipeline'

static examples = [
color.command('heroku pipelines:transfer admin@example.com -p my-pipeline'),
color.command('heroku pipelines:transfer admin-team -p my-pipeline'),
]

static flags = {
confirm: flags.string({char: 'c'}),
pipeline: flags.pipeline({required: true}),
Expand Down
2 changes: 0 additions & 2 deletions src/commands/pipelines/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import {updateCoupling} from '../../lib/api.js'

export default class PipelinesUpdate extends Command {
static description = 'update the app\'s stage in a pipeline'

static examples = [
color.command('heroku pipelines:update -s staging -a my-app'),
]

static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
Expand Down
1 change: 0 additions & 1 deletion src/commands/ps/autoscale/disable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default class Disable extends Command {
app: flags.app({required: true}),
remote: flags.remote(),
}

static topic = 'ps:autoscale'

async run() {
Expand Down
7 changes: 4 additions & 3 deletions src/commands/ps/autoscale/enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default class Enable extends Command {
p95: flags.integer({description: 'desired p95 response time'}),
remote: flags.remote(),
}

static topic = 'ps:autoscale'

async run() {
Expand Down Expand Up @@ -79,11 +78,13 @@ export default class Enable extends Command {
value: flags.p95 || scaleMonitor.value,
}

await this.heroku.patch(`/apps/${app.id}/formation/web/monitors/${scaleMonitor.id}`,
await this.heroku.patch(
`/apps/${app.id}/formation/web/monitors/${scaleMonitor.id}`,
{
body: updatedValues,
hostname: METRICS_HOST,
})
},
)
} else {
updatedValues = {
...updatedValues,
Expand Down
6 changes: 1 addition & 5 deletions src/commands/ps/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Heroku from '@heroku-cli/schema'
import * as color from '@heroku/heroku-cli-util/color'
import {Args, ux} from '@oclif/core'
import fs from 'node:fs'
import * as path from 'node:path'
import path from 'node:path'

import {HerokuExec} from '../../lib/ps-exec/exec.js'
import {HerokuSsh} from '../../lib/ps-exec/ssh.js'
Expand All @@ -12,11 +12,8 @@ export default class Copy extends Command {
static args = {
file: Args.string({description: 'file to copy from dyno to local', required: true}),
}

static description = 'Copy a file from a dyno to the local filesystem'

static examples = [`${color.command('heroku ps:copy FILENAME --app murmuring-headland-14719')}`]

static flags = {
app: flags.app({required: true}),
dyno: flags.string({
Expand All @@ -29,7 +26,6 @@ export default class Copy extends Command {
}),
remote: flags.remote(),
}

static topic = 'ps'

public async run(): Promise<void> {
Expand Down
Loading
Loading