geerlingguy / drupalci-sonar-jenkins

DEPRECATED - Drupal CI environment with SonarQube and Jenkins for Drupal Core code analysis.
41 stars 16 forks source link

ERROR: anonymous is missing the Job/Create permission #25

Closed scottrigby closed 6 years ago

scottrigby commented 7 years ago

Got to run for tonight, but ran across another issue:

TASK [Import the Jenkins jobs.] ************************************************
failed: [drupalci] (item=7) => {"changed": false, "cmd": "java -jar /opt/jenkins-cli.jar -s http://drupalci:8080/ create-job \"Drupal 7\" < /root/Drupal7.xml", "delta": "0:00:01.879365", "end": "2017-02-15 17:11:15.887110", "failed": true, "failed_when_result": true, "item": "7", "rc": 6, "start": "2017-02-15 17:11:14.007745", "stderr": "\nERROR: anonymous is missing the Job/Create permission", "stdout": "", "stdout_lines": [], "warnings": []}
failed: [drupalci] (item=8) => {"changed": false, "cmd": "java -jar /opt/jenkins-cli.jar -s http://drupalci:8080/ create-job \"Drupal 8\" < /root/Drupal8.xml", "delta": "0:00:01.797923", "end": "2017-02-15 17:11:21.969324", "failed": true, "failed_when_result": true, "item": "8", "rc": 6, "start": "2017-02-15 17:11:20.171401", "stderr": "\nERROR: anonymous is missing the Job/Create permission", "stdout": "", "stdout_lines": [], "warnings": []}

Seems to be related to https://issues.jenkins-ci.org/browse/JENKINS-21086

There the recommended fix was logging into Jenkins CLI first, like this:

@@ -26,6 +26,7 @@
 # SEE: http://stackoverflow.com/a/9954283/100134
 - name: Import the Jenkins jobs.
   shell: >
+    java -jar {{ jenkins_jar_location }} -s http://{{ inventory_hostname }}:8080 login --username "$JCLIUSER" --password "$JCLIPASSWD"
     java -jar {{ jenkins_jar_location }} -s http://{{ inventory_hostname }}:8080/
     create-job "Drupal {{ item }}" < {{ workspace }}/Drupal{{ item }}.xml
   register: import
diff --git a/provisioning/vars/main.yml b/provisioning/vars/main.yml
index b21c976..517a845 100644
--- a/provisioning/vars/main.yml
+++ b/provisioning/vars/main.yml

I have to run now otherwise would test it. Not sure if $JCLIUSER and $JCLIPASSWD are available env vars on the server or not?

scottrigby commented 7 years ago

That seems to have worked

geerlingguy commented 6 years ago

This project is being deprecated (though the underlying roles are still maintained); please see https://github.com/geerlingguy/drupalci-sonar-jenkins/issues/27