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
11 changes: 8 additions & 3 deletions lib/cherry_pick.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ export default class CherryPick {
constructor(prid, dir, cli, {
owner,
repo,
upstream,
gpgSign,
lint,
includeCVE
} = {}) {
this.prid = prid;
this.cli = cli;
this.dir = dir;
this.upstream = upstream;
this.gpgSign = gpgSign;
this.options = { owner, repo, lint, includeCVE };
}

Expand Down Expand Up @@ -88,14 +92,15 @@ export default class CherryPick {
} else if (cleanLint === LINT_RESULTS.SUCCESS) {
cli.ok('Lint passed cleanly');
}
return this.amend(metadata.metadata, commitInfo);
this.metadata = metadata.metadata;
return this.amend(commitInfo);
} catch (e) {
cli.error(e.message);
return false;
}
}

async amend(metadata, commitInfo) {
async amend(commitInfo) {
const { cli } = this;
const subjects = await runAsync('git',
['log', '--pretty=format:%s', `${commitInfo.base}..${commitInfo.head}`],
Expand All @@ -116,7 +121,7 @@ export default class CherryPick {
await runAsync('git', ['commit', '--amend', '--no-edit']);
}

return LandingSession.prototype.amend.call(this, metadata);
return LandingSession.prototype.amend.call(this);
}

readyToAmend() {
Expand Down
7 changes: 4 additions & 3 deletions lib/landing_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Session from './session.js';
import {
shortSha, isGhAvailable, getEditor
} from './utils.js';
import { debuglog, isDebugVerbosity } from './verbosity.js';

const isWindows = process.platform === 'win32';

Expand All @@ -27,9 +28,6 @@ export default class LandingSession extends Session {
this.lint = lint;
this.autorebase = autorebase;
this.fixupAll = fixupAll;
this.gpgSign = argv?.['gpg-sign']
? (argv['gpg-sign'] === true ? ['-S'] : ['-S', argv['gpg-sign']])
: [];
this.oneCommitMax = oneCommitMax;
this.expectedCommitShas = [];
this.checkCI = !!checkCI;
Expand Down Expand Up @@ -120,6 +118,9 @@ export default class LandingSession extends Session {
['cherry-pick', '--allow-empty', ...this.gpgSign, `${base}..${head}`],
{ ignoreFailure: false });
} catch (ex) {
if (isDebugVerbosity()) {
debuglog('[LandingSession] Got error', ex);
}
cli.error('Failed to apply patches');
process.exit(1);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export default class ReleasePreparation extends Session {
const cp = new CherryPick(pr.number, this.dir, cli, {
owner: this.owner,
repo: this.repo,
gpgSign: this.gpgSign,
upstream: this.isSecurityRelease ? `https://${this.username}:${this.config.token}@github.com/${this.owner}/${this.repo}.git` : this.upstream,
lint: false,
includeCVE: true
});
Expand Down
5 changes: 1 addition & 4 deletions lib/promote_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ const dryRunMessage = 'You are running in dry-run mode, meaning NCU will not run

export default class ReleasePromotion extends Session {
constructor(argv, req, cli, dir) {
super(cli, dir);
super(cli, dir, null, argv);
this.req = req;
this.dryRun = !argv.run;
this.proposalUpstreamRemote = argv.fetchFrom ?? this.upstream;
this.gpgSign = argv?.['gpg-sign']
? (argv['gpg-sign'] === true ? ['-S'] : ['-S', argv['gpg-sign']])
: [];
}

get branch() {
Expand Down
3 changes: 3 additions & 0 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export default class Session {
this.dir = dir;
this.prid = prid;
this.config = { ...getMergedConfig(this.dir), ...argv };
this.gpgSign = argv?.['gpg-sign']
? (argv['gpg-sign'] === true ? ['-S'] : ['-S', argv['gpg-sign']])
: [];

if (warnForMissing) {
const { upstream, owner, repo } = this;
Expand Down
1 change: 0 additions & 1 deletion lib/voting_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default class VotingSession extends Session {
this.abstain = abstain;
this.closeVote = argv['decrypt-key-part'];
this.postComment = argv['post-comment'];
this.gpgSign = argv['gpg-sign'];
}

get argv() {
Expand Down
Loading