func HandleAll(log *logrus.Entry, ghc githubClient, config *plugins.Configuration) error {
	log.Infof("%v : HandleAll : Checking all PRs for handling", PluginName)

	orgs, repos := config.EnabledReposForExternalPlugin(PluginName) // TODO : Overkill see below

	if len(orgs) == 0 && len(repos) == 0 {
		log.Warnf("HandleAll : No repos have been configured for the %s plugin", PluginName)
		return nil
	}

        // TODO simplify queryOpenPRs
        //      - more general than required
        //      - we deal with a single org and repo
        //      - we target k8s conformance requests sent to the cncf
	var queryOpenPRs bytes.Buffer
	//	fmt.Fprint(&queryOpenPRs, "archived:false is:pr is:open -label:verifiable")
	fmt.Fprint(&queryOpenPRs, "archived:false is:pr is:open ")
	for _, org := range orgs {
		fmt.Fprintf(&queryOpenPRs, " org:\"%s\"", org)
	}
	for _, repo := range repos {
		fmt.Fprintf(&queryOpenPRs, " repo:\"%s\"", repo)
	}
	prs, err := search(context.Background(), log, ghc, queryOpenPRs.String())

	if err != nil {
		return err
	}
	log.Infof("Considering %d PRs.", len(prs))

	for _, pr := range prs {
		org := string(pr.Repository.Owner.Login)
		repo := string(pr.Repository.Name)
		prNumber := int(pr.Number)
		//sha := string(pr.Commits.Nodes[0].Commit.Oid)

                hasReleaseInTitle, releaseVersion, err := HasReleaseInPrTitle(log,ghc,string(pr.Title))

                hasReleaseLabel, err := HasReleaseLabel(log, org, repo, prNumber, ghc, "release-"+releaseVersion)

		e2eLogHasRelease := false
		productYamlCorrect := false
		foldersCorrect := false
		var productYamlDiff string

		prLogger := log.WithFields(logrus.Fields{
			//"org":  org,
			//"repo": repo,
			"pr":   prNumber,
                        "title": pr.Title,
                        "statedRelease": releaseVersion,
		})

		var supportingFiles = make (map[string] github.PullRequestChange)
		changes , err := ghc.GetPullRequestChanges(org, repo, prNumber)
		if err != nil {
			prLogger.WithError(err)
			prLogger.Infof("cGPRC: getting pr changes failed %+v", changes)
		}
		for _ , change := range changes {
			// https://developer.github.com/v3/pulls/#list-pull-requests-files
			supportingFiles[path.Base(change.Filename)] = change
			//prLogger.Infof("cCHSKR: %+v", supportingFiles[path.Base(change.Filename)])
		}
		if hasReleaseInTitle {
			productYamlCorrect, productYamlDiff = checkProductYAMLHasRequiredFields(prLogger,supportingFiles["PRODUCT.yaml"])
			foldersCorrect = checkFilesAreInCorrectFolders(prLogger,supportingFiles, releaseVersion)
			e2eLogHasRelease = checkE2eLogHasRelease(prLogger,supportingFiles["e2e.log"], releaseVersion)

			if err != nil {
				prLogger.WithError(err).Error("Failed to find a release in title")
				githubClient.CreateComment(ghc, org, repo, prNumber, "Please include the release in the title of this Pull Request" )
			}
		}
		hasNotVerifiableLabel, err := HasNotVerifiableLabel(log, org, repo, prNumber, ghc)
                if hasReleaseInTitle && !hasReleaseLabel {
			//                        changesHaveSpecifiedRelease, err := checkChangesHaveStatedK8sRelease(prLogger, ghc, org, repo, prNumber, sha, releaseVersion)

                        if err != nil {
                                prLogger.WithError(err)
                        }

			//log.Infof("cHSR returns %v", changesHaveSpecifiedRelease)
			if productYamlCorrect && foldersCorrect && e2eLogHasRelease && !hasReleaseLabel {
				//   githubClient.AddLabel(ghc, org, repo, prNumber, "verifiable")
                                //githubClient.AddLabel(ghc, org, repo, prNumber, "release-"+releaseVersion)
                                githubClient.AddLabel(ghc, org, repo, prNumber, "release-documents-checked")
                                githubClient.AddLabel(ghc, org, repo, prNumber, "release-"+releaseVersion)
                                githubClient.CreateComment(ghc, org, repo, prNumber, "Found " + releaseVersion + " in logs" )
                                if hasNotVerifiableLabel {
                                        githubClient.RemoveLabel(ghc, org, repo, prNumber, "not-verifiable")
                                }
                        } else { // specifiedRelease not present in logs
                                if !hasNotVerifiableLabel {
                                        // githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
					// githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable.")

					// TODO move changesHaveSpecifiedRelease back into handleall
					// I need to report on individual failures to apply the correct lable
					// the following code is a repeat of the same code we declared in changesHaveSpecifiedRelease


					changes , err := ghc.GetPullRequestChanges(org, repo, prNumber)
					if err != nil {
						prLogger.WithError(err)
						prLogger.Infof("cGPRC: getting pr changes failed %+v", changes)
					}
					for _ , change := range changes {
						// https://developer.github.com/v3/pulls/#list-pull-requests-files
						supportingFiles[path.Base(change.Filename)] = change
						//prLogger.Infof("cCHSKR: %+v", supportingFiles[path.Base(change.Filename)])
					}


					// This is why I repeat the code above, I need to be able to write individual lables based on failure reason

					if !productYamlCorrect {
						var prodYamlDiffString = fmt.Sprintf("%v", productYamlDiff)
						//var prodYamlDiffString, _ = fmt.Println(productYamlDiff)
						prLogger.Infof("pYC in HANDLEALL productYamlCorrect returned %v\n",productYamlCorrect)
						prLogger.Infof("pYDS in HANDLEALL prodYamlDiffString returned %v\n",prodYamlDiffString)
						prLogger.Infof("pYDS in HANDLEALL prodYamlDiffString returned %v\n",productYamlDiff)
						//INFO[0018] pYDS in HANDLEALL prodYamlDiffString returned &{map[name:{}]}  plugin=verify-conformance-request pr=15 statedRelease=v1.18 title="Conformance results for v1│.18 name_missing_from_productYaml"

						githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable, please confirm that your product file ( PRODUCT.yaml ) is named correctly and have all the fields listed in  [How to submit conformance results](https://github.com/cncf/k8s-conformance/blob/master/instructions.md#productyaml) . Please make sure you included the following fields:"+prodYamlDiffString)
						//	githubClient.CreateComment(ghc, org, repo, prNumber, "You are missing the following fields"+prodYamlDiffString)
						if !hasNotVerifiableLabel {
							githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
						}
					}
					if !e2eLogHasRelease {
						prLogger.Infof("eLHR in HANDLEALL e2eLogHasRelease returned %v\n",e2eLogHasRelease)
						githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable, please confirm that your e2e logs reference the release you are submitting for")
						if !hasNotVerifiableLabel {
							githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
						}
					}
					if !foldersCorrect{
						prLogger.Infof("fC in HANDLEALL foldersCorrect returned %v\n",foldersCorrect)
						githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable, please confirm that your supporting files are in the correct folder.")
						if !hasNotVerifiableLabel {
							githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
						}
					}
                                }
                        }
                } else if !hasNotVerifiableLabel && !hasReleaseLabel {
                        githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
                        githubClient.CreateComment(ghc, org, repo, prNumber, "This conformance request is not yet verifiable. Please ensure that PR Title refernces the Kubernetes Release and that the supplied logs refer to the specified Release")
		} //else {
		//   break
		//	}
        }
	return nil
}
// HandleAll is called periodically and the period is setup in main.go
// It runs a Github Query to get all open PRs for this repo which contains k8s conformance requests
//
// Each PR is checked in turn, we check
//   - for the presence of a Release Version in the PR title
//- then we take that version and verify that the e2e test logs refer to that same release version.
//
// if all is in order then we add the verifiable label and a release-Vx.y label
// if there is an inconsistency we add a comment that explains the problem
// and tells the PR submitter to review the documentation
HandleAll is called periodically and the period is setup in main.go
It runs a Github Query to get all open PRs for this repo which contains k8s conformance requests

Each PR is checked in turn, we check
- for the presence of a Release Version in the PR title
then we take that version and verify that the e2e test logs refer to that same release version.

if all is in order then we add the verifiable label and a release-Vx.y label
if there is an inconsistency we add a comment that explains the problem
and tells the PR submitter to review the documentation
// HandleAll is called periodically and the period is setup in main . go // It runs a Github Query to get all open PRs for this repo which contains k8s conformance requests // // Each PR is checked in turn we check // - for the presence of a Release Version in the PR title // - then we take that version and verify that the e2e test logs refer to that same release version . // // if all is in order then we add the verifiable label and a release - Vx . y label // if there is an inconsistency we add a comment that explains the problem // and tells the PR submitter to review the documentation
func HandleAll(log *logrus.Entry, ghc githubClient, config *plugins.Configuration) error {
	log.Infof("%v : HandleAll : Checking all PRs for handling", PluginName)
	orgs, repos := config.EnabledReposForExternalPlugin(PluginName) 
	if len(orgs) == 0 && len(repos) == 0 {
		log.Warnf("HandleAll : No repos have been configured for the %s plugin", PluginName)
		return nil
	}
	var queryOpenPRs bytes.Buffer
	fmt.Fprint(&queryOpenPRs, "archived:false is:pr is:open ")
	for _, org := range orgs {
		fmt.Fprintf(&queryOpenPRs, " org:\"%s\"", org)
	}
	for _, repo := range repos {
		fmt.Fprintf(&queryOpenPRs, " repo:\"%s\"", repo)
	}
	prs, err := search(context.Background(), log, ghc, queryOpenPRs.String())
	if err != nil {
		return err
	}
	log.Infof("Considering %d PRs.", len(prs))
	for _, pr := range prs {
		org := string(pr.Repository.Owner.Login)
		repo := string(pr.Repository.Name)
		prNumber := int(pr.Number)
                hasReleaseInTitle, releaseVersion, err := HasReleaseInPrTitle(log,ghc,string(pr.Title))
                hasReleaseLabel, err := HasReleaseLabel(log, org, repo, prNumber, ghc, "release-"+releaseVersion)
		e2eLogHasRelease := false
		productYamlCorrect := false
		foldersCorrect := false
		var productYamlDiff string
		prLogger := log.WithFields(logrus.Fields{
			"pr":   prNumber,
                        "title": pr.Title,
                        "statedRelease": releaseVersion,
		})
		var supportingFiles = make (map[string] github.PullRequestChange)
		changes , err := ghc.GetPullRequestChanges(org, repo, prNumber)
		if err != nil {
			prLogger.WithError(err)
			prLogger.Infof("cGPRC: getting pr changes failed %+v", changes)
		}
		for _ , change := range changes {
			supportingFiles[path.Base(change.Filename)] = change
		}
		if hasReleaseInTitle {
			productYamlCorrect, productYamlDiff = checkProductYAMLHasRequiredFields(prLogger,supportingFiles["PRODUCT.yaml"])
			foldersCorrect = checkFilesAreInCorrectFolders(prLogger,supportingFiles, releaseVersion)
			e2eLogHasRelease = checkE2eLogHasRelease(prLogger,supportingFiles["e2e.log"], releaseVersion)
			if err != nil {
				prLogger.WithError(err).Error("Failed to find a release in title")
				githubClient.CreateComment(ghc, org, repo, prNumber, "Please include the release in the title of this Pull Request" )
			}
		}
		hasNotVerifiableLabel, err := HasNotVerifiableLabel(log, org, repo, prNumber, ghc)
                if hasReleaseInTitle && !hasReleaseLabel {
                        if err != nil {
                                prLogger.WithError(err)
                        }
			if productYamlCorrect && foldersCorrect && e2eLogHasRelease && !hasReleaseLabel {
                                githubClient.AddLabel(ghc, org, repo, prNumber, "release-documents-checked")
                                githubClient.AddLabel(ghc, org, repo, prNumber, "release-"+releaseVersion)
                                githubClient.CreateComment(ghc, org, repo, prNumber, "Found " + releaseVersion + " in logs" )
                                if hasNotVerifiableLabel {
                                        githubClient.RemoveLabel(ghc, org, repo, prNumber, "not-verifiable")
                                }
                        } else { 
                                if !hasNotVerifiableLabel {
					changes , err := ghc.GetPullRequestChanges(org, repo, prNumber)
					if err != nil {
						prLogger.WithError(err)
						prLogger.Infof("cGPRC: getting pr changes failed %+v", changes)
					}
					for _ , change := range changes {
						supportingFiles[path.Base(change.Filename)] = change
					}
					if !productYamlCorrect {
						var prodYamlDiffString = fmt.Sprintf("%v", productYamlDiff)
						prLogger.Infof("pYC in HANDLEALL productYamlCorrect returned %v\n",productYamlCorrect)
						prLogger.Infof("pYDS in HANDLEALL prodYamlDiffString returned %v\n",prodYamlDiffString)
						prLogger.Infof("pYDS in HANDLEALL prodYamlDiffString returned %v\n",productYamlDiff)
						githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable, please confirm that your product file ( PRODUCT.yaml ) is named correctly and have all the fields listed in  [How to submit conformance results](https://github.com/cncf/k8s-conformance/blob/master/instructions.md#productyaml) . Please make sure you included the following fields:"+prodYamlDiffString)
						if !hasNotVerifiableLabel {
							githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
						}
					}
					if !e2eLogHasRelease {
						prLogger.Infof("eLHR in HANDLEALL e2eLogHasRelease returned %v\n",e2eLogHasRelease)
						githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable, please confirm that your e2e logs reference the release you are submitting for")
						if !hasNotVerifiableLabel {
							githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
						}
					}
					if !foldersCorrect{
						prLogger.Infof("fC in HANDLEALL foldersCorrect returned %v\n",foldersCorrect)
						githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable, please confirm that your supporting files are in the correct folder.")
						if !hasNotVerifiableLabel {
							githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
						}
					}
                                }
                        }
                } else if !hasNotVerifiableLabel && !hasReleaseLabel {
                        githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable")
                        githubClient.CreateComment(ghc, org, repo, prNumber, "This conformance request is not yet verifiable. Please ensure that PR Title refernces the Kubernetes Release and that the supplied logs refer to the specified Release")
		} 
        }
	return nil
}
func HandleAll ( log * logrus . Entry , ghc githubClient , config * plugins . Configuration ) error { log . Infof ( " " , PluginName ) orgs , repos := config . EnabledReposForExternalPlugin ( PluginName ) if len ( orgs ) == 0 && len ( repos ) == 0 { log . Warnf ( " " , PluginName ) return nil } var queryOpenPRs bytes . Buffer fmt . Fprint ( & queryOpenPRs , " " ) for _ , org := range orgs { fmt . Fprintf ( & queryOpenPRs , " \" \" " , org ) } for _ , repo := range repos { fmt . Fprintf ( & queryOpenPRs , " \" \" " , repo ) } prs , err := search ( context . Background ( ) , log , ghc , queryOpenPRs . String ( ) ) if err != nil { return err } log . Infof ( " " , len ( prs ) ) for _ , pr := range prs { org := string ( pr . Repository . Owner . Login ) repo := string ( pr . Repository . Name ) prNumber := int ( pr . Number ) hasReleaseInTitle , releaseVersion , err := HasReleaseInPrTitle ( log , ghc , string ( pr . Title ) ) hasReleaseLabel , err := HasReleaseLabel ( log , org , repo , prNumber , ghc , " " + releaseVersion ) e2eLogHasRelease := false productYamlCorrect := false foldersCorrect := false var productYamlDiff string prLogger := log . WithFields ( logrus . Fields { " " : prNumber , " " : pr . Title , " " : releaseVersion , } ) var supportingFiles = make ( map [ string ] github . PullRequestChange ) changes , err := ghc . GetPullRequestChanges ( org , repo , prNumber ) if err != nil { prLogger . WithError ( err ) prLogger . Infof ( " " , changes ) } for _ , change := range changes { supportingFiles [ path . Base ( change . Filename ) ] = change } if hasReleaseInTitle { productYamlCorrect , productYamlDiff = checkProductYAMLHasRequiredFields ( prLogger , supportingFiles [ " " ] ) foldersCorrect = checkFilesAreInCorrectFolders ( prLogger , supportingFiles , releaseVersion ) e2eLogHasRelease = checkE2eLogHasRelease ( prLogger , supportingFiles [ " " ] , releaseVersion ) if err != nil { prLogger . WithError ( err ) . Error ( " " ) githubClient . CreateComment ( ghc , org , repo , prNumber , " " ) } } hasNotVerifiableLabel , err := HasNotVerifiableLabel ( log , org , repo , prNumber , ghc ) if hasReleaseInTitle && ! hasReleaseLabel { if err != nil { prLogger . WithError ( err ) } if productYamlCorrect && foldersCorrect && e2eLogHasRelease && ! hasReleaseLabel { githubClient . AddLabel ( ghc , org , repo , prNumber , " " ) githubClient . AddLabel ( ghc , org , repo , prNumber , " " + releaseVersion ) githubClient . CreateComment ( ghc , org , repo , prNumber , " " + releaseVersion + " " ) if hasNotVerifiableLabel { githubClient . RemoveLabel ( ghc , org , repo , prNumber , " " ) } } else { if ! hasNotVerifiableLabel { changes , err := ghc . GetPullRequestChanges ( org , repo , prNumber ) if err != nil { prLogger . WithError ( err ) prLogger . Infof ( " " , changes ) } for _ , change := range changes { supportingFiles [ path . Base ( change . Filename ) ] = change } if ! productYamlCorrect { var prodYamlDiffString = fmt . Sprintf ( " " , productYamlDiff ) prLogger . Infof ( " \n " , productYamlCorrect ) prLogger . Infof ( " \n " , prodYamlDiffString ) prLogger . Infof ( " \n " , productYamlDiff ) githubClient . CreateComment ( ghc , org , repo , prNumber , " " + prodYamlDiffString ) if ! hasNotVerifiableLabel { githubClient . AddLabel ( ghc , org , repo , prNumber , " " ) } } if ! e2eLogHasRelease { prLogger . Infof ( " \n " , e2eLogHasRelease ) githubClient . CreateComment ( ghc , org , repo , prNumber , " " ) if ! hasNotVerifiableLabel { githubClient . AddLabel ( ghc , org , repo , prNumber , " " ) } } if ! foldersCorrect { prLogger . Infof ( " \n " , foldersCorrect ) githubClient . CreateComment ( ghc , org , repo , prNumber , " " ) if ! hasNotVerifiableLabel { githubClient . AddLabel ( ghc , org , repo , prNumber , " " ) } } } } } else if ! hasNotVerifiableLabel && ! hasReleaseLabel { githubClient . AddLabel ( ghc , org , repo , prNumber , " " ) githubClient . CreateComment ( ghc , org , repo , prNumber , " " ) } } return nil }
HandleAll is called periodically and the period is setup in main.go
It runs a Github Query to get all open PRs for this repo which contains k8s conformance requests
HandleAll is called periodically and the period is setup in main . go It runs a Github Query to get all open PRs for this repo which contains k8s conformance requests
// TODO : Overkill see below // TODO simplify queryOpenPRs //      - more general than required //      - we deal with a single org and repo //      - we target k8s conformance requests sent to the cncf //	fmt.Fprint(&queryOpenPRs, "archived:false is:pr is:open -label:verifiable") //sha := string(pr.Commits.Nodes[0].Commit.Oid) //"org":  org, //"repo": repo, // https://developer.github.com/v3/pulls/#list-pull-requests-files //prLogger.Infof("cCHSKR: %+v", supportingFiles[path.Base(change.Filename)]) //                        changesHaveSpecifiedRelease, err := checkChangesHaveStatedK8sRelease(prLogger, ghc, org, repo, prNumber, sha, releaseVersion) //log.Infof("cHSR returns %v", changesHaveSpecifiedRelease) //   githubClient.AddLabel(ghc, org, repo, prNumber, "verifiable") //githubClient.AddLabel(ghc, org, repo, prNumber, "release-"+releaseVersion) // specifiedRelease not present in logs // githubClient.AddLabel(ghc, org, repo, prNumber, "not-verifiable") // githubClient.CreateComment(ghc, org, repo, prNumber, "This request is not yet verifiable.") // TODO move changesHaveSpecifiedRelease back into handleall // I need to report on individual failures to apply the correct lable // the following code is a repeat of the same code we declared in changesHaveSpecifiedRelease // https://developer.github.com/v3/pulls/#list-pull-requests-files //prLogger.Infof("cCHSKR: %+v", supportingFiles[path.Base(change.Filename)]) // This is why I repeat the code above, I need to be able to write individual lables based on failure reason //var prodYamlDiffString, _ = fmt.Println(productYamlDiff) //INFO[0018] pYDS in HANDLEALL prodYamlDiffString returned &{map[name:{}]}  plugin=verify-conformance-request pr=15 statedRelease=v1.18 title="Conformance results for v1│.18 name_missing_from_productYaml" //	githubClient.CreateComment(ghc, org, repo, prNumber, "You are missing the following fields"+prodYamlDiffString) //else { //   break //	}