From 95b6c839ad42d94d951bb447d8cbfa10e3d58663 Mon Sep 17 00:00:00 2001 From: Szabolcs Toth <54896607+tothszabi@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:19:27 +0100 Subject: [PATCH] [CI-1884] Update init package (#140) * Update dependencies * Rename variable --- go.mod | 2 +- go.sum | 4 ++-- main.go | 4 ++-- .../bitrise-io/bitrise-init/models/models.go | 9 ++++---- .../bitrise-io/bitrise-init/scanner/config.go | 22 +++++++++---------- .../bitrise-io/bitrise-init/scanner/result.go | 4 ++-- .../bitrise-init/scanners/android/android.go | 16 +++++++------- .../bitrise-init/scanners/cordova/cordova.go | 8 +++---- .../scanners/fastlane/fastlane.go | 6 ++--- .../bitrise-init/scanners/flutter/flutter.go | 10 ++++----- .../bitrise-init/scanners/ionic/ionic.go | 6 ++--- .../bitrise-init/scanners/ios/ios.go | 4 ++-- .../bitrise-init/scanners/ios/utility.go | 10 ++++----- .../bitrise-init/scanners/ios/workflow.go | 4 ++-- .../bitrise-init/scanners/macos/macos.go | 4 ++-- .../bitrise-init/scanners/reactnative/expo.go | 10 ++++----- .../scanners/reactnative/plain.go | 10 ++++----- .../scanners/reactnative/reactnative.go | 6 ++--- .../bitrise-init/scanners/scanners.go | 4 ++-- .../bitrise-io/bitrise-init/steps/steps.go | 10 ++++----- vendor/modules.txt | 2 +- 21 files changed, 77 insertions(+), 78 deletions(-) diff --git a/go.mod b/go.mod index acd12d19..b4f098ae 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bitrise-steplib/steps-project-scanner go 1.17 require ( - github.com/bitrise-io/bitrise-init v0.0.0-20230714143523-dcb2c6b4985a + github.com/bitrise-io/bitrise-init v0.0.0-20230726090615-94c350647616 github.com/bitrise-io/go-steputils v1.0.5 github.com/bitrise-io/go-utils v1.0.1 github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.18 diff --git a/go.sum b/go.sum index 71b55b58..aa524d82 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/bitrise-io/bitrise v0.0.0-20210519130014-380842fb41c1/go.mod h1:Jqf2P github.com/bitrise-io/bitrise v0.0.0-20220217113333-f2def13a7946 h1:c+dLJvoW8eswyrV88mJunzc+dSidsV0S4CCfGe5QZyo= github.com/bitrise-io/bitrise v0.0.0-20220217113333-f2def13a7946/go.mod h1:wZJS5uJ+mLhTbV4manrofZgGninsaMjMJndWC5OvcCY= github.com/bitrise-io/bitrise-init v0.0.0-20210518121553-1e678625c45d/go.mod h1:2bxvLp7xgXC3HsacG2Z5nn6WOjk8kbNOmLWjinnhnKg= -github.com/bitrise-io/bitrise-init v0.0.0-20230714143523-dcb2c6b4985a h1:GqwUfiaH+gMjED6QugKE3EA4r95DiiYD4q3dvSMPitE= -github.com/bitrise-io/bitrise-init v0.0.0-20230714143523-dcb2c6b4985a/go.mod h1:4Pr0r3aDmcxkJ9k2SzfG1VPJ0X7IKBJApvDuUvPnLk0= +github.com/bitrise-io/bitrise-init v0.0.0-20230726090615-94c350647616 h1:Po/4TJdIyX7MSqR8fh/doqd+H9mf6epgS+l0amKZLvE= +github.com/bitrise-io/bitrise-init v0.0.0-20230726090615-94c350647616/go.mod h1:4Pr0r3aDmcxkJ9k2SzfG1VPJ0X7IKBJApvDuUvPnLk0= github.com/bitrise-io/colorstring v0.0.0-20180614154802-a8cd70115192/go.mod h1:CIHVcxZUvsG99XUJV6JlR7okNsMMGY81jMvPC20W+O0= github.com/bitrise-io/depman v0.0.0-20160708153333-4c59bc31f02a/go.mod h1:jeK3Koe+wXMSwfl8t6M7kovGgXsayUJ5ybqo3gDJgts= github.com/bitrise-io/envman v0.0.0-20200512105748-919e33f391ee/go.mod h1:m8pTp1o3Sw9uzDxb1WRm5IBRnMau2iOvPMSnRCAhQNI= diff --git a/main.go b/main.go index fa748fb2..510a34a8 100644 --- a/main.go +++ b/main.go @@ -197,8 +197,8 @@ func main() { failf("failed to expand path (%s), error: %s", cfg.ScanDirectory, err) } - isPrivateRepo := cfg.SSHRsaPrivateKey != "" - result, platformsDetected := scanner.GenerateScanResult(searchDir, isPrivateRepo) + hasSSHKey := cfg.SSHRsaPrivateKey != "" + result, platformsDetected := scanner.GenerateScanResult(searchDir, hasSSHKey) // Upload results if resultClient != nil { diff --git a/vendor/github.com/bitrise-io/bitrise-init/models/models.go b/vendor/github.com/bitrise-io/bitrise-init/models/models.go index 50d7de85..fd929319 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/models/models.go +++ b/vendor/github.com/bitrise-io/bitrise-init/models/models.go @@ -36,13 +36,12 @@ type ScanResultModel struct { Icons []Icon `json:"-" yaml:"-"` } -type RepoAccess int +type SSHKeyActivation int const ( - // RepoAccessUnknown should be used in generating default configs where the access is unknown - RepoAccessUnknown = iota - RepoAccessPublic - RepoAccessPrivate + SSHKeyActivationNone = iota + SSHKeyActivationMandatory + SSHKeyActivationConditional ) func (result *ScanResultModel) AddErrorWithRecommendation(platform string, recommendation ErrorWithRecommendations) { diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanner/config.go b/vendor/github.com/bitrise-io/bitrise-init/scanner/config.go index dc6b272a..0e28f691 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanner/config.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanner/config.go @@ -87,7 +87,7 @@ func (o *scannerOutput) AddWarnings(tag string, errs ...string) { } // Config ... -func Config(searchDir string, isPrivateRepository bool) models.ScanResultModel { +func Config(searchDir string, hasSSHKey bool) models.ScanResultModel { result := models.ScanResultModel{} // @@ -146,7 +146,7 @@ func Config(searchDir string, isPrivateRepository bool) models.ScanResultModel { fmt.Println() // Collect scanner outputs, by scanner name - projectScannerToOutputs := runScanners(scanners.ProjectScanners(), searchDir, isPrivateRepository) + projectScannerToOutputs := runScanners(scanners.ProjectScanners(), searchDir, hasSSHKey) detectedProjectTypes := getDetectedScannerNames(projectScannerToOutputs) log.Printf("Detected project types: %s", detectedProjectTypes) fmt.Println() @@ -163,7 +163,7 @@ func Config(searchDir string, isPrivateRepository bool) models.ScanResultModel { toolScanner.(scanners.AutomationToolScanner).SetDetectedProjectTypes(detectedProjectTypes) } - scannerToOutput := runScanners(automationToolScanners, searchDir, isPrivateRepository) + scannerToOutput := runScanners(automationToolScanners, searchDir, hasSSHKey) detectedAutomationToolScanners := getDetectedScannerNames(scannerToOutput) log.Printf("Detected automation tools: %s", detectedAutomationToolScanners) fmt.Println() @@ -212,7 +212,7 @@ func Config(searchDir string, isPrivateRepository bool) models.ScanResultModel { } } -func runScanners(scannerList []scanners.ScannerInterface, searchDir string, isPrivateRepository bool) map[string]scannerOutput { +func runScanners(scannerList []scanners.ScannerInterface, searchDir string, hasSSHKey bool) map[string]scannerOutput { scannerOutputs := map[string]scannerOutput{} var excludedScannerNames []string for _, scanner := range scannerList { @@ -225,7 +225,7 @@ func runScanners(scannerList []scanners.ScannerInterface, searchDir string, isPr log.TPrintf("+------------------------------------------------------------------------------+") log.TPrintf("| |") - scannerOutput := runScanner(scanner, searchDir, isPrivateRepository) + scannerOutput := runScanner(scanner, searchDir, hasSSHKey) log.TPrintf("| |") log.TPrintf("+------------------------------------------------------------------------------+") fmt.Println() @@ -237,7 +237,7 @@ func runScanners(scannerList []scanners.ScannerInterface, searchDir string, isPr } // Collect output of a specific scanner -func runScanner(detector scanners.ScannerInterface, searchDir string, isPrivateRepository bool) scannerOutput { +func runScanner(detector scanners.ScannerInterface, searchDir string, hasSSHKey bool) scannerOutput { output := scannerOutput{} if isDetect, err := detector.DetectPlatform(searchDir); err != nil { @@ -274,13 +274,13 @@ func runScanner(detector scanners.ScannerInterface, searchDir string, isPrivateR } // Generate configs - var repoAccess models.RepoAccess - if isPrivateRepository { - repoAccess = models.RepoAccessPrivate + var sshKeyActivation models.SSHKeyActivation + if hasSSHKey { + sshKeyActivation = models.SSHKeyActivationMandatory } else { - repoAccess = models.RepoAccessPublic + sshKeyActivation = models.SSHKeyActivationNone } - configs, err := detector.Configs(repoAccess) + configs, err := detector.Configs(sshKeyActivation) if err != nil { data := detectorErrorData(detector.Name(), err) analytics.LogError(configsFailedTag, data, "%s detector Configs failed", detector.Name()) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanner/result.go b/vendor/github.com/bitrise-io/bitrise-init/scanner/result.go index ae7b3a18..c6cf6012 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanner/result.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanner/result.go @@ -16,8 +16,8 @@ import ( ) // GenerateScanResult runs the scanner, returns the results and if any platform was detected. -func GenerateScanResult(searchDir string, isPrivateRepository bool) (models.ScanResultModel, bool) { - scanResult := Config(searchDir, isPrivateRepository) +func GenerateScanResult(searchDir string, hasSSHKey bool) (models.ScanResultModel, bool) { + scanResult := Config(searchDir, hasSSHKey) logUnknownTools(searchDir) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/android/android.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/android/android.go index bbe5682a..23b5cf77 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/android/android.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/android/android.go @@ -135,9 +135,9 @@ func (scanner *Scanner) DefaultOptions() models.OptionNode { } // Configs ... -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { params := configBuildingParameters(scanner.Projects) - return scanner.generateConfigs(repoAccess, params) + return scanner.generateConfigs(sshKeyActivation, params) } // DefaultConfigs ... @@ -146,14 +146,14 @@ func (scanner *Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { {name: DefaultConfigName, useKotlinScript: false}, {name: DefaultConfigNameKotlinScript, useKotlinScript: true}, } - return scanner.generateConfigs(models.RepoAccessUnknown, params) + return scanner.generateConfigs(models.SSHKeyActivationConditional, params) } -func (scanner *Scanner) generateConfigs(repoAccess models.RepoAccess, params []configBuildingParams) (models.BitriseConfigMap, error) { +func (scanner *Scanner) generateConfigs(sshKeyActivation models.SSHKeyActivation, params []configBuildingParams) (models.BitriseConfigMap, error) { bitriseDataMap := models.BitriseConfigMap{} for _, param := range params { - configBuilder := scanner.generateConfigBuilder(repoAccess, param.useKotlinScript) + configBuilder := scanner.generateConfigBuilder(sshKeyActivation, param.useKotlinScript) config, err := configBuilder.Generate(ScannerName) if err != nil { @@ -171,14 +171,14 @@ func (scanner *Scanner) generateConfigs(repoAccess models.RepoAccess, params []c return bitriseDataMap, nil } -func (scanner *Scanner) generateConfigBuilder(repoAccess models.RepoAccess, useKotlinBuildScript bool) models.ConfigBuilderModel { +func (scanner *Scanner) generateConfigBuilder(sshKeyActivation models.SSHKeyActivation, useKotlinBuildScript bool) models.ConfigBuilderModel { configBuilder := models.NewDefaultConfigBuilder() projectLocationEnv, gradlewPath, moduleEnv, variantEnv := "$"+ProjectLocationInputEnvKey, "$"+ProjectLocationInputEnvKey+"/gradlew", "$"+ModuleInputEnvKey, "$"+VariantInputEnvKey //-- test configBuilder.AppendStepListItemsTo(testsWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess})...) + SSHKeyActivation: sshKeyActivation})...) configBuilder.AppendStepListItemsTo(testsWorkflowID, steps.RestoreGradleCache()) configBuilder.AppendStepListItemsTo(testsWorkflowID, steps.InstallMissingAndroidToolsStepListItem( envmanModels.EnvironmentItemModel{GradlewPathInputKey: gradlewPath}, @@ -201,7 +201,7 @@ func (scanner *Scanner) generateConfigBuilder(repoAccess models.RepoAccess, useK //-- build configBuilder.AppendStepListItemsTo(buildWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) configBuilder.AppendStepListItemsTo(buildWorkflowID, steps.InstallMissingAndroidToolsStepListItem( envmanModels.EnvironmentItemModel{GradlewPathInputKey: gradlewPath}, diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/cordova/cordova.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/cordova/cordova.go index c9d7d318..f5e990f7 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/cordova/cordova.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/cordova/cordova.go @@ -281,10 +281,10 @@ func (*Scanner) DefaultOptions() models.OptionNode { return *workDirOption } -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { configBuilder := models.NewDefaultConfigBuilder() configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) workdirEnvList := []envmanModels.EnvironmentItemModel{} @@ -309,7 +309,7 @@ func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseCon // CD configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) @@ -384,7 +384,7 @@ func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseCon func (*Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { configBuilder := models.NewDefaultConfigBuilder() configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: models.RepoAccessUnknown, + SSHKeyActivation: models.SSHKeyActivationConditional, })...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/fastlane/fastlane.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/fastlane/fastlane.go index f6815a93..07994100 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/fastlane/fastlane.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/fastlane/fastlane.go @@ -190,11 +190,11 @@ func (*Scanner) DefaultOptions() models.OptionNode { return *workDirOption } -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { generateConfig := func(isIOS bool) (bitriseModels.BitriseDataModel, error) { configBuilder := models.NewDefaultConfigBuilder() configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) if isIOS { @@ -246,7 +246,7 @@ func (*Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { for _, p := range platforms { configBuilder := models.NewDefaultConfigBuilder() - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{RepoAccess: models.RepoAccessUnknown})...) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{SSHKeyActivation: models.SSHKeyActivationConditional})...) if p == iosPlatform { configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go index 4a7608aa..899acd86 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/flutter/flutter.go @@ -189,11 +189,11 @@ func (scanner *Scanner) DefaultOptions() models.OptionNode { return *flutterProjectLocationOption } -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { configs := models.BitriseConfigMap{} for _, proj := range scanner.projects { - config, err := generateConfig(repoAccess, proj) + config, err := generateConfig(sshKeyActivation, proj) if err != nil { return nil, err } @@ -210,7 +210,7 @@ func (scanner *Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { for i, proj := range defaultProjects { proj.id = i - config, err := generateConfig(models.RepoAccessUnknown, proj) + config, err := generateConfig(models.SSHKeyActivationConditional, proj) if err != nil { return nil, err } @@ -243,11 +243,11 @@ func findProjectLocations(searchDir string) ([]string, error) { return paths, nil } -func generateConfig(repoAccess models.RepoAccess, proj project) (string, error) { +func generateConfig(sshKeyActivation models.SSHKeyActivation, proj project) (string, error) { configBuilder := models.NewDefaultConfigBuilder() // Common steps to all workflows - prepareSteps := steps.DefaultPrepareStepList(steps.PrepareListParams{RepoAccess: repoAccess}) + prepareSteps := steps.DefaultPrepareStepList(steps.PrepareListParams{SSHKeyActivation: sshKeyActivation}) flutterInstallStep := steps.FlutterInstallStepListItem(proj.flutterVersionToUse, false) deploySteps := steps.DefaultDeployStepList() diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ionic/ionic.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ionic/ionic.go index b3014cd9..18394148 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ionic/ionic.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ionic/ionic.go @@ -275,10 +275,10 @@ func (Scanner) DefaultOptions() models.OptionNode { return *workDirOption } -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { configBuilder := models.NewDefaultConfigBuilder() configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) workdirEnvList := []envmanModels.EnvironmentItemModel{} @@ -374,7 +374,7 @@ func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseCon func (Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { configBuilder := models.NewDefaultConfigBuilder() - configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{RepoAccess: models.RepoAccessUnknown})...) + configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{SSHKeyActivation: models.SSHKeyActivationConditional})...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.CertificateAndProfileInstallerStepListItem()) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go index e8ac5fc7..a9194a1e 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/ios.go @@ -69,8 +69,8 @@ func (scanner *Scanner) DefaultOptions() models.OptionNode { return GenerateDefaultOptions(XcodeProjectTypeIOS) } -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { - return GenerateConfig(XcodeProjectTypeIOS, scanner.ConfigDescriptors, repoAccess) +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { + return GenerateConfig(XcodeProjectTypeIOS, scanner.ConfigDescriptors, sshKeyActivation) } // DefaultConfigs ... diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go index 70c293c2..5c6dd2c0 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/utility.go @@ -589,7 +589,7 @@ func GenerateDefaultOptions(projectType XcodeProjectType) models.OptionNode { func GenerateConfigBuilder( projectType XcodeProjectType, - repoAccess models.RepoAccess, + sshKeyActivation models.SSHKeyActivation, hasPodfile, hasTest, hasAppClip, @@ -604,7 +604,7 @@ func GenerateConfigBuilder( params := workflowSetupParams{ projectType: projectType, configBuilder: configBuilder, - repoAccess: repoAccess, + sshKeyActivation: sshKeyActivation, missingSharedSchemes: missingSharedSchemes, hasTests: hasTest, hasAppClip: hasAppClip, @@ -638,12 +638,12 @@ func RemoveDuplicatedConfigDescriptors(configDescriptors []ConfigDescriptor, pro return descriptors } -func GenerateConfig(projectType XcodeProjectType, configDescriptors []ConfigDescriptor, repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func GenerateConfig(projectType XcodeProjectType, configDescriptors []ConfigDescriptor, sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { bitriseDataMap := models.BitriseConfigMap{} for _, descriptor := range configDescriptors { configBuilder := GenerateConfigBuilder( projectType, - repoAccess, + sshKeyActivation, descriptor.HasPodfile, descriptor.HasTest, descriptor.HasAppClip, @@ -672,7 +672,7 @@ func GenerateConfig(projectType XcodeProjectType, configDescriptors []ConfigDesc func GenerateDefaultConfig(projectType XcodeProjectType) (models.BitriseConfigMap, error) { configBuilder := GenerateConfigBuilder( projectType, - models.RepoAccessUnknown, + models.SSHKeyActivationConditional, true, true, false, diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/workflow.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/workflow.go index 0b0e69be..25c6574a 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/workflow.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/ios/workflow.go @@ -42,7 +42,7 @@ const ( type workflowSetupParams struct { projectType XcodeProjectType configBuilder *models.ConfigBuilderModel - repoAccess models.RepoAccess + sshKeyActivation models.SSHKeyActivation missingSharedSchemes bool hasTests bool hasAppClip bool @@ -167,7 +167,7 @@ func addArchiveStep(workflow models.WorkflowID, configBuilder *models.ConfigBuil func addSharedSetupSteps(workflow models.WorkflowID, params workflowSetupParams, includeCertificateAndProfileInstallStep, includeCache bool) { params.configBuilder.AppendStepListItemsTo(workflow, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: params.repoAccess, + SSHKeyActivation: params.sshKeyActivation, })...) if includeCache { diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/macos/macos.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/macos/macos.go index 70050416..e9c09255 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/macos/macos.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/macos/macos.go @@ -66,8 +66,8 @@ func (Scanner) DefaultOptions() models.OptionNode { return ios.GenerateDefaultOptions(ios.XcodeProjectTypeMacOS) } -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { - return ios.GenerateConfig(ios.XcodeProjectTypeMacOS, scanner.configDescriptors, repoAccess) +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { + return ios.GenerateConfig(ios.XcodeProjectTypeMacOS, scanner.configDescriptors, sshKeyActivation) } func (Scanner) DefaultConfigs() (models.BitriseConfigMap, error) { diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go index 3c32a8c0..5fe9a01d 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/expo.go @@ -34,7 +34,7 @@ func (scanner *Scanner) expoOptions() models.OptionNode { } // expoConfigs implements ScannerInterface.Configs function for Expo based React Native projects. -func (scanner *Scanner) expoConfigs(project project, repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) expoConfigs(project project, sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { configMap := models.BitriseConfigMap{} if project.projectRelDir == "." { @@ -52,7 +52,7 @@ func (scanner *Scanner) expoConfigs(project project, repoAccess models.RepoAcces configBuilder := models.NewDefaultConfigBuilder() configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryDescription) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.RestoreNPMCache()) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, testSteps...) @@ -67,7 +67,7 @@ func (scanner *Scanner) expoConfigs(project project, repoAccess models.RepoAcces configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployDescription) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, testSteps...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.RunEASBuildStepListItem(project.projectRelDir, "$"+expoPlatformInputEnvKey)) @@ -111,7 +111,7 @@ func (scanner Scanner) expoDefaultConfigs() (models.BitriseConfigMap, error) { configBuilder := models.NewDefaultConfigBuilder() configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, expoPrimaryWorkflowDescription) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: models.RepoAccessUnknown, + SSHKeyActivation: models.SSHKeyActivationConditional, })...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.RestoreNPMCache()) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, getTestSteps("$"+expoProjectDirInputEnvKey, true, true)...) @@ -121,7 +121,7 @@ func (scanner Scanner) expoDefaultConfigs() (models.BitriseConfigMap, error) { // deploy workflow configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, expoDeployWorkflowDescription) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: models.RepoAccessUnknown, + SSHKeyActivation: models.SSHKeyActivationConditional, })...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, getTestSteps("$"+expoProjectDirInputEnvKey, true, true)...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.RunEASBuildStepListItem("$"+expoProjectDirInputEnvKey, "$"+expoPlatformInputEnvKey)) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go index 9c042cda..b494f111 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/plain.go @@ -175,7 +175,7 @@ func (scanner *Scanner) defaultOptions() models.OptionNode { return *androidOptions } -func (scanner *Scanner) configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { configMap := models.BitriseConfigMap{} if len(scanner.configDescriptors) == 0 { @@ -194,7 +194,7 @@ func (scanner *Scanner) configs(repoAccess models.RepoAccess) (models.BitriseCon configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryDescription) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.RestoreNPMCache()) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, testSteps...) @@ -204,7 +204,7 @@ func (scanner *Scanner) configs(repoAccess models.RepoAccess) (models.BitriseCon // cd configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: repoAccess, + SSHKeyActivation: sshKeyActivation, })...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, testSteps...) @@ -273,7 +273,7 @@ func (scanner *Scanner) defaultConfigs() (models.BitriseConfigMap, error) { // primary configBuilder.SetWorkflowDescriptionTo(models.PrimaryWorkflowID, primaryWorkflowDescription) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: models.RepoAccessUnknown, + SSHKeyActivation: models.SSHKeyActivationConditional, })...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.RestoreNPMCache()) // Assuming project uses yarn and has tests @@ -284,7 +284,7 @@ func (scanner *Scanner) defaultConfigs() (models.BitriseConfigMap, error) { // deploy configBuilder.SetWorkflowDescriptionTo(models.DeployWorkflowID, deployWorkflowDescription) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: models.RepoAccessUnknown, + SSHKeyActivation: models.SSHKeyActivationConditional, })...) configBuilder.AppendStepListItemsTo(models.DeployWorkflowID, getTestSteps("", true, true)...) diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go index 92fd2711..ccc629df 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/reactnative.go @@ -252,12 +252,12 @@ func (scanner *Scanner) Options() (options models.OptionNode, allWarnings models return } -func (scanner *Scanner) Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) { +func (scanner *Scanner) Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) { if scanner.isExpoBased { - return scanner.expoConfigs(scanner.projects[0], repoAccess) + return scanner.expoConfigs(scanner.projects[0], sshKeyActivation) } - return scanner.configs(repoAccess) + return scanner.configs(sshKeyActivation) } // DefaultOptions implements ScannerInterface.DefaultOptions function. diff --git a/vendor/github.com/bitrise-io/bitrise-init/scanners/scanners.go b/vendor/github.com/bitrise-io/bitrise-init/scanners/scanners.go index 000a27d5..7147507a 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/scanners/scanners.go +++ b/vendor/github.com/bitrise-io/bitrise-init/scanners/scanners.go @@ -53,7 +53,7 @@ type ScannerInterface interface { // Every config's key should be the last option one of the OptionNode branches. // Returns: // - platform BitriseConfigMap - Configs(repoAccess models.RepoAccess) (models.BitriseConfigMap, error) + Configs(sshKeyActivation models.SSHKeyActivation) (models.BitriseConfigMap, error) // Returns: // - platform default BitriseConfigMap @@ -97,7 +97,7 @@ const CustomConfigName = "other-config" func CustomConfig() (models.BitriseConfigMap, error) { configBuilder := models.NewDefaultConfigBuilder() configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultPrepareStepList(steps.PrepareListParams{ - RepoAccess: models.RepoAccessUnknown, + SSHKeyActivation: models.SSHKeyActivationConditional, })...) configBuilder.AppendStepListItemsTo(models.PrimaryWorkflowID, steps.DefaultDeployStepList()...) diff --git a/vendor/github.com/bitrise-io/bitrise-init/steps/steps.go b/vendor/github.com/bitrise-io/bitrise-init/steps/steps.go index 6dc52b05..21ca4cd4 100644 --- a/vendor/github.com/bitrise-io/bitrise-init/steps/steps.go +++ b/vendor/github.com/bitrise-io/bitrise-init/steps/steps.go @@ -10,7 +10,7 @@ import ( // PrepareListParams describes the default prepare Step options. type PrepareListParams struct { - RepoAccess models.RepoAccess + SSHKeyActivation models.SSHKeyActivation } func stepIDComposite(ID, version string) string { @@ -40,18 +40,18 @@ func stepListItem(stepIDComposite, title, runIf string, inputs ...envmanModels.E func DefaultPrepareStepList(params PrepareListParams) []bitriseModels.StepListItemModel { stepList := []bitriseModels.StepListItemModel{} - switch params.RepoAccess { - case models.RepoAccessPublic: + switch params.SSHKeyActivation { + case models.SSHKeyActivationNone: { // No SSH key setup needed } - case models.RepoAccessPrivate: + case models.SSHKeyActivationMandatory: { // This needs the `SSH_RSA_PRIVATE_KEY` env to be defined, which depends on the selected path in the website // add-new-app flow. stepList = append(stepList, ActivateSSHKeyStepListItem("")) } - case models.RepoAccessUnknown: + case models.SSHKeyActivationConditional: { // Add the SSH key step just in case, but only run it if the required env var is available. runCondition := `{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}` diff --git a/vendor/modules.txt b/vendor/modules.txt index 6e1bf083..a4a8bda5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -7,7 +7,7 @@ github.com/beevik/etree # github.com/bitrise-io/bitrise v0.0.0-20220217113333-f2def13a7946 ## explicit; go 1.16 github.com/bitrise-io/bitrise/models -# github.com/bitrise-io/bitrise-init v0.0.0-20230714143523-dcb2c6b4985a +# github.com/bitrise-io/bitrise-init v0.0.0-20230726090615-94c350647616 ## explicit; go 1.17 github.com/bitrise-io/bitrise-init/analytics github.com/bitrise-io/bitrise-init/errormapper