From 08dc98e5004b7ab4237b3fba1d427b0abc8de8d1 Mon Sep 17 00:00:00 2001 From: mig Date: Mon, 12 Feb 2018 19:27:22 +0100 Subject: [PATCH 1/2] feat: Added release channel as optional sign parameter --- src/cmd/sign.js | 3 +++ src/program.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/cmd/sign.js b/src/cmd/sign.js index 3453def0d4..c5f07a46f7 100644 --- a/src/cmd/sign.js +++ b/src/cmd/sign.js @@ -30,6 +30,7 @@ export type SignParams = {| sourceDir: string, timeout: number, verbose?: boolean, + channel?: string, |}; export type SignOptions = { @@ -57,6 +58,7 @@ export default function sign( sourceDir, timeout, verbose, + channel, }: SignParams, { build = defaultBuilder, @@ -118,6 +120,7 @@ export default function sign( xpiPath: buildResult.extensionPath, version: manifestData.version, downloadDir: artifactsDir, + channel, }); if (signingResult.id) { diff --git a/src/program.js b/src/program.js index cf24d172aa..ed8052b37f 100644 --- a/src/program.js +++ b/src/program.js @@ -412,6 +412,11 @@ Example: $0 --help run. describe: 'Number of milliseconds to wait before giving up', type: 'number', }, + 'channel': { + describe: 'The channel for which to sign the addon. Either ' + + '\'listed\' or \'unlisted\'', + type: 'string', + }, }) .command('run', 'Run the extension', commands.run, { 'target': { From 0892ee44964c7dc4bac3ef78939512b5a4a57dc2 Mon Sep 17 00:00:00 2001 From: mig Date: Mon, 12 Feb 2018 22:38:48 +0100 Subject: [PATCH 2/2] test: Added channel parameter passing to signer --- tests/unit/test-cmd/test.sign.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/unit/test-cmd/test.sign.js b/tests/unit/test-cmd/test.sign.js index 4f1cd26646..360df168f9 100644 --- a/tests/unit/test-cmd/test.sign.js +++ b/tests/unit/test-cmd/test.sign.js @@ -288,6 +288,34 @@ describe('sign', () => { } )); + it('passes the channel parameter to the signer', () => withTempDir( + (tmpDir) => { + const stubs = getStubs(); + const artifactsDir = path.join(tmpDir.path(), 'some-artifacts-dir'); + const applications: ExtensionManifestApplications = + stubs.preValidatedManifest.applications || {gecko: {}}; + return sign(tmpDir, stubs, {extraArgs: { + artifactsDir, + channel: 'unlisted', + }}) + .then(() => { + sinon.assert.called(stubs.signAddon); + sinon.assert.calledWithMatch(stubs.signAddon, { + apiKey: stubs.signingConfig.apiKey, + apiProxy: stubs.signingConfig.apiProxy, + apiSecret: stubs.signingConfig.apiSecret, + apiUrlPrefix: stubs.signingConfig.apiUrlPrefix, + downloadDir: artifactsDir, + id: applications.gecko.id, + timeout: stubs.signingConfig.timeout, + version: stubs.preValidatedManifest.version, + xpiPath: stubs.buildResult.extensionPath, + channel: 'unlisted', + }); + }); + } + )); + it('passes the verbose flag to the signer', () => withTempDir( (tmpDir) => { const stubs = getStubs();