Skip to content

Commit

Permalink
fix: keychain creation on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Dec 12, 2023
1 parent d12daac commit d7972be
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.10.3

# Fix:
- Keychain creation on macOS

# 0.10.2

# Fix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ class MacOsKeyChainPlugin extends ImpaktfullCliPlugin {
await processRunner.runProcess([
'security',
'import',
'"${certFile.path}"',
(certFile.path),
'-k',
fullKeyChainName,
'-P',
'"$certPassword"',
certPassword.value,
'-A'
]);
} else if (accessControlApplications.isNotEmpty) {
await processRunner.runProcess([
'security',
'import',
'"${certFile.path}"',
certFile.path,
'-k',
fullKeyChainName,
'-P',
'"$certPassword"',
certPassword.value,
for (final application in accessControlApplications) ...[
...[
'-T',
Expand All @@ -94,11 +94,11 @@ class MacOsKeyChainPlugin extends ImpaktfullCliPlugin {
await processRunner.runProcess([
'security',
'import',
'"${certFile.path}"',
certFile.path,
'-k',
fullKeyChainName,
'-P',
'"$certPassword"'
certPassword.value
]);
}
}
Expand Down
17 changes: 11 additions & 6 deletions lib/src/integrations/ci_cd/plugin/ci_cd_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,16 @@ class CiCdPlugin extends ImpaktfullPlugin {

await macOsKeyChainPlugin.createKeyChain(
keyChainName, globalKeyChainPasswordSecret);
await macOsKeyChainPlugin.unlockKeyChain(
keyChainName, globalKeyChainPasswordSecret);
await macOsKeyChainPlugin.addCertificateToKeyChain(
keyChainName, certFile, certPassword);
await onStartBuild();
await macOsKeyChainPlugin.removeKeyChain(keyChainName);
try {
await macOsKeyChainPlugin.unlockKeyChain(
keyChainName, globalKeyChainPasswordSecret);
await macOsKeyChainPlugin.addCertificateToKeyChain(
keyChainName, certFile, certPassword);
await onStartBuild();
} catch (e) {
rethrow;
} finally {
await macOsKeyChainPlugin.removeKeyChain(keyChainName);
}
}
}

0 comments on commit d7972be

Please sign in to comment.