diff --git a/README.md b/README.md index bf8a593..9d8cb61 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ Introduce your project here. A short summary about what its purpose and scope is This tool queries your Source Control Management (SCM) system and creates Organizations and Applications in Sonatype Lifecycle in bulk. +This tool is intended to be run against either an empty Sonatype Lifecycle installation or a specific Organization that represents a given SCM connection ONCE. + +This tool is NOT intended to be run multiple times to continuously import/keep Sonatype Lifecycle up to date with newly created Projects or Repositories in your SCM system - to do this (once you've run this tool once successfully), use [Easy SCM Onboarding](https://help.sonatype.com/en/easy-scm-onboarding.html). + Currently supports: - ✅ Azure DevOps diff --git a/iq/server.go b/iq/server.go index 4287376..f60ec2b 100644 --- a/iq/server.go +++ b/iq/server.go @@ -221,7 +221,10 @@ func (s *NxiqServer) CreateOrganization(org scm.Organization, parentOrgId string } func (s *NxiqServer) OrganizationExists(org scm.Organization, parentOrgId string) (*sonatypeiq.ApiOrganizationDTO, error) { - s.InitCache() + err := s.InitCache() + if err != nil { + log.Fatalln(err) + } for _, existingOrg := range s.existingOrganizations { if *existingOrg.Name == org.SafeName() && *existingOrg.ParentOrganizationId == parentOrgId { return existingOrg, nil @@ -370,7 +373,10 @@ func (s *NxiqServer) CreateApplication(app scm.Application, parentOrgId string) } func (s *NxiqServer) ApplicationExists(app scm.Application, parentOrgId string) (*sonatypeiq.ApiApplicationDTO, error) { - s.InitCache() + err := s.InitCache() + if err != nil { + log.Fatalln(err) + } for _, existingApp := range s.existingApplications { if *existingApp.Name == app.SafeName() && *existingApp.OrganizationId == parentOrgId { return existingApp, nil @@ -445,7 +451,10 @@ func (s *NxiqServer) getUniqueOrganizationId(id string) string { } func (s *NxiqServer) ValidateOrganizationByName(organizationName string) *sonatypeiq.ApiOrganizationDTO { - s.InitCache() + err := s.InitCache() + if err != nil { + log.Fatalln(err) + } for _, o := range s.existingOrganizations { if *o.Name == organizationName {