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-4162] Optionally report the most recent commit as the changelog of a new build #1565

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

rhit-gawronja
Copy link

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

JENKINS-4162 - Implementing behavoir to handle JENKINS-4162

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

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

/*
* The MIT License
*
* Copyright (c) 2017 CloudBees, Inc.

Choose a reason for hiding this comment

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

Copyright date should be this year.

Also, check to see if copyright dates may need to be updated in other files modified.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copyright should not be assigned to CloudBees usually. Author usually retains copyright.

Choose a reason for hiding this comment

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

I have removed the CloudBees copyright documentation, would an author descriptor be adequate for this file?

Copy link
Contributor

Choose a reason for hiding this comment

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

Either is fine. If you want to declare copyright explicitly, that is fine. If you don't list it explicitly, the creation of the file makes it copyright by you implicitly.

Thanks for your contribution

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

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.

rhit-inskeeda and others added 2 commits March 22, 2024 12:12
Co-authored-by: UltimateGeek <10050028+UltimateGeek@users.noreply.github.com>
Removed improper CloudBees copyright documentation, updated @param for the constructor
@rhit-gawronja
Copy link
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 MarkEWaite added enhancement Improvement or new feature and removed documentation Improvements or additions to documentation tests Automated test addition or improvement labels Apr 7, 2024
@github-actions github-actions bot added documentation Improvements or additions to documentation tests Automated test addition or improvement labels Apr 8, 2024
@github-actions github-actions bot added the dependencies Dependency related change label Apr 17, 2024
@UltimateGeek
Copy link

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

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

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
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
4 participants