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 33445] Allow tags & remote branches #407

Closed
wants to merge 4 commits into from

Conversation

@deece
Copy link

commented Jun 1, 2016

This pull request adds support for optionally returning tags and remote branches from the specified repository, in addition to the local branches.

This allows an aggregate repository to be created, with remotes pointing to a number of other repositories, and have each branch under them made available for testing within a single (multibranch) job.

This behavior is off by default, and configurable via the Git global settings.

Use case:
A single Jenkins job that feeds from an aggregate repository with remotes for upstream & local development repositories. Upstream releases & stable branches need to be built & tested, as do all local development branches.

@deece deece force-pushed the deece:JENKINS-33445 branch from 45dc7f1 to ad4ee53 Jan 8, 2017
@deece

This comment has been minimized.

Copy link
Author

commented Jan 8, 2017

Rebased on master

@deece

This comment has been minimized.

Copy link
Author

commented Feb 15, 2017

Copy link
Member

left a comment

Not implementing Tag support correctly per the SCM API

@@ -311,8 +369,8 @@ public SCMProbeStat stat(@NonNull String path) throws IOException {
continue;
}
}
SCMHead head = new SCMHead(branchName);
SCMRevision hash = new SCMRevisionImpl(head, b.getSHA1String());
SCMHead head = new SCMHead(name);

This comment has been minimized.

Copy link
@stephenc

stephenc Feb 17, 2017

Member

If it is a Tag then should not be returning the SCMHead object rather an SCMHead that implements the TagSCMHead mixin interface.

@deece

This comment has been minimized.

Copy link
Author

commented Feb 17, 2017

Thanks, I'll have a look on Monday

@deece deece force-pushed the deece:JENKINS-33445 branch from 23f3c29 to e3c9d06 Feb 20, 2017
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Copy link
Member

left a comment

Needs reworking to adapt to traits. If you are not interested in trying to adapt to traits please close so that others may be encouraged to pick up.

Also currently facing merge conflicts

@@ -101,6 +106,27 @@
* @author Stephen Connolly
*/
public abstract class AbstractGitSCMSource extends SCMSource {
class TagSCMHeadImpl extends SCMHead implements TagSCMHead {

This comment has been minimized.

Copy link
@stephenc

stephenc Aug 3, 2017

Member

Please put this as a top level public class, probably GitTagSCMHead

@@ -243,22 +310,52 @@ protected void retrieve(@CheckForNull final SCMSourceCriteria criteria,
@Override
public Void run(GitClient client, String remoteName) throws IOException, InterruptedException {
final Repository repository = client.getRepository();
listener.getLogger().println("Getting remote branches...");
listener.getLogger().println("Getting remote branches/tags...");

This comment has been minimized.

Copy link
@stephenc

stephenc Aug 3, 2017

Member

Probably have the context information to be able to report whether it is tags or branches or both, would be good to use that rather than a generic message as it helps users debug

List<GitObject> gitObjects = new ArrayList<GitObject>();
gitObjects.addAll(client.getRemoteBranches());

Hudson hudson = Hudson.getInstance();

This comment has been minimized.

Copy link
@stephenc

stephenc Aug 3, 2017

Member

🐛 no guarantee that this code executes on the master JVM

Hudson hudson = Hudson.getInstance();
DescriptorImpl descriptor = (DescriptorImpl) hudson.getDescriptor(GitSCM.class);

if (descriptor.isShowTags()) {

This comment has been minimized.

Copy link
@stephenc

stephenc Aug 3, 2017

Member

🐛 fetching tags should be determined by a TagDiscoveryTrait not some setting on a global descriptor

return refSpecs;
}

hudson.plugins.git.GitSCM.DescriptorImpl descriptor = (hudson.plugins.git.GitSCM.DescriptorImpl) hudson.getDescriptor(GitSCM.class);

This comment has been minimized.

Copy link
@stephenc

stephenc Aug 3, 2017

Member

🐛 Use a TagDiscoveryTrait

@@ -11,6 +11,12 @@
<f:entry title="${%Create new accounts base on author/committer's email}" field="createAccountBasedOnEmail">
<f:checkbox name="createAccountBasedOnEmail" checked="${descriptor.createAccountBasedOnEmail}"/>
</f:entry>
<f:entry title="Show remote branches in SCMSource" field="showRemoteBranches">

This comment has been minimized.

Copy link
@stephenc

stephenc Aug 3, 2017

Member

🐛 This should not be a global config but a TagDiscoveryTrait

@deece

This comment has been minimized.

Copy link
Author

commented Aug 4, 2017

I'll have a crack at it next week

@stephenc

This comment has been minimized.

Copy link
Member

commented Oct 23, 2017

I believe this has been superseded by #528

@stephenc stephenc closed this Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.