diff --git a/bitrise.yml b/bitrise.yml index a60445c..eb45ea2 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -25,8 +25,8 @@ workflows: before_run: - auth-test-api-key-connection - auth-test-apple-id-connection - - auth-test-apple-id-connection-globally-set-app-specific-password - auth-test-api-key-input + - auth-test-apple-id-connection-globally-set-app-specific-password cache: envs: @@ -86,9 +86,11 @@ workflows: - work_dir: ./ - verbose_log: "yes" - connection: apple_id - - app_password: $FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD + - app_password: $APP_SPECIFIC_PASSWORD auth-test-apple-id-connection-globally-set-app-specific-password: + envs: + - FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: $APP_SPECIFIC_PASSWORD before_run: - _auth_prepare steps: @@ -124,6 +126,20 @@ workflows: - api_issuer: $AUTH_API_ISSUER - api_key_path: $BITRISEIO_AUTH_API_KEY_PATH_URL + auth-test-tfa-disabled-apple-id-connection: + title: Test Apple ID connection authentication using TFA disabled account + description: |- + Use this workflow for manual testing TFA disabled Apple ID. + before_run: + - _auth_prepare + steps: + - path::./: + inputs: + - lane: release + - work_dir: ./ + - verbose_log: "yes" + - connection: apple_id + _auth_prepare: envs: - SAMPLE_APP_URL: "https://github.com/bitrise-samples/sample-apps-fastlane-test.git" diff --git a/credentials.go b/credentials.go index 6b0157e..0f6b354 100644 --- a/credentials.go +++ b/credentials.go @@ -24,6 +24,8 @@ func FastlaneAuthParams(authConfig appleauth.Credentials) (map[string]string, er envs := make(map[string]string) if authConfig.AppleID != nil { // Set as environment variables + envs["SPACESHIP_SKIP_2FA_UPGRADE"] = "1" + if authConfig.AppleID.Username != "" { envs["FASTLANE_USER"] = authConfig.AppleID.Username envs["DELIVER_USERNAME"] = authConfig.AppleID.Username diff --git a/go.mod b/go.mod index 387b9b0..ec215ad 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/bitrise-io/go-utils v0.0.0-20201211082830-859032e9adf0 github.com/bitrise-io/stepman v0.0.0-20190813144014-10564a4888a6 // indirect github.com/bitrise-steplib/bitrise-step-android-unit-test v0.0.0-20190902203028-ff8e682d8645 - github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210202154324-7c20293c7cf0 + github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210209134909-4d779ddbe073 github.com/google/go-cmp v0.5.4 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/kr/pretty v0.1.0 // indirect diff --git a/go.sum b/go.sum index af3ee1b..264d6d7 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,12 @@ github.com/bitrise-io/stepman v0.0.0-20190813144014-10564a4888a6 h1:/GnB2kEaO/6K github.com/bitrise-io/stepman v0.0.0-20190813144014-10564a4888a6/go.mod h1:hGCjd8leP411yt5QkQi+VBNWGxIZ4H02LNIVeKBeMUk= github.com/bitrise-steplib/bitrise-step-android-unit-test v0.0.0-20190902203028-ff8e682d8645 h1:9molXzIAxnKStwV78lt7MSgUQwxIWl4+r9/oYTQA7no= github.com/bitrise-steplib/bitrise-step-android-unit-test v0.0.0-20190902203028-ff8e682d8645/go.mod h1:0yqqJw+MqwsfHKq4pL90IoSYskLF91oDCyyZYnIehWA= -github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210202154324-7c20293c7cf0 h1:DKE9KQEbdO4iGpDQF1uiaYtgFOyu/lH1srg3ufAMURI= -github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210202154324-7c20293c7cf0/go.mod h1:mG5kKjSyK3sZNp7e5QpFBAtxJRWeA+4PSMh3ZfwggNs= +github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210204114640-c91fdc7c90cd h1:ieyOJ5xYu0nxVf9dpyRCg3RgS/Uhc3hfNBI6RUWms/Q= +github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210204114640-c91fdc7c90cd/go.mod h1:mG5kKjSyK3sZNp7e5QpFBAtxJRWeA+4PSMh3ZfwggNs= +github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210209130532-8386805c9389 h1:NQfjDuwNE/LhjTkMV7+PmRE/c+KFPxXJTZeW6TfEptY= +github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210209130532-8386805c9389/go.mod h1:mG5kKjSyK3sZNp7e5QpFBAtxJRWeA+4PSMh3ZfwggNs= +github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210209134909-4d779ddbe073 h1:348wxtooA7rjIe0pXLJwVPwddrURmq+6hCWcfE6hACQ= +github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210209134909-4d779ddbe073/go.mod h1:mG5kKjSyK3sZNp7e5QpFBAtxJRWeA+4PSMh3ZfwggNs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/steps-fastlane b/steps-fastlane deleted file mode 100755 index fa9d6e9..0000000 Binary files a/steps-fastlane and /dev/null differ diff --git a/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/appleauth/auth_source.go b/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/appleauth/auth_source.go index 71d11aa..9280609 100644 --- a/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/appleauth/auth_source.go +++ b/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/appleauth/auth_source.go @@ -2,6 +2,7 @@ package appleauth import ( "fmt" + "time" "github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice" ) @@ -135,8 +136,8 @@ func (*ConnectionAppleIDFastlaneSource) Fetch(conn *devportalservice.AppleDevelo } appleIDConn := conn.AppleIDConnection - if expiry := appleIDConn.Expiry(); expiry != nil && appleIDConn.Expired() { - return nil, fmt.Errorf("2FA session saved in Bitrise Developer Connection is expired, was valid until %s", expiry.String()) + if appleIDConn.SessionExpiryDate != nil && appleIDConn.SessionExpiryDate.Before(time.Now()) { + return nil, fmt.Errorf("2FA session saved in Bitrise Developer Connection is expired, was valid until %s", appleIDConn.SessionExpiryDate.String()) } session, err := appleIDConn.FastlaneLoginSession() if err != nil { diff --git a/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice.go b/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice.go index 6ecc851..3a9603c 100644 --- a/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice.go +++ b/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice.go @@ -147,10 +147,10 @@ type cookie struct { // AppleIDConnection represents a Bitrise.io Apple ID-based Apple Developer connection. type AppleIDConnection struct { - AppleID string `json:"apple_id"` - Password string `json:"password"` - ConnectionExpiryDate string `json:"connection_expiry_date"` - SessionCookies map[string][]cookie `json:"session_cookies"` + AppleID string `json:"apple_id"` + Password string `json:"password"` + SessionExpiryDate *time.Time `json:"connection_expiry_date"` + SessionCookies map[string][]cookie `json:"session_cookies"` } // APIKeyConnection represents a Bitrise.io API key-based Apple Developer connection. @@ -162,13 +162,13 @@ type APIKeyConnection struct { // TestDevice ... type TestDevice struct { - ID int `json:"id"` - UserID int `json:"user_id"` - DeviceID string `json:"device_identifier"` - Title string `json:"title"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - DeviceType string `json:"device_type"` + ID int `json:"id"` + UserID int `json:"user_id"` + DeviceID string `json:"device_identifier"` + Title string `json:"title"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + DeviceType string `json:"device_type"` } // AppleDeveloperConnection represents a Bitrise.io Apple Developer connection. @@ -179,25 +179,6 @@ type AppleDeveloperConnection struct { TestDevices []TestDevice `json:"test_devices"` } -// Expiry returns the expiration of the Bitrise Apple ID-based Apple Developer connection. -func (c *AppleIDConnection) Expiry() *time.Time { - t, err := time.Parse(time.RFC3339, c.ConnectionExpiryDate) - if err != nil { - log.Warnf("Could not parse Apple ID session expiry date: %s", err) - return nil - } - return &t -} - -// Expired returns whether the Bitrise Apple ID-based Apple Developer connection is expired. -func (c *AppleIDConnection) Expired() bool { - expiry := c.Expiry() - if expiry == nil { - return false - } - return expiry.Before(time.Now()) -} - // FastlaneLoginSession returns the Apple ID login session in a ruby/object:HTTP::Cookie format. // The session can be used as a value for FASTLANE_SESSION environment variable: https://docs.fastlane.tools/best-practices/continuous-integration/#two-step-or-two-factor-auth. func (c *AppleIDConnection) FastlaneLoginSession() (string, error) { diff --git a/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice_testdata.go b/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice_testdata.go index e189837..f397dba 100644 --- a/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice_testdata.go +++ b/vendor/github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice/devportalservice_testdata.go @@ -1,5 +1,20 @@ package devportalservice +import ( + "time" +) + +func toTime(str string) *time.Time { + if str == "" { + return nil + } + t, err := time.Parse(time.RFC3339, str) + if err != nil { + panic(err) + } + return &t +} + const testDevicesResponseBody = `{ "test_devices":[ { @@ -30,8 +45,8 @@ var testDevices = []TestDevice{ UserID: 4, DeviceID: "asdf12345ad9b298cb9a9f28555c49573d8bc322", Title: "iPhone 6", - CreatedAt: "2015-03-13T16:16:13.665Z", - UpdatedAt: "2015-03-13T16:16:13.665Z", + CreatedAt: *toTime("2015-03-13T16:16:13.665Z"), + UpdatedAt: *toTime("2015-03-13T16:16:13.665Z"), DeviceType: "ios", }, { @@ -39,8 +54,8 @@ var testDevices = []TestDevice{ UserID: 4, DeviceID: "asdf12341e73b76df6e99d0d713133c3e078418f", Title: "iPad mini 2 (Wi-Fi)", - CreatedAt: "2015-03-19T13:25:43.487Z", - UpdatedAt: "2015-03-19T13:25:43.487Z", + CreatedAt: *toTime("2015-03-19T13:25:43.487Z"), + UpdatedAt: *toTime("2015-03-19T13:25:43.487Z"), DeviceType: "ios", }, } @@ -97,9 +112,9 @@ const testFastlaneSession = `--- ` var testAppleIDConnection = AppleIDConnection{ - AppleID: "example@example.io", - Password: "highSecurityPassword", - ConnectionExpiryDate: "2019-04-06T12:04:59.000Z", + AppleID: "example@example.io", + Password: "highSecurityPassword", + SessionExpiryDate: toTime("2019-04-06T12:04:59.000Z"), SessionCookies: map[string][]cookie{ "https://idmsa.apple.com": { { diff --git a/vendor/modules.txt b/vendor/modules.txt index bcb99d6..e5f9d27 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -29,7 +29,7 @@ github.com/bitrise-io/go-utils/sliceutil github.com/bitrise-io/stepman/models # github.com/bitrise-steplib/bitrise-step-android-unit-test v0.0.0-20190902203028-ff8e682d8645 github.com/bitrise-steplib/bitrise-step-android-unit-test/cache -# github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210202154324-7c20293c7cf0 +# github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver v0.0.0-20210209134909-4d779ddbe073 github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/appleauth github.com/bitrise-steplib/steps-deploy-to-itunesconnect-deliver/devportalservice # github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51