Beispiel #1
0
  return co(function * () {
    let addon = yield api.request({
      method: 'GET',
      path: `/addons/${ctx.args.addon}`,
      headers: {'Accept-Expansion': 'addon_service,plan'}
    })

    addon.attachments = yield api.request({
      method: 'GET',
      path: `/addons/${addon.id}/addon-attachments`
    })

    cli.styledHeader(style('addon', addon.name))
    cli.styledHash({
      Plan: addon.plan.name,
      Price: formatPrice(addon.plan.price),
      Attachments: addon.attachments.map(function (att) {
        return [
          style('app', att.app.name),
          style('attachment', att.name)
        ].join('::')
      }).sort(),
      'Owning app': style('app', addon.app.name),
      'Installed at': (new Date(addon.created_at)).toString()
    })
  })
Beispiel #2
0
  run: cli.command(function* (context, heroku) {
    const pipeline = yield disambiguate(heroku, context.args.pipeline);

    const apps = yield listPipelineApps(heroku, pipeline.id);

    // Sort Apps by stage, name
    // Display in table
    let stages={};
    for (let app in apps) {
      if (apps.hasOwnProperty(app)) {
        let stage = apps[app].coupling.stage;
        if(stages[stage]) {
          stages[apps[app].coupling.stage].push(apps[app].name);
        } else {
          stages[apps[app].coupling.stage] = [apps[app].name];
        }
      }
    }

    if (context.flags.json) {
      cli.styledJSON({pipeline, apps});
    } else {
      cli.styledHeader(pipeline.name);
      cli.styledHash(stages, stageNames);
    }
  })
Beispiel #3
0
    ]).then(co.wrap(function * (answers) {
      for (let key in answers) {
        data[key] = answers[key]
      }

      yield cli.action('setting database parameters', co(function * () {
        let url = '/api/v3/connections/' + connection.id
        yield api.request(context, 'PATCH', url, data)
      }))

      cli.styledHash(data)
    }))
Beispiel #4
0
  run: cli.command(function* (context, heroku) {
    const app = context.app;
    const coupling = yield getCoupling(heroku, app);
    const allApps = yield getApps(heroku, coupling.pipeline);
    const sourceStage = coupling.stage;

    let promotionActionName = '';
    let targetApps = [];
    if (context.flags && context.flags.to) {
      // The user specified a specific set of apps they want to target
      // We don't have to infer the apps or the stage they want to promote to

      // Strip out any empty app names due to something like a trailing comma
      const targetAppNames = context.flags.to.split(',').filter((appName) => appName.length >= 1);

      // Now let's make sure that we can find every target app they specified
      // The only requirement is that the app be in this pipeline. They can be at any stage.
      targetApps = targetAppNames.map((targetAppNameOrId) => {
        assertNotPromotingToSelf(app, targetAppNameOrId);
        return findAppInPipeline(allApps, targetAppNameOrId);
      });

      promotionActionName = `Starting promotion to apps: ${targetAppNames.toString()}`;
    } else {
      const targetStage = PROMOTION_ORDER[PROMOTION_ORDER.indexOf(sourceStage) + 1];

      assertValidPromotion(app, sourceStage, targetStage);

      targetApps = allApps.filter((app) => app.coupling.stage === targetStage);

      assertApps(app, targetApps, targetStage);

      promotionActionName = `Starting promotion to ${targetStage}`;
    }

    const promotion = yield promote(
      heroku, promotionActionName, coupling.pipeline.id, coupling.app.id, targetApps
    );

    const pollLoop = pollPromotionStatus(heroku, promotion.id);
    const promotionTargets = yield cli.action('Waiting for promotion to complete', pollLoop);

    const appsByID = keyBy(allApps, 'id');

    const styledTargets = promotionTargets.reduce(function(memo, target) {
      const app = appsByID[target.app.id];
      const details = [target.status];

      if (isFailed(target)) { details.push(target.error_message); }

      memo[app.name] = details;
      return memo;
    }, {});

    if (promotionTargets.every(isSucceeded)) {
      cli.log('\nPromotion successful');
    } else {
      cli.warn('\nPromotion to some apps failed');
    }

    cli.styledHash(styledTargets);
  })