Skip to content

Commit

Permalink
Merge pull request #63 from Microsoft/users/jeyou/fastlane-uninstall-…
Browse files Browse the repository at this point in the history
…arg-fixes

Uninstall fastlane for specific version install, fix deliver args
  • Loading branch information
Jeff Young authored Mar 7, 2017
2 parents ecd3d01 + 3ff6509 commit cffc71d
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Allows you to promote an app previously updated to iTunes Connect to the App Sto

4. **fastlane Version** - **Latest Version** or **Specific Version**. If *Specific Version* is chosen, you must provide a value for *fastlane Specific Version*.

5. **fastlane Specific Version** *(String)* - The version of fastlane to install (e.g., 2.15.1).
5. **fastlane Specific Version** *(String)* - The version of fastlane to install (e.g., 2.15.1). If a specific version of fastlane is installed, all previously installed versions will be uninstalled beforehand.

## Firewall Issues

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"loc.input.label.fastlaneToolsVersion": "fastlane Version",
"loc.input.help.fastlaneToolsVersion": "Choose to install either the lastest version of fastlane or a specific version.",
"loc.input.label.fastlaneToolsSpecificVersion": "fastlane Specific Version",
"loc.input.help.fastlaneToolsSpecificVersion": "Provide the version of fastlane to install (e.g., 2.15.1).",
"loc.input.help.fastlaneToolsSpecificVersion": "Provide the version of fastlane to install (e.g., 2.15.1). If a specific version of fastlane is installed, all previously installed versions will be uninstalled beforehand.",
"loc.messages.DarwinOnly": "The Apple App Store Promote task can only run on a Mac computer.",
"loc.messages.SuccessfullySubmitted": "Build successfully submitted for review."
}
11 changes: 6 additions & 5 deletions Tasks/app-store-promote/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('app-store-promote L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.invokedToolCount === 1, 'should have only run fastlane pilot.');
assert(tr.invokedToolCount === 1, 'should have only run fastlane deliver.');
assert(tr.succeeded, 'task should have succeeded');

done();
Expand All @@ -66,8 +66,9 @@ describe('app-store-promote L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('/usr/bin/gem uninstall fastlane -a -I'), 'gem uninstall fastlane should have been run.');
assert(tr.ran('/usr/bin/gem install fastlane -v 2.15.1'), 'gem install fastlane with a specific version should have been run.');
assert(tr.invokedToolCount === 2, 'should have run only gem install and fastlane pilot.');
assert(tr.invokedToolCount === 3, 'should have run gem uninstall, gem install and fastlane deliver.');
assert(tr.succeeded, 'task should have succeeded');

done();
Expand Down Expand Up @@ -162,7 +163,7 @@ describe('app-store-promote L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -q teamId --force'), 'fastlane deliver with team id should have been run.');
assert(tr.ran('fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -k teamId --force'), 'fastlane deliver with team id should have been run.');
assert(tr.invokedToolCount === 3, 'should have run gem install, gem update and fastlane deliver.');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand All @@ -177,7 +178,7 @@ describe('app-store-promote L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -r teamName --force'), 'fastlane deliver with team name should have been run.');
assert(tr.ran('fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -e teamName --force'), 'fastlane deliver with team name should have been run.');
assert(tr.invokedToolCount === 3, 'should have run gem install, gem update and fastlane deliver.');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand All @@ -192,7 +193,7 @@ describe('app-store-promote L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -q teamId -r teamName --force'), 'fastlane deliver with team id and team name should have been run.');
assert(tr.ran('fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -k teamId -e teamName --force'), 'fastlane deliver with team id and team name should have been run.');
assert(tr.invokedToolCount === 3, 'should have run gem install, gem update and fastlane deliver.');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand Down
4 changes: 4 additions & 0 deletions Tasks/app-store-promote/Tests/L0SpecificFastlaneInstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ let myAnswers: string = `{
"/usr/bin/fastlane": true
},
"exec": {
"/usr/bin/gem uninstall fastlane -a -I": {
"code": 0,
"stdout": "Successfully uninstalled fastlane-2.15.1"
},
"/usr/bin/gem install fastlane -v 2.15.1": {
"code": 0,
"stdout": "1 gem installed"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/app-store-promote/Tests/L0TeamId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let myAnswers: string = `{
"code": 0,
"stdout": "1 gem installed"
},
"fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -q teamId --force": {
"fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -k teamId --force": {
"code": 0,
"stdout": "consider it delivered!"
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/app-store-promote/Tests/L0TeamIdTeamName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let myAnswers: string = `{
"code": 0,
"stdout": "1 gem installed"
},
"fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -q teamId -r teamName --force": {
"fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -k teamId -e teamName --force": {
"code": 0,
"stdout": "consider it delivered!"
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/app-store-promote/Tests/L0TeamName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let myAnswers: string = `{
"code": 0,
"stdout": "1 gem installed"
},
"fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -r teamName --force": {
"fastlane deliver submit_build -u creds-username -a com.microsoft.test.appId --skip_binary_upload true --skip_metadata true --skip_screenshots true -e teamName --force": {
"code": 0,
"stdout": "consider it delivered!"
}
Expand Down
15 changes: 12 additions & 3 deletions Tasks/app-store-promote/app-store-promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ async function run() {
tl.debug('Checking for ruby install...');
tl.which('ruby', true);

//Whenever a specific version of fastlane is requested, we're going to uninstall all installed
//versions of fastlane beforehand. Note that this doesn't uninstall dependencies of fastlane.
if (installFastlane && fastlaneVersionToInstall) {
let gemRunner: ToolRunner = tl.tool(tl.which('gem', true));
gemRunner.arg(['uninstall', 'fastlane']);
tl.debug(`Uninstalling all fastlane versions...`);
gemRunner.arg(['-a', '-I']); //uninstall all versions
await gemRunner.exec();
}
// If desired, install the fastlane tools (if they're already present, should be a no-op)
if (installFastlane) {
tl.debug('Installing fastlane...');
Expand All @@ -95,16 +104,16 @@ async function run() {
}

//Run the deliver command
// See https://github.com/fastlane/deliver for more information on these arguments
// See https://github.com/fastlane/fastlane/blob/master/deliver/lib/deliver/options.rb for more information on these arguments
let deliverCommand: ToolRunner = tl.tool('fastlane');
deliverCommand.arg(['deliver', 'submit_build', '-u', credentials.username, '-a', appIdentifier]);
if (chooseBuild.toLowerCase() === 'specify') {
deliverCommand.arg(['-n', buildNumber]);
}
deliverCommand.arg(['--skip_binary_upload', 'true', '--skip_metadata', 'true', '--skip_screenshots', 'true']);
deliverCommand.argIf(shouldAutoRelease, '--automatic_release');
deliverCommand.argIf(teamId, ['-q', teamId]);
deliverCommand.argIf(teamName, ['-r', teamName]);
deliverCommand.argIf(teamId, ['-k', teamId]);
deliverCommand.argIf(teamName, ['-e', teamName]);
deliverCommand.arg('--force');

await deliverCommand.exec();
Expand Down
4 changes: 2 additions & 2 deletions Tasks/app-store-promote/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"demands": [ "xcode" ],
"version": {
"Major": "1",
"Minor": "114",
"Minor": "115",
"Patch": "0"
},
"minimumAgentVersion": "1.95.3",
Expand Down Expand Up @@ -149,7 +149,7 @@
"defaultValue": "",
"required": true,
"groupName": "advanced",
"helpMarkDown": "Provide the version of fastlane to install (e.g., 2.15.1).",
"helpMarkDown": "Provide the version of fastlane to install (e.g., 2.15.1). If a specific version of fastlane is installed, all previously installed versions will be uninstalled beforehand.",
"visibleRule": "fastlaneToolsVersion = SpecificVersion"
}
],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/app-store-promote/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"version": {
"Major": "1",
"Minor": "114",
"Minor": "115",
"Patch": "0"
},
"minimumAgentVersion": "1.95.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"loc.input.label.fastlaneToolsVersion": "fastlane Version",
"loc.input.help.fastlaneToolsVersion": "Choose to install either the lastest version of fastlane or a specific version.",
"loc.input.label.fastlaneToolsSpecificVersion": "fastlane Specific Version",
"loc.input.help.fastlaneToolsSpecificVersion": "Provide the version of fastlane to install (e.g., 2.15.1).",
"loc.input.help.fastlaneToolsSpecificVersion": "Provide the version of fastlane to install (e.g., 2.15.1). If a specific version of fastlane is installed, all previously installed versions will be uninstalled beforehand.",
"loc.messages.DarwinOnly": "The Apple App Store Release task can only run on a Mac computer.",
"loc.messages.SuccessfullyPublished": "Successfully published to %s",
"loc.messages.NoIpaFilesFound": "No IPA file found using pattern: %s",
Expand Down
9 changes: 5 additions & 4 deletions Tasks/app-store-release/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ describe('app-store-release L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('/usr/bin/gem uninstall fastlane -a -I'), 'gem uninstall fastlane should have been run.');
assert(tr.ran('/usr/bin/gem install fastlane -v 2.15.1'), 'gem install fastlane with a specific version should have been run.');
assert(tr.invokedToolCount === 2, 'should have run only gem install and fastlane pilot.');
assert(tr.invokedToolCount === 3, 'should have run gem uninstall, gem install and fastlane pilot.');
assert(tr.succeeded, 'task should have succeeded');

done();
Expand Down Expand Up @@ -335,7 +336,7 @@ describe('app-store-release L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -q teamId'), 'fastlane deliver with teamId should have been run.');
assert(tr.ran('fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -k teamId'), 'fastlane deliver with teamId should have been run.');
assert(tr.invokedToolCount === 3, 'should have run gem install, gem update and fastlane deliver.');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand All @@ -350,7 +351,7 @@ describe('app-store-release L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -r teamName'), 'fastlane deliver with teamName should have been run.');
assert(tr.ran('fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -e teamName'), 'fastlane deliver with teamName should have been run.');
assert(tr.invokedToolCount === 3, 'should have run gem install, gem update and fastlane deliver.');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand All @@ -365,7 +366,7 @@ describe('app-store-release L0 Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran('fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -q teamId -r teamName'), 'fastlane deliver with teamId and teamName should have been run.');
assert(tr.ran('fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -k teamId -e teamName'), 'fastlane deliver with teamId and teamName should have been run.');
assert(tr.invokedToolCount === 3, 'should have run gem install, gem update and fastlane deliver.');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand Down
2 changes: 1 addition & 1 deletion Tasks/app-store-release/Tests/L0ProductionTeamId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let myAnswers: string = `{
"code": 0,
"stdout": "1 gem installed"
},
"fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -q teamId": {
"fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -k teamId": {
"code": 0,
"stdout": "consider it delivered!"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ let myAnswers: string = `{
"code": 0,
"stdout": "1 gem installed"
},
"fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -q teamId -r teamName": {
"fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -k teamId -e teamName": {
"code": 0,
"stdout": "consider it delivered!"
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/app-store-release/Tests/L0ProductionTeamName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let myAnswers: string = `{
"code": 0,
"stdout": "1 gem installed"
},
"fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -r teamName": {
"fastlane deliver --force -u creds-username -a com.microsoft.test.appId -i mypackage.ipa --skip_metadata true --skip_screenshots true -e teamName": {
"code": 0,
"stdout": "consider it delivered!"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ let myAnswers: string = `{
]
},
"exec": {
"/usr/bin/gem uninstall fastlane -a -I": {
"code": 0,
"stdout": "Successfully uninstalled fastlane-2.15.1"
},
"/usr/bin/gem install fastlane -v 2.15.1": {
"code": 0,
"stdout": "1 gem installed"
Expand Down
15 changes: 12 additions & 3 deletions Tasks/app-store-release/app-store-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ async function run() {
tl.debug('Checking for ruby install...');
tl.which('ruby', true);

//Whenever a specific version of fastlane is requested, we're going to uninstall all installed
//versions of fastlane beforehand. Note that this doesn't uninstall dependencies of fastlane.
if (installFastlane && fastlaneVersionToInstall) {
let gemRunner: ToolRunner = tl.tool(tl.which('gem', true));
gemRunner.arg(['uninstall', 'fastlane']);
tl.debug(`Uninstalling all fastlane versions...`);
gemRunner.arg(['-a', '-I']); //uninstall all versions
await gemRunner.exec();
}
// If desired, install the fastlane tools (if they're already present, should be a no-op)
if (installFastlane) {
tl.debug('Installing fastlane...');
Expand Down Expand Up @@ -141,7 +150,7 @@ async function run() {
} else if (releaseTrack === 'Production') {
let bundleIdentifier: string = tl.getInput('appIdentifier', true);
// Run deliver (via fastlane) to publish to Production track
// See https://github.com/fastlane/deliver for more information on these arguments
// See https://github.com/fastlane/fastlane/blob/master/deliver/lib/deliver/options.rb for more information on these arguments
let deliverCommand: ToolRunner = tl.tool('fastlane');
deliverCommand.arg(['deliver', '--force', '-u', credentials.username, '-a', bundleIdentifier, '-i', ipaPath]);
deliverCommand.argIf(skipBinaryUpload, ['--skip_binary_upload', 'true']);
Expand All @@ -157,8 +166,8 @@ async function run() {
} else {
deliverCommand.arg(['--skip_screenshots', 'true']);
}
deliverCommand.argIf(teamId, ['-q', teamId]);
deliverCommand.argIf(teamName, ['-r', teamName]);
deliverCommand.argIf(teamId, ['-k', teamId]);
deliverCommand.argIf(teamName, ['-e', teamName]);
deliverCommand.argIf(shouldSubmitForReview, ['--submit_for_review', 'true']);
deliverCommand.argIf(shouldAutoRelease, ['--automatic_release', 'true']);
await deliverCommand.exec();
Expand Down
4 changes: 2 additions & 2 deletions Tasks/app-store-release/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"demands": [ "xcode" ],
"version": {
"Major": "1",
"Minor": "114",
"Minor": "115",
"Patch": "0"
},
"minimumAgentVersion": "1.95.3",
Expand Down Expand Up @@ -243,7 +243,7 @@
"defaultValue": "",
"required": true,
"groupName": "advanced",
"helpMarkDown": "Provide the version of fastlane to install (e.g., 2.15.1).",
"helpMarkDown": "Provide the version of fastlane to install (e.g., 2.15.1). If a specific version of fastlane is installed, all previously installed versions will be uninstalled beforehand.",
"visibleRule": "fastlaneToolsVersion = SpecificVersion"
}
],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/app-store-release/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"version": {
"Major": "1",
"Minor": "114",
"Minor": "115",
"Patch": "0"
},
"minimumAgentVersion": "1.95.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"loc.input.label.fastlaneToolsVersion": "fastlane Version",
"loc.input.help.fastlaneToolsVersion": "Choose to install either the lastest version of fastlane or a specific version.",
"loc.input.label.fastlaneToolsSpecificVersion": "fastlane Specific Version",
"loc.input.help.fastlaneToolsSpecificVersion": "Provide the version of fastlane to install (e.g., 2.15.1).",
"loc.input.help.fastlaneToolsSpecificVersion": "Provide the version of fastlane to install (e.g., 2.15.1). If a specific version of fastlane is installed, all previously installed versions will be uninstalled beforehand.",
"loc.messages.DarwinOnly": "The Ipa Resign task can only run on a Mac computer.",
"loc.messages.SuccessfullyResigned": "Successfully resigned ipa %s",
"loc.messages.FailedTemporaryKeyDeletion": "Failed to delete temporary keychain created during the resign process. %s",
Expand Down
Loading

0 comments on commit cffc71d

Please sign in to comment.