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

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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            elsabbahyahmed Ahmed Elsabbahy added a comment -

            On a related note, what is the purpose of subclassing Cause.UserIdCause? What does MyUserIdCause do differently?

            Show
            elsabbahyahmed Ahmed Elsabbahy added a comment - On a related note, what is the purpose of subclassing Cause.UserIdCause? What does MyUserIdCause do differently?
            Hide
            patbos Patrik Boström added a comment -
            Show
            patbos Patrik Boström added a comment - Created PR with a proposed fix: https://github.com/jenkinsci/build-pipeline-plugin/pull/64
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Patrik Boström
            Path:
            src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView.java
            src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest.java
            src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/trigger/BuildPipelineTriggerTest.java
            src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/config.xml
            src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/builds/2015-01-06_09-41-20/build.xml
            src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/config.xml
            http://jenkins-ci.org/commit/build-pipeline-plugin/bd77518bb3b9220f979f7906b210b2dd2225bada
            Log:
            [FIXED JENKINS-22665] [FIXED JENKINS-19755] Changed MyUserIdCause to not include the whole User object serialized.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Patrik Boström Path: src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView.java src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest.java src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/trigger/BuildPipelineTriggerTest.java src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/config.xml src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/builds/2015-01-06_09-41-20/build.xml src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/config.xml http://jenkins-ci.org/commit/build-pipeline-plugin/bd77518bb3b9220f979f7906b210b2dd2225bada Log: [FIXED JENKINS-22665] [FIXED JENKINS-19755] Changed MyUserIdCause to not include the whole User object serialized.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kanstantsin Shautsou
            Path:
            src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView.java
            src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest.java
            src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/trigger/BuildPipelineTriggerTest.java
            src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/config.xml
            src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/builds/2015-01-06_09-41-20/build.xml
            src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/config.xml
            http://jenkins-ci.org/commit/build-pipeline-plugin/7e03b73fa2f1e134ebc6c904591ddbe494be478a
            Log:
            Merge pull request #64 from patbos/JENKINS-22665

            [FIXED JENKINS-22665] Fixes for JENKINS-22665 and JENKINS-19755

            Compare: https://github.com/jenkinsci/build-pipeline-plugin/compare/25ccbeff03aa...7e03b73fa2f1

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kanstantsin Shautsou Path: src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView.java src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest.java src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/trigger/BuildPipelineTriggerTest.java src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/config.xml src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/builds/2015-01-06_09-41-20/build.xml src/test/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewTest/testMyUserIdCauseConversion/jobs/B/config.xml http://jenkins-ci.org/commit/build-pipeline-plugin/7e03b73fa2f1e134ebc6c904591ddbe494be478a Log: Merge pull request #64 from patbos/ JENKINS-22665 [FIXED JENKINS-22665] Fixes for JENKINS-22665 and JENKINS-19755 Compare: https://github.com/jenkinsci/build-pipeline-plugin/compare/25ccbeff03aa...7e03b73fa2f1

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: