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

[JENKINS-68030] Optionally report most recent commit as changelog of a new build #1565

Merged
merged 37 commits into from
Jul 29, 2024

Conversation

rhit-gawronja
Copy link
Contributor

@rhit-gawronja rhit-gawronja commented Mar 20, 2024

JENKINS-68030 - Optionally report the most recent commit as the changelog of a new build

Looking to fix the behavior that is associated with push changes onto a brand new created branch. With these changes when the behavior is selected Jenkins will now present a changelog on the creation of a new branch. The changelog for the first build will be the most recent commit on the branch.

Other issue reports that are related and highlight the complexity of the general case include:

Git doesn't have the concept of a base branch. Many SCM providers (GitHub, Bitbucket, GitLab, Gitea, etc.) have a concept of a target branch, but the git plugin intentionally limits itself to the capabilities provided by command line git. Other plugins (like the GitHub branch source, Bitbucket branch source, GitLab branch source, and Gitea plugins) provide more capabilities and implement those capabilities using the specific APIs of the SCM provider.

Checklist

  • I have read the CONTRIBUTING doc
  • I have referenced the Jira issue related to my changes in one or more commit messages
  • I have added tests that verify my changes
  • Unit tests pass locally with my changes
  • I have added documentation as necessary
  • No Javadoc warnings were introduced with my changes
  • No spotbugs warnings were introduced with my changes
  • Documentation in README has been updated as necessary
  • Online help has been added and reviewed for any new or modified fields
  • I have interactively tested my changes

Types of changes

What types of changes does your code introduce?

  • New feature (non-breaking change which adds functionality)

@rhit-gawronja rhit-gawronja requested a review from a team as a code owner March 20, 2024 14:06
@github-actions github-actions bot added documentation Improvements or additions to documentation tests Automated test addition or improvement labels Mar 20, 2024
@rhit-gawronja rhit-gawronja changed the title Integration Implementing behavoir to handle JENKINS-4162 Mar 20, 2024
@UltimateGeek
Copy link
Contributor

Consider updating the references to "changelog" in documentation to "changeset" to match the keyword used in Jenkinsfiles.

Comment on lines 1503 to 1506
// this is the first time we are building this branch, so there's no base line
// to compare against.
// if we force the changelog, it'll contain all the changes in the repo, which
// is not what we want.
Copy link
Contributor

@UltimateGeek UltimateGeek Mar 20, 2024

Choose a reason for hiding this comment

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

I think this existing comment should be rewritten now that its within the context of the else case of the new option. But, perhaps just removing it would be best.

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed in 61bb758

rhit-inskeeda and others added 2 commits March 22, 2024 12:12
Removed improper CloudBees copyright documentation, updated @param for the constructor
@rhit-gawronja
Copy link
Contributor Author

I have seen this issue in other pull requests (#1556 (comment)) I was wondering if anyone had other insight into this issue of not passing the windows tests?

Use line termination that is consistent with the other files in the repository.

Use import ordering as defined by spotless.
@MarkEWaite MarkEWaite changed the title Implementing behavoir to handle JENKINS-4162 Allow Pipelines to report the most recent commit as the changelog of a new branch Apr 2, 2024
@MarkEWaite MarkEWaite changed the title Allow Pipelines to report the most recent commit as the changelog of a new branch Optionally report the most recent commit as the changelog of a new branch in a Pipeline Apr 2, 2024
@MarkEWaite
Copy link
Contributor

MarkEWaite commented Apr 2, 2024

Needs documentation added to the README that describes how this is used in a Pipeline and how it is displayed to the user when they use the Pipeline snippet syntax generator inside their Jenkins controller.

I created a Pipeline with the Pipeline snippet syntax generator like this:

pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                checkout scmGit(branches: [[name: 'master']], 
                                extensions: [firstBuildChangelog(makeChangelog: true)], 
                                userRemoteConfigs: [[url: 'https://github.com/jenkinsci/git-plugin.git']])
            }
        }
    }
}

@MarkEWaite MarkEWaite changed the title Optionally report the most recent commit as the changelog of a new branch in a Pipeline [JENKINS-4162] Optionally report the most recent commit as the changelog of a new branch in a Pipeline Apr 2, 2024
MarkEWaite added 7 commits May 1, 2024 11:36
The new extension reports the most recent commit as the changelog.
It does not report the changes from a base branch, because there is no
reliable method to identify the base branch from command line git.

Also adjusts capitalization to be consistent with other parts of the
documentation.
@MarkEWaite
Copy link
Contributor

Hi @MarkEWaite, do you think the open items in the checklist in this PR can be checked off, and this merged?

Thanks for asking.

I needed to make several changes to prepare for a final code review and interactive testing.

  • reverted the massive changes that were injected by spotless in 5dfe120 . This repository is not yet ready for spotless to be run on all its source files. There are too many pending pull requests that would be disrupted by that large change.
  • corrected the documentation to match the implemented behavior
  • switched the help file from DOS line endings to Unix line endings

Interactive tests are needed to confirm there are no surprises that automation has missed.

@UltimateGeek
Copy link
Contributor

I needed to make several changes to prepare for a final code review and interactive testing.

Thanks @MarkEWaite . I see the checklist item for the online help updates is still outstanding. Are there any changes with it you'd like @rhit-gawronja or @rhit-inskeeda to make?

@MarkEWaite
Copy link
Contributor

Thanks @MarkEWaite . I see the checklist item for the online help updates is still outstanding. Are there any changes with it you'd like @rhit-gawronja or @rhit-inskeeda to make?

I've completed the changes in the online help and in the documentation. I don't see any further changes that are needed.

@MarkEWaite MarkEWaite removed dependencies Dependency related change documentation Improvements or additions to documentation tests Automated test addition or improvement labels May 6, 2024
@MarkEWaite MarkEWaite changed the title [JENKINS-4162] Optionally report the most recent commit as the changelog of a new branch in a Pipeline [JENKINS-4162] Optionally report the most recent commit as the changelog of a new build May 6, 2024
@UltimateGeek
Copy link
Contributor

Hi @MarkEWaite , do you have an estimate on when this will be ready to merge?

@MarkEWaite
Copy link
Contributor

Hi @MarkEWaite , do you have an estimate on when this will be ready to merge?

I do not. I'm deeply involved in the Spring Security 6.x upgrade and in the preparations for the transition to require Java 17. A release will probably be needed as part of that, but I don't have a timeline for that next release.

@github-actions github-actions bot added documentation Improvements or additions to documentation tests Automated test addition or improvement labels Jul 29, 2024
@MarkEWaite MarkEWaite enabled auto-merge (squash) July 29, 2024 00:20
@MarkEWaite MarkEWaite removed documentation Improvements or additions to documentation tests Automated test addition or improvement labels Jul 29, 2024
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Ready to merge.

@MarkEWaite MarkEWaite merged commit 25ca71b into jenkinsci:master Jul 29, 2024
17 checks passed
MarkEWaite added a commit to MarkEWaite/docker-lfs that referenced this pull request Jul 29, 2024
Incremental that includes:

* Use poll env when checking for ls-remote branches
  jenkinsci/git-plugin#1511

* Optionally report the most recent commit as the changelog of a new build
  jenkinsci/git-plugin#1565
  https://issues.jenkins.io/browse/JENKINS-4162
  https://issues.jenkins.io/browse/JENKINS-14138
  https://issues.jenkins.io/browse/JENKINS-26354
  https://issues.jenkins.io/browse/JENKINS-68030

* Generate and revoke access tokens with standard UI components
  jenkinsci/git-plugin#1597

* Do not assume HttpResponse is a functional interface
  jenkinsci/git-plugin#1590
@MarkEWaite MarkEWaite changed the title [JENKINS-4162] Optionally report the most recent commit as the changelog of a new build [JENKINS-14138] Optionally report the most recent commit as the changelog of a new build Jul 29, 2024
@MarkEWaite MarkEWaite changed the title [JENKINS-14138] Optionally report the most recent commit as the changelog of a new build [JENKINS-68030] Optionally report most recent commit as changelog of a new build Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants