Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-19755

Manual step "started by" username changes to anonymous after restart

XMLWordPrintable

      Steps to reproduce:

      • Log in
      • Run any job that's marked as a manual step
      • The build should now say "Started by user <logged_in_username>"
      • The api/xml for the build should have both a userId and userName xml tag for your user.
      • Restart Jenkins

      What is displayed?

      • Build will say "started by anonymous"
      • api/xml for the build will have userName, but not userId
      • In script console, getUserId() for the build's MyUserIdCause returns null:
        def getJobCause(jobName, jobNumber) {
        def job = Jenkins.getInstance().getItemByFullName(jobName, Job.class);
        def build = job.getBuildByNumber(jobNumber);
        def actions = build.getActions(hudson.model.CauseAction)[0];
        actions.getCauses()[0];
        }

      cause = getJobCause(<my_job_name>, <my_build_number>);
      println cause.getUserId(); // this will return null

      What is expected?

      • Build to display "Started by user <logged_in_username>"
      • The cause userId to not be null in both rest api and groovy api.

            Unassigned Unassigned
            elsabbahyahmed Ahmed Elsabbahy
            Votes:
            6 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: