Skip to content

Commit efbaec0

Browse files
authored
Adds minumum profile days validity input. (#266)
* Added support for setting minimum profile days validity (Used to manage code signing assets). * Pass team ID to code signing
1 parent b54f7b0 commit efbaec0

File tree

18 files changed

+170
-67
lines changed

18 files changed

+170
-67
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ You can also run this step directly with [Bitrise CLI](https://github.com/bitris
7070
| `log_formatter` | Defines how `xcodebuild` command's log is formatted. Available options: - `xcpretty`: The xcodebuild command's output will be prettified by xcpretty. - `xcodebuild`: Only the last 20 lines of raw xcodebuild output will be visible in the build log. The raw xcodebuild log will be exported in both cases. | required | `xcpretty` |
7171
| `automatic_code_signing` | This input determines which Bitrise Apple service connection should be used for automatic code signing. Available values: - `off`: Do not do any auto code signing. - `api-key`: [Bitrise Apple Service connection with API Key](https://devcenter.bitrise.io/getting-started/connecting-to-services/setting-up-connection-to-an-apple-service-with-api-key/). - `apple-id`: [Bitrise Apple Service connection with Apple ID](https://devcenter.bitrise.io/getting-started/connecting-to-services/connecting-to-an-apple-service-with-apple-id/). | required | `off` |
7272
| `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` |
73+
| `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` |
7374
| `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` |
7475
| `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` |
7576
| `keychain_path` | Path to the Keychain where the code signing certificates will be installed. | required | `$HOME/Library/Keychains/login.keychain` |

e2e/bitrise.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ workflows:
9696
- BITRISE_PROJECT_PATH: Fruta.xcodeproj
9797
- BITRISE_SCHEME: Fruta iOS
9898
- CODE_SIGNING_METHOD: api-key
99+
- MIN_DAYS_PROFILE_VALID: 0
99100
- IPA_EXPORT_METHOD: development
100101
- LOG_FORMATTER: xcodebuild
101102
after_run:
@@ -121,6 +122,7 @@ workflows:
121122
- BITRISE_PROJECT_PATH: Fruta.xcodeproj
122123
- BITRISE_SCHEME: Fruta iOS
123124
- CODE_SIGNING_METHOD: api-key
125+
- MIN_DAYS_PROFILE_VALID: 0
124126
- IPA_EXPORT_METHOD: development
125127
- LOG_FORMATTER: xcodebuild
126128
after_run:
@@ -135,6 +137,7 @@ workflows:
135137
- BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj
136138
- BITRISE_SCHEME: ios-simple-objc
137139
- CODE_SIGNING_METHOD: apple-id
140+
- MIN_DAYS_PROFILE_VALID: 0
138141
- IPA_EXPORT_METHOD: development
139142
- LOG_FORMATTER: xcodebuild
140143
after_run:
@@ -150,6 +153,7 @@ workflows:
150153
- BITRISE_PROJECT_PATH: code-sign-test.xcodeproj
151154
- BITRISE_SCHEME: code-sign-test
152155
- CODE_SIGNING_METHOD: api-key
156+
- MIN_DAYS_PROFILE_VALID: 0
153157
- IPA_EXPORT_METHOD: app-store
154158
- LOG_FORMATTER: xcpretty
155159
after_run:
@@ -165,6 +169,7 @@ workflows:
165169
- BITRISE_PROJECT_PATH: code-sign-test.xcodeproj
166170
- BITRISE_SCHEME: code-sign-test
167171
- CODE_SIGNING_METHOD: api-key
172+
- MIN_DAYS_PROFILE_VALID: 0
168173
- IPA_EXPORT_METHOD: app-store
169174
- LOG_FORMATTER: xcpretty
170175
after_run:
@@ -180,6 +185,7 @@ workflows:
180185
- BITRISE_PROJECT_PATH: code-sign-test.xcodeproj
181186
- BITRISE_SCHEME: code-sign-test
182187
- CODE_SIGNING_METHOD: apple-id
188+
- MIN_DAYS_PROFILE_VALID: 0
183189
- IPA_EXPORT_METHOD: app-store
184190
- LOG_FORMATTER: xcpretty
185191
after_run:
@@ -195,6 +201,7 @@ workflows:
195201
- BITRISE_PROJECT_PATH: code-sign-test.xcodeproj
196202
- BITRISE_SCHEME: code-sign-test-Prod
197203
- CODE_SIGNING_METHOD: api-key
204+
- MIN_DAYS_PROFILE_VALID: 0
198205
- TEAM_ID: 72SA8V3WYL
199206
- IPA_EXPORT_METHOD: development
200207
- IPA_EXPORT_ICLOUD_CONTAINER_ENVIRONMENT: Production
@@ -212,6 +219,7 @@ workflows:
212219
- BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcworkspace
213220
- BITRISE_SCHEME: ios-simple-objc
214221
- CODE_SIGNING_METHOD: api-key
222+
- MIN_DAYS_PROFILE_VALID: 0
215223
- TEAM_ID: 72SA8V3WYL
216224
- IPA_EXPORT_METHOD: development
217225
- IPA_EXPORT_ICLOUD_CONTAINER_ENVIRONMENT: ""
@@ -230,6 +238,7 @@ workflows:
230238
- BITRISE_PROJECT_PATH: ios-simple-objc/ios-simple-objc.xcodeproj
231239
- BITRISE_SCHEME: ios-simple-objc
232240
- CODE_SIGNING_METHOD: api-key
241+
- MIN_DAYS_PROFILE_VALID: 0
233242
- TEAM_ID: 72SA8V3WYL
234243
- IPA_EXPORT_METHOD: development
235244
- IPA_EXPORT_ICLOUD_CONTAINER_ENVIRONMENT: ""
@@ -242,13 +251,17 @@ workflows:
242251
- _check_archive_zip
243252

244253
test_multi_target:
254+
description: |-
255+
Test app with multiple targets. Also tests api-key signing with a custom min profile days valid.
256+
(Should use Bitrise-managed code signing assets).
245257
envs:
246258
- TEST_APP_URL: https://github.com/bitrise-samples/sample-apps-ios-multi-target.git
247259
- TEST_APP_BRANCH: ""
248260
- TEST_APP_COMMIT: ab36ed563bbc3125118e9f27df91474822dc0d46
249261
- BITRISE_PROJECT_PATH: code-sign-test.xcodeproj
250262
- BITRISE_SCHEME: code-sign-test
251263
- CODE_SIGNING_METHOD: api-key
264+
- MIN_DAYS_PROFILE_VALID: 112
252265
- TEAM_ID: 72SA8V3WYL
253266
- IPA_EXPORT_METHOD: development
254267
- IPA_EXPORT_ICLOUD_CONTAINER_ENVIRONMENT: ""
@@ -266,6 +279,7 @@ workflows:
266279
- BITRISE_PROJECT_PATH: sample-apps-ios-workspace-swift.xcworkspace
267280
- BITRISE_SCHEME: sample-apps-ios-workspace-swift
268281
- CODE_SIGNING_METHOD: api-key
282+
- MIN_DAYS_PROFILE_VALID: 0
269283
- TEAM_ID: 72SA8V3WYL
270284
- IPA_EXPORT_METHOD: development
271285
- IPA_EXPORT_ICLOUD_CONTAINER_ENVIRONMENT: ""
@@ -283,6 +297,7 @@ workflows:
283297
- BITRISE_PROJECT_PATH: Catalyst Sample.xcodeproj
284298
- BITRISE_SCHEME: Catalyst Sample
285299
- CODE_SIGNING_METHOD: api-key
300+
- MIN_DAYS_PROFILE_VALID: 0
286301
- FORCE_CODE_SIGN_IDENTITY: "iPhone Developer: Dev Portal Bot Bitrise"
287302
- TEAM_ID: 72SA8V3WYL
288303
- FORCE_PROV_PROFILE_SPECIFIER: ""
@@ -324,6 +339,7 @@ workflows:
324339
- project_path: ./_tmp/$BITRISE_PROJECT_PATH
325340
- scheme: $BITRISE_SCHEME
326341
- automatic_code_signing: $CODE_SIGNING_METHOD
342+
- min_profile_validity: $MIN_DAYS_PROFILE_VALID
327343
- certificate_url_list: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST|$BITFALL_APPLE_IOS_CERTIFICATE_URL_LIST
328344
- passphrase_list: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST|$BITFALL_APPLE_IOS_CERTIFICATE_PASSPHRASE_LIST
329345
- distribution_method: $IPA_EXPORT_METHOD

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
github.com/bitrise-io/go-steputils v0.0.0-20210929162140-866a65a1e14a
77
github.com/bitrise-io/go-utils v0.0.0-20211008161027-fa11986847a0
8-
github.com/bitrise-io/go-xcode v0.0.0-20211125140650-26a04aa27c0f
8+
github.com/bitrise-io/go-xcode v0.0.0-20211126145828-45cb07d2198c
99
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
1010
github.com/ryanuber/go-glob v1.0.0
1111
github.com/stretchr/testify v1.7.0

go.sum

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,10 @@ github.com/bitrise-io/go-steputils v0.0.0-20210929162140-866a65a1e14a/go.mod h1:
55
github.com/bitrise-io/go-utils v0.0.0-20210924090918-3e7a04d0da9d/go.mod h1:Vi4MHnaZVL3PVoPPA/Yp6g2pzntkDH8LGiRSY7qw6KQ=
66
github.com/bitrise-io/go-utils v0.0.0-20211008161027-fa11986847a0 h1:fT81H9m8GHazqZ0WsVq7GE5DfK4xSyXnHGJKyita2BM=
77
github.com/bitrise-io/go-utils v0.0.0-20211008161027-fa11986847a0/go.mod h1:Vi4MHnaZVL3PVoPPA/Yp6g2pzntkDH8LGiRSY7qw6KQ=
8-
github.com/bitrise-io/go-xcode v0.0.0-20211119121743-cba4c04021b6 h1:ZpLQn0aFZTjrtK1Sy2p/Qo8vevmyOw5cSEhGJKgNfFg=
9-
github.com/bitrise-io/go-xcode v0.0.0-20211119121743-cba4c04021b6/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
10-
github.com/bitrise-io/go-xcode v0.0.0-20211123133459-d4e297141245 h1:wql+Nb0sDQKlQtslpNCrg2e3jNTschLvfAk8k+XcKxo=
11-
github.com/bitrise-io/go-xcode v0.0.0-20211123133459-d4e297141245/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
12-
github.com/bitrise-io/go-xcode v0.0.0-20211123160117-4d852a965240 h1:MHMoskrHZzGFeIk11LFMk+E5+VBoXJw42/U3ohB9gNY=
13-
github.com/bitrise-io/go-xcode v0.0.0-20211123160117-4d852a965240/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
14-
github.com/bitrise-io/go-xcode v0.0.0-20211124103117-d0322c82f4d8 h1:CXzKowAOVUv6hMX79d81uWnutiOFo2vfFyGghOvGi9s=
15-
github.com/bitrise-io/go-xcode v0.0.0-20211124103117-d0322c82f4d8/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
16-
github.com/bitrise-io/go-xcode v0.0.0-20211124104407-4e16ce31b4d6 h1:bVjK9MokR/LON+LZ2S7zgUxhJdmJEqNKf1lfTo4yi/0=
17-
github.com/bitrise-io/go-xcode v0.0.0-20211124104407-4e16ce31b4d6/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
18-
github.com/bitrise-io/go-xcode v0.0.0-20211124152140-304705150829 h1:PGCiS18ImeXJDyKYrKC3IY96BmgfraaLvmFBAk/QQVA=
19-
github.com/bitrise-io/go-xcode v0.0.0-20211124152140-304705150829/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
20-
github.com/bitrise-io/go-xcode v0.0.0-20211125090842-a1caa9a457cb h1:eEWpQwNA5QGNzkAaXOMiY8LqHCWjTmRoEBmZqyHKkSU=
21-
github.com/bitrise-io/go-xcode v0.0.0-20211125090842-a1caa9a457cb/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
22-
github.com/bitrise-io/go-xcode v0.0.0-20211125140650-26a04aa27c0f h1:ysNMLgNbUt9wgN+wVQuOgzqIxAp6lgwnp0VLX6R+Nr0=
23-
github.com/bitrise-io/go-xcode v0.0.0-20211125140650-26a04aa27c0f/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
8+
github.com/bitrise-io/go-xcode v0.0.0-20211126140007-ef026e692897 h1:pVoTqSPg3gV0MCgU4MWuzIKvCnfhCBYvj47Krycf/l4=
9+
github.com/bitrise-io/go-xcode v0.0.0-20211126140007-ef026e692897/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
10+
github.com/bitrise-io/go-xcode v0.0.0-20211126145828-45cb07d2198c h1:nexOxnQNuRVDaU7Ufu7Ug1pWZ4yZLPRbTHJ1bRGFK1M=
11+
github.com/bitrise-io/go-xcode v0.0.0-20211126145828-45cb07d2198c/go.mod h1:s41EQA9NOMK148ewA6ppM1ClEdv0YomaZq9h5k32ZWo=
2412
github.com/bitrise-io/pkcs12 v0.0.0-20210430063833-0da06eb56630 h1:V+xoYqGSkN8aUxCc806zDKjGGpBVUtV0Vytf5OsB3gc=
2513
github.com/bitrise-io/pkcs12 v0.0.0-20210430063833-0da06eb56630/go.mod h1:UiXKNs0essbC14a2TvGlnUKo9isP9m4guPrp8KJHJpU=
2614
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ type Inputs struct {
9797
KeychainPath string `env:"keychain_path"`
9898
KeychainPassword stepconf.Secret `env:"keychain_password"`
9999
RegisterTestDevices bool `env:"register_test_devices,opt[yes,no]"`
100+
MinDaysProfileValid int `env:"min_profile_validity,required"`
100101
BuildURL string `env:"BITRISE_BUILD_URL"`
101102
BuildAPIToken stepconf.Secret `env:"BITRISE_BUILD_API_TOKEN"`
102103
}
@@ -368,11 +369,12 @@ func (s XcodeArchiveStep) createCodesignManager(config Config) (codesign.Manager
368369
opts := codesign.Opts{
369370
AuthType: authType,
370371
ShouldConsiderXcodeSigning: true,
372+
TeamID: config.ExportDevelopmentTeam,
371373
ExportMethod: codesignConfig.DistributionMethod,
372374
XcodeMajorVersion: config.XcodeMajorVersion,
373375
RegisterTestDevices: config.RegisterTestDevices,
374376
SignUITests: false,
375-
MinProfileValidity: 30,
377+
MinDaysProfileValidity: config.MinDaysProfileValid,
376378
IsVerboseLog: config.VerboseLog,
377379
}
378380

step.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,17 @@ inputs:
194194
- "yes"
195195
- "no"
196196

197+
- min_profile_validity: "0"
198+
opts:
199+
category: Automatic code signing
200+
title: The minimum days the Provisioning Profile should be valid
201+
summary: If this input is set to >0, the managed Provisioning Profile will be renewed if it expires within the configured number of days.
202+
description: |-
203+
If this input is set to >0, the managed Provisioning Profile will be renewed if it expires within the configured number of days.
204+
205+
Otherwise the Step renews the managed Provisioning Profile if it is expired.
206+
is_required: true
207+
197208
- certificate_url_list: $BITRISE_CERTIFICATE_URL
198209
opts:
199210
category: Automatic code signing

vendor/github.com/bitrise-io/go-xcode/autocodesign/autocodesign.go

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

vendor/github.com/bitrise-io/go-xcode/autocodesign/devportalclient/appstoreconnectclient/devices.go

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

vendor/github.com/bitrise-io/go-xcode/autocodesign/devportalclient/appstoreconnectclient/profiles.go

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

vendor/github.com/bitrise-io/go-xcode/autocodesign/devportalclient/devportalclient.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)