-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Changes from 7 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
3e62161
Add files via upload
rhit-inskeeda 838cc41
code for gui
rhit-inskeeda d76a507
trait file
rhit-inskeeda 5f681b3
gitscm changes
rhit-inskeeda 756f77c
testing for new trait behavior
rhit-inskeeda b5ba0e8
Merge pull request #1 from rhit-inskeeda/new-trait
rhit-inskeeda d6f6cf9
null check time
rhit-gawronja 27d5942
update to proper version number
rhit-inskeeda ce2fd99
Update FirstBuildChangelogTrait
rhit-inskeeda d17fafd
Merge branch 'master' into integration
MarkEWaite 370d763
Format new files with spotless:apply
MarkEWaite c66d139
Remove trailing space characters
MarkEWaite 88640c5
Changed equals to use proper equals method
rhit-gawronja 62aad20
Changed equals to use proper equals method
rhit-gawronja cab31cc
Changed equals to use proper equals method
rhit-gawronja baa7384
Merge remote-tracking branch 'origin/integration' into integration
rhit-gawronja 84846d7
changed to compatible equal
rhit-gawronja 6f4fa4d
Fix Mark's poor code review
MarkEWaite 1664429
Use leading lower case letter for the symbol
MarkEWaite 47ab82b
Use sentence case for display name
MarkEWaite a9eacdf
Set API release to 5.3.0
MarkEWaite 24c444b
Merge branch 'master' into integration
MarkEWaite 143b0d2
removed groovy and checkbox
rhit-inskeeda ae92de6
Merge pull request #2 from rhit-inskeeda/no-groovy
rhit-inskeeda 5dfe120
Update to documentation and applying spotless
rhit-gawronja a803d34
Pushing documentation image
rhit-gawronja 45e7fff
Undo spotless changes - not ready for spotless
MarkEWaite 4499e95
Reduce doc diffs
MarkEWaite 591d0da
Merge branch 'master' into integration
MarkEWaite 8df79db
Use Unix file format for help
MarkEWaite 667a4fa
Jenkins Pipeline symbols start with a lower case letter
MarkEWaite 11955ee
Remove blank line from doc example
MarkEWaite 34be383
First build changelog reports most recent commit as changelog
MarkEWaite 13816f4
Format new example same as prior examples.
MarkEWaite 81606a6
Clarify first build option help and docs
MarkEWaite b449318
Merge branch 'master' into integration
MarkEWaite 61bb758
Remove comment as suggested by reviewer
MarkEWaite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/main/java/hudson/plugins/git/extensions/impl/FirstBuildChangelog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package hudson.plugins.git.extensions.impl; | ||
rhit-gawronja marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import hudson.Extension; | ||
import hudson.plugins.git.extensions.GitSCMExtension; | ||
import hudson.plugins.git.extensions.GitSCMExtensionDescriptor; | ||
import java.util.Objects; | ||
|
||
import org.jenkinsci.Symbol; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
|
||
/** | ||
* First Build generates a changelog. | ||
* | ||
* @author Derek Inskeep | ||
*/ | ||
public class FirstBuildChangelog extends GitSCMExtension { | ||
private boolean makeChangelog; | ||
|
||
@DataBoundConstructor | ||
public FirstBuildChangelog() { | ||
} | ||
|
||
public boolean isMakeChangelog() { | ||
return makeChangelog; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setMakeChangelog(boolean makeChangelog) { | ||
this.makeChangelog = makeChangelog; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
FirstBuildChangelog that = (FirstBuildChangelog) o; | ||
return makeChangelog == that.makeChangelog; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public int hashCode() { | ||
return Objects.hash(makeChangelog); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public String toString() { | ||
return "FirstBuildChangelog{" + | ||
"makeChangelog=" + makeChangelog + | ||
'}'; | ||
} | ||
|
||
@Extension | ||
@Symbol("FirstBuildChangelog") | ||
public static class DescriptorImpl extends GitSCMExtensionDescriptor { | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public String getDisplayName() { | ||
return "First Build Changelog"; | ||
} | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
src/main/java/jenkins/plugins/git/traits/FirstBuildChangelogTrait.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2017 CloudBees, Inc. | ||
MarkEWaite marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
*/ | ||
|
||
package jenkins.plugins.git.traits; | ||
|
||
import hudson.Extension; | ||
import hudson.plugins.git.extensions.impl.FirstBuildChangelog; | ||
import jenkins.scm.api.trait.SCMSourceTrait; | ||
import org.jenkinsci.Symbol; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
import edu.umd.cs.findbugs.annotations.CheckForNull; | ||
|
||
/** | ||
* Exposes {@link FirstBuildChangelog} as a {@link SCMSourceTrait}. | ||
* | ||
* @since 3.4.0 | ||
rhit-inskeeda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
public class FirstBuildChangelogTrait extends GitSCMExtensionTrait<FirstBuildChangelog> { | ||
|
||
/** | ||
* @deprecated Use constructor that accepts extension instead. | ||
*/ | ||
@Deprecated | ||
public FirstBuildChangelogTrait() { | ||
this(null); | ||
} | ||
|
||
/** | ||
* Stapler constructor. | ||
* | ||
* @param extension the option to clean subdirectories which contain git repositories. | ||
*/ | ||
@DataBoundConstructor | ||
public FirstBuildChangelogTrait(@CheckForNull FirstBuildChangelog extension) { | ||
super(extension == null ? new FirstBuildChangelog() : extension); | ||
} | ||
|
||
/** | ||
* Our {@link hudson.model.Descriptor} | ||
*/ | ||
@Extension | ||
@Symbol("FirstBuildChangelog") | ||
public static class DescriptorImpl extends GitSCMExtensionTraitDescriptor { | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public String getDisplayName() { | ||
return "First Build Changelog"; | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/hudson/plugins/git/extensions/impl/FirstBuildChangelog/config.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package hudson.plugins.git.extensions.impl.FirstBuildChangelog | ||
|
||
def f = namespace(lib.FormTagLib) | ||
|
||
f.entry(field: "makeChangelog") { | ||
f.checkbox(title: _("Make Changelog")) | ||
} | ||
rhit-gawronja marked this conversation as resolved.
Show resolved
Hide resolved
|
3 changes: 3 additions & 0 deletions
3
.../resources/hudson/plugins/git/extensions/impl/FirstBuildChangelog/help-makeChangelog.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
First builds create changelog of latest commit, if any. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
src/main/resources/hudson/plugins/git/extensions/impl/FirstBuildChangelog/help.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
First builds will populate the changelog with the latest commit, if any, to allow for pipelines to consistently check and test for file changes. | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 61bb758