Skip to content

Conversation

@BirmacherAkos
Copy link
Contributor

teams := []string{}
for team := range certificatesByTeam {
teams = append(teams, team)
if teamHasCertificates(archiveCertificate, certificatesByTeam[team]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the initial logic here is not correct, this function should work like:

  1. Do you wasnt to use the archive team for archive? (if multiple team's identity could create this archive)
    no -> list the teams that could create this archive and let select
  2. Ipa export method?
  3. Do you want to use the archive team for the ipa export (if multiple team's identity could export the archive)
    no -> list the teams that could export this archive and let select

please update the whole function

Copy link
Contributor

@godrei godrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls have a look at my comments

…_codesigndoc_distribution_certificate_option_listed
_, contains := certificatesByTeam[fmt.Sprintf("%s - %s", archiveCertificate.TeamID, archiveCertificate.TeamName)]

// Skip if only 1 team has certificates on the machine.
if len(certificatesByTeam) > 1 && contains {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning if the archiving team does not have a certificate for the selected method.

if err != nil {
return certificateutil.CertificateInfoModel{}, fmt.Errorf("failed to read input: %s", err)
}
} else if !contains {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some comments for this cases, it is a little bit hard to understand

// Find the specific development certificate.
if !exportDistCert {
certificates := certificatesByTeam[selectedTeam]
developmentCertificates := certificateutil.FilterCertificateInfoModelsByFilterFunc(certificates, func(certInfo certificateutil.CertificateInfoModel) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the certsForSelectedExport

// Skip if only 1 team has certificates on the machine.
if len(certificatesByTeam) > 1 && contains {
question := fmt.Sprintf(`The archive used codesigning files of team: %s - %s
Would you like to use this team to sign your project?`, archiveCertificate.TeamID, archiveCertificate.TeamName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to use this team for the .ipa export?

@BirmacherAkos BirmacherAkos force-pushed the no_codesigndoc_distribution_certificate_option_listed branch from 4c6454f to 8e25678 Compare June 8, 2018 14:07
// teamHasCertificates returns true if the team has certificate for the selected cert type.
// If isDistCert == true it will search for Distribution Certificates. If it's == false it will search for Developmenttion Certificates.
// If the team doesn't have any certificate for the selected cert type, it will return false.
func teamHasCertificates(isDistCert bool, certificates []certificateutil.CertificateInfoModel) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function does not care about the team, rename this function

archiveTeam := fmt.Sprintf("%s - %s", archiveCertificate.TeamName, archiveCertificate.TeamID)

fmt.Println()
log.Warnf("🚨 Only the archiving team (%s) has certificate for the %s export method", archiveTeam, selectedExportMethod)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use printf without the icon

Squashed commits:
[3fa4b0d]  -
[b3e302a]  -
[8e25678]  - (+2 squashed commits)
Squashed commits:
[86e8e42] log fix
[5439d32] PR clean - fix
[b9572ef] No codesign cert find issue fix for the --certs-only flag
@BirmacherAkos BirmacherAkos force-pushed the no_codesigndoc_distribution_certificate_option_listed branch from 349d7b7 to 3d5eb5f Compare June 11, 2018 07:46
// Skip the question + set the useArchiveTeam = false, if multiple team has certificate for the export method but the archiving team is not one of them.
if len(filteredCertificatesByTeam) > 1 && contains {
question := fmt.Sprintf(`The archive used codesigning files of team: %s - %s
Would you like to use this team to sign your project?`, archiveCertificate.TeamID, archiveCertificate.TeamName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to use this team to export an ipa file?

}

fmt.Println()
selectedTeam, err = goinp.SelectFromStringsWithDefault("Select the Development team to sign your project", 1, teams)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use export an ipa file or similar instead of sign your project

@BirmacherAkos BirmacherAkos merged commit 94eac53 into master Jun 11, 2018
@BirmacherAkos BirmacherAkos deleted the no_codesigndoc_distribution_certificate_option_listed branch June 11, 2018 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants