Jack Lloyd-Walters has proposed merging 
~lloydwaltersj/maas-ci/+git/maas-ci-config:fix-external-gh-testers into 
~maas-committers/maas-ci/+git/maas-ci-config:master.

Commit message:
add job name to maas-ansible-collection-job-creator

Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~lloydwaltersj/maas-ci/+git/maas-ci-config/+merge/442268
-- 
Your team MAAS Committers is requested to review the proposed merge of 
~lloydwaltersj/maas-ci/+git/maas-ci-config:fix-external-gh-testers into 
~maas-committers/maas-ci/+git/maas-ci-config:master.
diff --git a/jenkins/jobs/ansible_collection.yaml b/jenkins/jobs/ansible_collection.yaml
index 7076edc..2487e28 100644
--- a/jenkins/jobs/ansible_collection.yaml
+++ b/jenkins/jobs/ansible_collection.yaml
@@ -16,6 +16,10 @@
           name: TARGET_REPO
           description: Git repo to merge Ansible Collections into
           default: https://github.com/maas/ansible-collection
+      - string:
+          name: JOB_NAME
+          description: The testing job to trigger when a PR is found.
+          default: gh-maas-ansible-collection-tester
     triggers:
       - timed: "H/15 * * * *"
     dsl: !include-jinja2: gh_repo_tester.groovy
diff --git a/jenkins/jobs/gh_repo_tester.groovy b/jenkins/jobs/gh_repo_tester.groovy
index 8ebcfda..e1b044c 100644
--- a/jenkins/jobs/gh_repo_tester.groovy
+++ b/jenkins/jobs/gh_repo_tester.groovy
@@ -4,6 +4,7 @@ MAAS_GH_USER = "maas"
 
 def parseJobs(repoName, jsonString) {
     parsed_jobs = new JsonSlurper().parseText(jsonString)
+    println("Jobs to parse: ${parsed_jobs}")
     jobs = []
 
     if (parsed_jobs.size() > 0) {
@@ -112,8 +113,13 @@ pipeline {
                     repo_name = split_repo_url[split_repo_url.length-1]
                     user_name = split_repo_url[split_repo_url.length-2]
                     output = sh(script: "curl -s https://api.github.com/repos/${user_name}/${repo_name}/pulls?state=open";, returnStdout: true).trim()
+                    if (!output.contains("API rate limit exceeded")) {
+                        env._pr_to_review = output
+                    } else {
+                        println("API Limit exceeded, cannot parse jobs")
+                        env._pr_to_review = "[]"
+                    }
                     env._gh_repo_name = repo_name
-                    env._pr_to_review = output
                 }
             }
         }
-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : sts-sponsors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to