Skip to content

Commit d2b29bb

Browse files
authored
Allow empty certificate passphrase (#286)
* Allow empty certificate passphrase * Fix step inputs * Remove dead code, fix lint warnings * Use latest go-xcode release
1 parent 99aa48e commit d2b29bb

File tree

11 files changed

+57
-92
lines changed

11 files changed

+57
-92
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ You can also run this step directly with [Bitrise CLI](https://github.com/bitris
8686
| `register_test_devices` | If this input is set, the Step will register the known test devices on Bitrise from team members with the Apple Developer Portal. Note that setting this to yes may cause devices to be registered against your limited quantity of test devices in the Apple Developer Portal, which can only be removed once annually during your renewal window. | required | `no` |
8787
| `min_profile_validity` | If this input is set to >0, the managed Provisioning Profile will be renewed if it expires within the configured number of days. Otherwise the Step renews the managed Provisioning Profile if it is expired. | required | `0` |
8888
| `certificate_url_list` | URL of the code signing certificate to download. Multiple URLs can be specified, separated by a pipe (`\|`) character. Local file path can be specified, using the `file://` URL scheme. | required, sensitive | `$BITRISE_CERTIFICATE_URL` |
89-
| `passphrase_list` | Passphrases for the provided code signing certificates. Specify as many passphrases as many Code signing certificate URL provided, separated by a pipe (`\|`) character. | required, sensitive | `$BITRISE_CERTIFICATE_PASSPHRASE` |
89+
| `passphrase_list` | Passphrases for the provided code signing certificates. Specify as many passphrases as many Code signing certificate URL provided, separated by a pipe (`\|`) character. Certificates without a passphrase: for using a single certificate, leave this step input empty. For multiple certificates, use the separator as if there was a passphrase (examples: `pass\|`, `\|pass\|`, `\|`) | sensitive | `$BITRISE_CERTIFICATE_PASSPHRASE` |
9090
| `keychain_path` | Path to the Keychain where the code signing certificates will be installed. | required | `$HOME/Library/Keychains/login.keychain` |
9191
| `keychain_password` | Password for the provided Keychain. | required, sensitive | `$BITRISE_KEYCHAIN_PASSWORD` |
9292
| `export_development_team` | The Developer Portal team to use for this export Defaults to the team used to build the archive. Defining this is also required when Automatic Code Signing is set to `apple-id` and the connected account belongs to multiple teams. | | |

e2e/bitrise.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,42 @@ app:
99
- BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
1010
- BITFALL_APPLE_IOS_CERTIFICATE_URL_LIST: $BITFALL_APPLE_IOS_CERTIFICATE_URL_LIST
1111
- BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
12+
- BITFALL_APPLE_IOS_CERTIFICATE_NOPASSPHRASE_URL: $BITFALL_APPLE_IOS_CERTIFICATE_NOPASSPHRASE_URL
1213
- BITFALL_APPLE_IOS_CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_IOS_CERTIFICATE_PASSPHRASE_LIST
1314
- BITFALL_APPLE_PROVISIONING_PROFILE_URL_LIST: $BITFALL_APPLE_PROVISIONING_PROFILE_URL_LIST
1415

1516
- BITFALL_APPSTORECONNECT_API_KEY_URL: $BITFALL_APPSTORECONNECT_API_KEY_URL
1617
- BITFALL_APPSTORECONNECT_API_KEY_ISSUER_ID: $BITFALL_APPSTORECONNECT_API_KEY_ISSUER_ID
1718

1819
workflows:
20+
test_single_certificate_no_passphrase:
21+
steps:
22+
- script:
23+
inputs:
24+
- content: |-
25+
#!/bin/bash
26+
set -ex
27+
rm -rf "./_tmp"
28+
mkdir -p "./_tmp"
29+
- git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git@master:
30+
inputs:
31+
- repository_url: https://github.com/bitrise-io/sample-apps-ios-simple-objc.git
32+
- branch: bundle_id
33+
- clone_into_dir: ./_tmp
34+
- path::./:
35+
title: Execute step
36+
inputs:
37+
- project_path: ./_tmp/ios-simple-objc/ios-simple-objc.xcodeproj
38+
- scheme: ios-simple-objc
39+
- automatic_code_signing: api-key
40+
- certificate_url_list: $BITFALL_APPLE_IOS_CERTIFICATE_NOPASSPHRASE_URL
41+
- passphrase_list: ""
42+
- distribution_method: development
43+
- export_development_team: 72SA8V3WYL
44+
- verbose_log: "yes"
45+
- keychain_path: $BITRISE_KEYCHAIN_PATH
46+
- keychain_password: $BITRISE_KEYCHAIN_PASSWORD
47+
1948
test_manual_signing:
2049
description: Tests the case when automatic code signing is disabled and the certificate installer step is used to set up code signing assets
2150
envs:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/bitrise-io/go-utils v1.0.1
88
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.2
99
github.com/bitrise-io/go-xcode v1.0.5
10-
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.9
10+
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.10
1111
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
1212
github.com/stretchr/testify v1.7.0
1313
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b

go.sum

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,10 @@ github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.1/go.mod h1:sy+Ir1X8P3tAAx/qU/r+h
1010
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.2 h1:w3fwgLLmxMOpYNa6W5aLtJZE8M8+qGE5VPOcr+st59c=
1111
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.2/go.mod h1:sy+Ir1X8P3tAAx/qU/r+hqDjHDcrMjIzDEvId1wqNc4=
1212
github.com/bitrise-io/go-xcode v1.0.1/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
13-
github.com/bitrise-io/go-xcode v1.0.4 h1:9i3VlaUX46LqdDKnjFd8aYRmzqUKp9wFKEoBYhNWfao=
14-
github.com/bitrise-io/go-xcode v1.0.4/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
15-
github.com/bitrise-io/go-xcode v1.0.5-0.20220303150513-eacbb0ea3534 h1:yK80oQf8EB3Bp3JFQ6rigrt+zSSobdzz9uIWqtA47sE=
16-
github.com/bitrise-io/go-xcode v1.0.5-0.20220303150513-eacbb0ea3534/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
17-
github.com/bitrise-io/go-xcode v1.0.5-0.20220303155724-31843c88e3b2 h1:/koeN8V5K5YEn2zdLA/EiaK0f5KG208DGiljheX9hjA=
18-
github.com/bitrise-io/go-xcode v1.0.5-0.20220303155724-31843c88e3b2/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
19-
github.com/bitrise-io/go-xcode v1.0.5-0.20220303165703-cd3a6caa0c7a h1:IRwm19YLJBh0Mf+cJB5n+gUT1CEG2RHwJFVmV4tc+xM=
20-
github.com/bitrise-io/go-xcode v1.0.5-0.20220303165703-cd3a6caa0c7a/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
21-
github.com/bitrise-io/go-xcode v1.0.5-0.20220304085114-810880454edb h1:G4EpFGZSnBEaSjviYhRkgcs4W009rqTWV3RBu+78paI=
22-
github.com/bitrise-io/go-xcode v1.0.5-0.20220304085114-810880454edb/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
2313
github.com/bitrise-io/go-xcode v1.0.5 h1:T0I1ED5oDifbO57VSNxhLh+8T9vcdGt+5U/kOrzFKeQ=
2414
github.com/bitrise-io/go-xcode v1.0.5/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
25-
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.9 h1:zBb8U+i6LrZXdTSh+FrXhb/ivw/ghnLVmhU5mjQIOSM=
26-
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.9/go.mod h1:6YbvyYwZgSTt96CQSQ6QlrkcRiv3ssX8zLijh2TPnbU=
15+
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.10 h1:fL+rOyxRXZADO3o4UKCUFsO3Fr83G+r8fbH4BnzOvls=
16+
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.10/go.mod h1:6YbvyYwZgSTt96CQSQ6QlrkcRiv3ssX8zLijh2TPnbU=
2717
github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8 h1:kmvU8AxrNTxXsVPKepBHD8W+eCVmeaKyTkRuUJB2K38=
2818
github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8/go.mod h1:UiXKNs0essbC14a2TvGlnUKo9isP9m4guPrp8KJHJpU=
2919
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ func (s XcodeArchiveStep) xcodeArchive(opts xcodeArchiveOpts) (xcodeArchiveOutpu
528528
var swiftPackagesPath string
529529
if opts.XcodeMajorVersion >= 11 {
530530
var err error
531-
if swiftPackagesPath, err = cache.SwiftPackagesPath(opts.ProjectPath); err != nil {
531+
if swiftPackagesPath, err = cache.NewSwiftPackageCache().SwiftPackagesPath(opts.ProjectPath); err != nil {
532532
return out, fmt.Errorf("failed to get Swift Packages path, error: %s", err)
533533
}
534534
}
@@ -575,7 +575,7 @@ The log file will be stored in $BITRISE_DEPLOY_DIR, and its full path will be av
575575

576576
// Cache swift PM
577577
if opts.XcodeMajorVersion >= 11 && opts.CacheLevel == "swift_packages" {
578-
if err := cache.CollectSwiftPackages(opts.ProjectPath); err != nil {
578+
if err := cache.NewSwiftPackageCache().CollectSwiftPackages(opts.ProjectPath); err != nil {
579579
logger.Warnf("Failed to mark swift packages for caching, error: %s", err)
580580
}
581581
}
@@ -650,7 +650,7 @@ func (s XcodeArchiveStep) xcodeIPAExport(opts xcodeIPAExportOpts) (xcodeIPAExpor
650650

651651
archiveExportMethod := opts.Archive.Application.ProvisioningProfile.ExportType
652652

653-
exportMethod, err := determineExportMethod(opts.ExportMethod, exportoptions.Method(archiveExportMethod))
653+
exportMethod, err := determineExportMethod(opts.ExportMethod, archiveExportMethod)
654654
if err != nil {
655655
return out, err
656656
}

step.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ inputs:
241241
Passphrases for the provided code signing certificates.
242242
243243
Specify as many passphrases as many Code signing certificate URL provided, separated by a pipe (`|`) character.
244-
is_required: true
244+
245+
Certificates without a passphrase: for using a single certificate, leave this step input empty. For multiple certificates, use the separator as if there was a passphrase (examples: `pass|`, `|pass|`, `|`)
246+
is_required: false # A single cert with an empty passphrase is allowed too
245247
is_sensitive: true
246248

247249
- keychain_path: $HOME/Library/Keychains/login.keychain

utils/export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func zip(cmdFactory command.Factory, sourceDir, destinationZipPth string) error
1717
cmd := cmdFactory.Create("/usr/bin/zip", []string{"-rTy", destinationZipPth, dirName}, &command.Opts{Dir: parentDir})
1818
out, err := cmd.RunAndReturnTrimmedCombinedOutput()
1919
if err != nil {
20-
return fmt.Errorf("Failed to zip dir: %s, output: %s, error: %s", sourceDir, out, err)
20+
return fmt.Errorf("failed to zip dir: %s, output: %s, error: %s", sourceDir, out, err)
2121
}
2222

2323
return nil

utils/platform_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestBuildableTargetPlatform(t *testing.T) {
3535
xcodeProj: &xcodeproj.XcodeProj{
3636
Proj: xcodeproj.Proj{
3737
Targets: []xcodeproj.Target{
38-
xcodeproj.Target{
38+
{
3939
ID: "target_id",
4040
},
4141
},
@@ -44,7 +44,7 @@ func TestBuildableTargetPlatform(t *testing.T) {
4444
scheme: &xcscheme.Scheme{
4545
BuildAction: xcscheme.BuildAction{
4646
BuildActionEntries: []xcscheme.BuildActionEntry{
47-
xcscheme.BuildActionEntry{
47+
{
4848
BuildForArchiving: "YES",
4949
BuildableReference: xcscheme.BuildableReference{
5050
BuildableName: "bitrise.app",
@@ -64,7 +64,7 @@ func TestBuildableTargetPlatform(t *testing.T) {
6464
xcodeProj: &xcodeproj.XcodeProj{
6565
Proj: xcodeproj.Proj{
6666
Targets: []xcodeproj.Target{
67-
xcodeproj.Target{
67+
{
6868
ID: "target_id",
6969
},
7070
},
@@ -73,7 +73,7 @@ func TestBuildableTargetPlatform(t *testing.T) {
7373
scheme: &xcscheme.Scheme{
7474
BuildAction: xcscheme.BuildAction{
7575
BuildActionEntries: []xcscheme.BuildActionEntry{
76-
xcscheme.BuildActionEntry{
76+
{
7777
BuildForArchiving: "YES",
7878
BuildableReference: xcscheme.BuildableReference{
7979
BuildableName: "bitrise.app",

utils/profile.go

Lines changed: 0 additions & 57 deletions
This file was deleted.

vendor/github.com/bitrise-io/go-xcode/v2/codesign/inputparse.go

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)