Skip to content

Commit

Permalink
[CI-615] File based device list (#49)
Browse files Browse the repository at this point in the history
* Update dependencies

* Add new input

* Fix comments

* Remove space from yaml
  • Loading branch information
tothszabi authored Jun 15, 2023
1 parent 0aded2d commit 37d9109
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/bitrise-io/go-steputils v1.0.2
github.com/bitrise-io/go-utils v1.0.2
github.com/bitrise-io/go-xcode v1.0.9
github.com/bitrise-io/go-xcode v1.0.11
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
golang.org/x/text v0.3.7 // indirect
)
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ github.com/bitrise-io/go-utils v1.0.2/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.1/go.mod h1:sy+Ir1X8P3tAAx/qU/r+hqDjHDcrMjIzDEvId1wqNc4=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.11 h1:IacLMHL7hhgVcqtx15Bysq738P8FRCp6ckGk1NvioWo=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.11/go.mod h1:SJqGxzwjIAx2LVQxNGS4taN7X//eDPJLrFxJ1MpOuyA=
github.com/bitrise-io/go-xcode v1.0.9 h1:+sbqOYidQ+aiFfCTDpf2LdGSQEM5RfbtDsiG27zJG+s=
github.com/bitrise-io/go-xcode v1.0.9/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
github.com/bitrise-io/go-xcode v1.0.11 h1:Ac3TDAzL+1+XhBSWCOLnpT+VTzrIuGXjNhUvM0Q9plA=
github.com/bitrise-io/go-xcode v1.0.11/go.mod h1:Y0Wu2dXm0MilJ/4D3+gPHaNMlUcP+1DjIPoLPykq7wY=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.25 h1:h01Qp6Mw3LiPg7A7g4pf5F5LcejrY/i9rL7PkBnlOBs=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.25/go.mod h1:8WBcRgrVXY8tzR7NcjE4fw6WguOIfB3YcC7ZTcQYUEY=
github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8 h1:kmvU8AxrNTxXsVPKepBHD8W+eCVmeaKyTkRuUJB2K38=
Expand Down
15 changes: 15 additions & 0 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ inputs:
- "yes"
- "no"

- test_device_list_path:
opts:
category: Automatic code signing
title: Path of file containing the devices to be registered
summary: If this input is set, the Step will register the listed devices from this file with the Apple Developer Portal.
description: |-
If this input is set, the Step will register the listed devices from this file with the Apple Developer Portal.
The format of the file is a comma separated list of the identifiers. For example:
`00000000–0000000000000001,00000000–0000000000000002,00000000–0000000000000003`
And in the above example the registered devices appear with the name of `Device 1`, `Device 2` and `Device 3` in the Apple Developer Portal.
Note that setting this will have a higher priority than the Bitrise provided devices list.
- min_profile_validity: "0"
opts:
category: Automatic code signing
Expand Down
11 changes: 10 additions & 1 deletion step/codesign.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package step

import (
"fmt"
"time"

"github.com/bitrise-io/go-steputils/v2/stepconf"
"github.com/bitrise-io/go-utils/retry"
Expand All @@ -24,6 +25,7 @@ type CodesignManagerOpts struct {
Configuration string
CodeSigningAuthSource string
RegisterTestDevices bool
TestDeviceListPath string
MinDaysProfileValid int
TeamID string
CertificateURLList string
Expand Down Expand Up @@ -106,10 +108,17 @@ func createCodesignManager(managerOpts CodesignManagerOpts, xcodeMajorVersion in
}

client := retry.NewHTTPClient().StandardClient()

var testDevices []devportalservice.TestDevice
if serviceConnection != nil {
if managerOpts.TestDeviceListPath != "" {
testDevices, err = devportalservice.ParseTestDevicesFromFile(managerOpts.TestDeviceListPath, time.Now())
if err != nil {
return codesign.Manager{}, fmt.Errorf("failed to process device list (%s): %s", managerOpts.TestDeviceListPath, err)
}
} else if serviceConnection != nil {
testDevices = serviceConnection.TestDevices
}

return codesign.NewManagerWithProject(
opts,
appleAuthCredentials,
Expand Down
2 changes: 2 additions & 0 deletions step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type Input struct {
// Automatic code signing
CodeSigningAuthSource string `env:"automatic_code_signing,opt[off,api-key,apple-id]"`
RegisterTestDevices bool `env:"register_test_devices,opt[yes,no]"`
TestDeviceListPath string `env:"test_device_list_path"`
MinDaysProfileValid int `env:"min_profile_validity,required"`
TeamID string `env:"apple_team_id"`
CertificateURLList string `env:"certificate_url_list"`
Expand Down Expand Up @@ -185,6 +186,7 @@ func (b XcodebuildBuilder) ProcessConfig() (Config, error) {
Configuration: input.Configuration,
CodeSigningAuthSource: input.CodeSigningAuthSource,
RegisterTestDevices: input.RegisterTestDevices,
TestDeviceListPath: input.TestDeviceListPath,
MinDaysProfileValid: input.MinDaysProfileValid,
TeamID: input.TeamID,
CertificateURLList: input.CertificateURLList,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion vendor/github.com/bitrise-io/go-xcode/profileutil/info_model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ github.com/bitrise-io/go-utils/v2/fileutil
github.com/bitrise-io/go-utils/v2/log
github.com/bitrise-io/go-utils/v2/pathutil
github.com/bitrise-io/go-utils/v2/retryhttp
# github.com/bitrise-io/go-xcode v1.0.9
# github.com/bitrise-io/go-xcode v1.0.11
## explicit; go 1.15
github.com/bitrise-io/go-xcode/appleauth
github.com/bitrise-io/go-xcode/certificateutil
Expand Down

0 comments on commit 37d9109

Please sign in to comment.