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

Implemented getAffectedFiles in ChangeSet #77

Merged
merged 1 commit into from
May 26, 2016

Conversation

drphrozen
Copy link
Contributor

Should fix bug when using slack and tfs within the same project

@drphrozen
Copy link
Contributor Author

@olivierdagenais hi, is it possible to get this minor update into the next release? I looked at how the svn plugin implemented the function and made the appropriate changes to the ChangeSet file. The ChangeSet.Item now implements the AffectedFile interface, but it already had all the functionality and it should be safe to return the "items" field directly since this is what the svn plugin does.

And thanks for the work on this plugin, it really comes in handy! 👍

@olivierdagenais
Copy link
Member

Would you be able to describe the manual testing you performed to demonstrate these changes were necessary and sufficient to accomplish a given scenario? Take a look at some recent pull requests of mine for examples of the "Manual testing" I'm looking for.

Thanks!

  • Oli

@drphrozen
Copy link
Contributor Author

I can try.

Manual testing

  1. Install the Slack Notification Plugin.
  2. Create a new job
    1. Select Team Foundation Server under Source Code Management and configure to get source code from a TFVC project.
    2. Add a checkmark in the "Poll source control (SCM)" and add a timeplan (i used * * * * * for testing)
    3. Add a build step just to see the build doing something. I used Execute Windows batch command set to dir /s
    4. Add post-build action "Slack Notifications".
      • Add a checkmark in "Notify Build Start"
  3. Commit any file to the configured TFVC project.
  4. Await the project getting triggered, this is important since the "Build now" doesn't seem to trigger slack notifications at the moment.
  5. We expect to see no exceptions. Before this fix the output was:
FATAL: getAffectedFiles() is not implemented by this SCM
java.lang.UnsupportedOperationException: getAffectedFiles() is not implemented by this SCM
    at hudson.scm.ChangeLogSet$Entry.getAffectedFiles(ChangeLogSet.java:242)
    at jenkins.plugins.slack.ActiveNotifier.getChanges(ActiveNotifier.java:131)
    at jenkins.plugins.slack.ActiveNotifier.started(ActiveNotifier.java:69)
    at jenkins.plugins.slack.SlackNotifier.prebuild(SlackNotifier.java:201)
    at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837)
    at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832)
    at hudson.model.Build$BuildExecution.doRun(Build.java:144)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE

@olivierdagenais
Copy link
Member

Thank you for the manual testing description! I wasn't able to configure the Slack plugin to get it to work (the Slack plugin's page doesn't say how to obtain an Integration Token and all the inline documentation links are broken on my system, for some reason), however I will take your word for it!

@olivierdagenais olivierdagenais merged commit 91faeaf into jenkinsci:master May 26, 2016
@olivierdagenais
Copy link
Member

Thank you @drphrozen for the pull request!

@drphrozen
Copy link
Contributor Author

@olivierdagenais thank you :) .. and i should have said that it didn't matter if you configured the plugin, the exception would happen anyways. I will be more explicit on future explanations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants