Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move AbstractBuild/index.jelly to Run/index.jelly #8110

Merged
merged 15 commits into from
Apr 3, 2024

Conversation

janfaracik
Copy link
Contributor

@janfaracik janfaracik commented Jun 8, 2023

Would be good to have some discussion over this.

This PR/discussion proposes moving the build page from AbstractBuild to its parent Run, this is so that plugins that extend Run can use the page rather than having to reimplement it (e.g. like workflow-job-plugin).

It would be preferable to have plugins extend pages rather than to reimplement them to make changes in core easier and more consistent. This will be important with upcoming works on the Jenkins user experience, such as introducing app bars, new widgets and adjusting the sidebar.

For AbstractBuild I've split out Changesets/Upstream and downstream relationships into separate files, one called summary.jelly for use in the summary list, the other into main.jelly.

Searched for classes that extend Run with https://github.com/search?q=org%3Ajenkinsci+%22class%22+%22extends+Run%3C%22&type=code

From that search the following plugins extend Run:

Happy to hear thoughts on the matter (and alternatives if I'm misunderstanding how everything works).

Testing done

  • The AbstractBuild page works as before/looks identical to before.

Proposed changelog entries

  • N/A

Proposed upgrade guidelines

N/A

Submitter checklist

  • The Jira issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples).
    • Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@jenkinsci/sig-ux

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@timja
Copy link
Member

timja commented Jun 9, 2023

@jglick any issues with this? it sounds like a good idea to me

@timja timja requested a review from jglick June 9, 2023 07:22
@timja
Copy link
Member

timja commented Jun 9, 2023

@janfaracik can you file a downstream PR to workflow-job removing it's copy after checking to see if there's any differences?

@janfaracik
Copy link
Contributor Author

@janfaracik can you file a downstream PR to workflow-job removing it's copy after checking to see if there's any differences?

Opened jenkinsci/workflow-job-plugin#364

@daniel-beck
Copy link
Member

daniel-beck commented Jun 9, 2023

index.jelly lists changesets, something available for AbstractBuild but not Run. Same with upstream/downstream relationships.

Therefore most of index.jelly by lines makes no sense for Run. There might be a basic implementation listing actions, but just moving doesn't seem like a clean change.

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per above.

@uhafner
Copy link
Member

uhafner commented Jun 9, 2023

index.jelly lists changesets, something available for AbstractBuild but not Run. Same with upstream/downstream relationships.

Therefore of index.jelly by lines makes no sense for Run. There might be a basic implementation listing actions, but just moving doesn't seem like a clean change.

In this case it would make sense to split the index.jelly into a "frame" jelly page and multiple local parts, that can be implemented or overwritten for specific types. Would that be feasible? @janfaracik did you try to make a diff of both files? Are there other known implementations?

@janfaracik
Copy link
Contributor Author

Would that be feasible?

Yeah. End goal would be a widget system where Jenkins/plugins can plug their own widgets into the page.

@janfaracik did you try to make a diff of both files?

Yeah I went through and I believe the summary components were the only differences.

Are there other known implementations?

I need to have a look around.

jglick
jglick previously requested changes Jun 9, 2023
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What @daniel-beck said, basically. There are other things that do not align. For example the upstream/downstream builds section would not exist for WorkflowRun.

If there are particular sections of the page that seem duplicated and are likely to change often, then introduce a new helper fragment for them, and consume that in workflow-job.

@jglick jglick dismissed their stale review June 12, 2023 15:50

Possibly obsolete

jglick
jglick previously requested changes Jun 12, 2023
Comment on lines 28 to 32
<j:set var="set" value="${it.changeSet}" />
<t:summary icon="symbol-changes">
<j:choose>
<j:when test="${it.hasChangeSetComputed()}">
<st:include it="${set}" page="digest.jelly" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equivalent seems to be missing in the downstream PR.

I think the source of confusion here is that #2730 did not bother to update AbstractBuild/index.jelly to use .changeSets. If we had a mixin view fragment for RunWithSCM then both AbstractBuild and WorkflowRun could use it. (It does not make sense for any Run, specifically https://github.com/jenkinsci/external-monitor-job-plugin/blob/683c09d993b9e9da5f883f4d0696eb45af323b55/src/main/java/hudson/model/ExternalRun.java#L51 which would not implement this interface. Be sure to test against that plugin!)

Copy link
Contributor Author

@janfaracik janfaracik Jul 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if I'm misunderstanding - So add a file that uses the updated changesets method, then <st:include ... /> it in both AbstractBuild/main.jelly and WorkflowRun/main.jelly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes something like that. Could be a file such as RunWithSCM/changeSets.jelly. I do not recall details of how Stapler looks for view fragments, whether it check interfaces or only superclasses, so you would need to play a bit to find the simplest st:include form.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added <st:include page="changesets.jelly" class="jenkins.scm.RunWithSCM" /> to summary.jelly in AbstractBuild and WorkflowRun. The implementation of changesets is different in the two files (as you noted above) with one difference being that WorkflowRun lacks

<!-- dependency changes -->
              <j:set var="depChanges" value="${it.getDependencyChanges(it.previousBuild)}"/>
              <j:if test="${!empty(depChanges)}">
                ${%Changes in dependency}
                <ol>
                  <j:forEach var="dep" items="${depChanges.values()}">
                    <li>
                      <a href="${rootURL}/${dep.project.url}" class="model-link">${dep.project.displayName}</a>
                      <st:nbsp/>
                      <j:choose>
                        <j:when test="${dep.from!=null}">
                          <a href="${rootURL}/${dep.from.url}" class="model-link inside">
                            <l:icon class="${dep.from.buildStatusIconClassName} icon-sm" alt="${dep.from.iconColor.description}"/>${dep.from.displayName}</a>
                        </j:when>
                        <j:otherwise>
                          ?
                        </j:otherwise>
                      </j:choose>

                      &#x2192; <!-- right arrow -->

                      <a href="${rootURL}/${dep.to.url}" class="model-link inside">
                        <l:icon class="${dep.to.buildStatusIconClassName} icon-sm" alt="${dep.to.iconColor.description}" />${dep.to.displayName}</a>

                      (<a href="${rootURL}/${dep.project.url}changes?from=${dep.fromId}&amp;to=${dep.toId}">${%detail}</a>)
                    </li>
                  </j:forEach>
                </ol>
              </j:if>

- Would this be needed in changesets.jelly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not very familiar with this but looks like something never implemented in Pipeline.

In general, for a view refactoring like this it is necessary to examine every line in all variants, figure out what it is doing and where it came from (was this a copy of an old version of something that was since updated at the source?), and decide which parts can be made common without loss of functionality and which intrinsically need customization.

@janfaracik janfaracik changed the title discussion: Move AbstractBuild/index.jelly to Run/index.jelly Move AbstractBuild/index.jelly to Run/index.jelly Jun 16, 2023
@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label Jul 17, 2023
@github-actions
Copy link
Contributor

Please take a moment and address the merge conflicts of your pull request. Thanks!

@github-actions github-actions bot removed the unresolved-merge-conflict There is a merge conflict with the target branch. label Jul 17, 2023
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to be on the right track but there is at least one mistake here. There may be others but I have not gone through each line and tried to verify each one individually; unfortunately without JENKINS-31203 this is a manual process and is something the author should do. (It is nice to leave self-reviews with notes for reviewers.) Should be kept in draft status until the full set of changes including in jenkinsci/workflow-job-plugin#364 is (self-)reviewed and some sanity tests have been run on freestyle builds, Pipeline builds, external builds, and to be on the safe side maybe matrix builds (top-level & configuration) checking that UI elements mentioned in the diff are preserved.

core/src/main/resources/hudson/model/Run/index.jelly Outdated Show resolved Hide resolved
@timja
Copy link
Member

timja commented Aug 19, 2023

Have you checked all the changes now @janfaracik ?

@janfaracik
Copy link
Contributor Author

Have you checked all the changes now @janfaracik ?

These are the checks I've done. Had to make a couple of tweaks regarding AbstractBuild to maintain compatibility but all seems alright.

image

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work great change

@timja timja requested review from jglick, daniel-beck and a team August 20, 2023 15:07
@jglick jglick dismissed stale reviews from daniel-beck and themself August 21, 2023 15:22

have not looked again recently

@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label Nov 18, 2023
Copy link
Contributor

Please take a moment and address the merge conflicts of your pull request. Thanks!

@github-actions github-actions bot removed the unresolved-merge-conflict There is a merge conflict with the target branch. label Nov 20, 2023
@janfaracik
Copy link
Contributor Author

Any thoughts on moving this forward?

@timja timja requested review from NotMyFault and a team November 23, 2023 16:11
@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label Nov 28, 2023
Copy link
Contributor

Please take a moment and address the merge conflicts of your pull request. Thanks!

@github-actions github-actions bot removed the unresolved-merge-conflict There is a merge conflict with the target branch. label Dec 11, 2023
@timja
Copy link
Member

timja commented Dec 16, 2023

@jenkinsci/core-pr-reviewers would someone mind taking a look please?

@timja
Copy link
Member

timja commented Mar 30, 2024

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Mar 30, 2024
@timja timja merged commit ea7c71b into jenkinsci:master Apr 3, 2024
17 checks passed
@timja timja deleted the move-abstractbuildview-to-run branch April 3, 2024 13:01
@basil
Copy link
Member

basil commented May 14, 2024

@basil basil added the ath-fail The acceptance-test-harness suite needs a forward-compatible change label May 14, 2024
@basil
Copy link
Member

basil commented May 14, 2024

Caused JENKINS-73168.

@basil
Copy link
Member

basil commented May 14, 2024

I have added an ATH workaround in jenkinsci/acceptance-test-harness#1545. jenkinsci/acceptance-test-harness#1548 tracks the removal of this workaround as part of fixing JENKINS-73168.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ath-fail The acceptance-test-harness suite needs a forward-compatible change ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants