Skip to content

Commit

Permalink
Step 1322 apple connection fetch retry (#81)
Browse files Browse the repository at this point in the history
* Adding retry, update imports
* Warn if no Apple Service authentication data is found.
* Update sample app
  • Loading branch information
lpusok committed Aug 18, 2021
1 parent aa39179 commit b2b7b64
Show file tree
Hide file tree
Showing 21 changed files with 1,846 additions and 8 deletions.
16 changes: 14 additions & 2 deletions bitrise.yml
Expand Up @@ -18,8 +18,8 @@ workflows:

test:
before_run:
- auth-all
- cache
- auth-all

auth-all:
before_run:
Expand All @@ -32,6 +32,7 @@ workflows:
envs:
- SAMPLE_APP_URL: "https://github.com/bitrise-io/sample-apps-flutter-veggieseasons.git"
- BRANCH: master
- XCODE_SCHEME: Runner
steps:
- script:
inputs:
Expand All @@ -54,7 +55,18 @@ workflows:
- work_dir: ./
- verbose_log: "yes"
- connection: apple_id
- certificate-and-profile-installer: {}
- ios-auto-provision-appstoreconnect:
run_if: "true"
inputs:
- project_path: ./ios/Runner.xcworkspace
- scheme: $XCODE_SCHEME
- configuration: Release
- distribution_type: development
- flutter-installer:
run_if: "true"
title: Install Flutter
inputs:
- installation_bundle_url: https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_2.2.3-stable.zip
- path::./:
title: Test building a Flutter project
inputs:
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Expand Up @@ -41,8 +41,11 @@ github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXt
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM=
github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw=
Expand Down
14 changes: 8 additions & 6 deletions main.go
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/bitrise-io/go-utils/fileutil"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/go-utils/retry"
"github.com/bitrise-io/go-xcode/appleauth"
"github.com/bitrise-io/go-xcode/devportalservice"
"github.com/kballard/go-shellquote"
Expand Down Expand Up @@ -190,7 +191,7 @@ func main() {
// Select and fetch Apple authenication source
var devportalConnectionProvider *devportalservice.BitriseClient
if config.BuildURL != "" && config.BuildAPIToken != "" {
devportalConnectionProvider = devportalservice.NewBitriseClient(http.DefaultClient, config.BuildURL, string(config.BuildAPIToken))
devportalConnectionProvider = devportalservice.NewBitriseClient(retry.NewHTTPClient().StandardClient(), config.BuildURL, string(config.BuildAPIToken))
} else {
fmt.Println()
log.Warnf("Connected Apple Developer Portal Account not found. Step is not running on bitrise.io: BITRISE_BUILD_URL and BITRISE_BUILD_API_TOKEN envs are not set")
Expand All @@ -202,18 +203,19 @@ func main() {
if err != nil {
handleSessionDataError(err)
}

if conn != nil && (conn.APIKeyConnection == nil && conn.AppleIDConnection == nil) {
fmt.Println()
log.Warnf("%s", notConnected)
}
}

authConfig, err := appleauth.Select(conn, authSources, authInputs)
if err != nil {
if _, ok := err.(*appleauth.MissingAuthConfigError); !ok {
failf("Could not configure Apple Service authentication: %v", err)
}
fmt.Println()
log.Warnf("No authentication data found matching the selected Apple Service authentication method (%s).", config.BitriseConnection)
if conn != nil && (conn.APIKeyConnection == nil && conn.AppleIDConnection == nil) {
fmt.Println()
log.Warnf("%s", notConnected)
}
}

// Split lane option
Expand Down
57 changes: 57 additions & 0 deletions vendor/github.com/bitrise-io/go-utils/retry/retry.go

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

23 changes: 23 additions & 0 deletions vendor/github.com/bitrise-io/go-utils/retry/retryhttp.go

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

0 comments on commit b2b7b64

Please sign in to comment.