As a security precaution, we have turned on the setting "Require API key authentication for API requests" for everyone. If this has broken something, please contact bugzilla-admin@mozilla.org
Last Comment Bug 1224001 - Add push connector for Aha.io
: Add push connector for Aha.io
Status: RESOLVED FIXED
:
Product: bugzilla.mozilla.org
Classification: Other
Component: Extensions: Push (show other bugs)
: Production
: Unspecified Unspecified
: -- normal (vote)
: ---
Assigned To: Dylan Hardison [:dylan]
:
:
Mentors:
Depends on: 1223999
Blocks: 1216643
  Show dependency treegraph
 
Reported: 2015-11-11 14:36 PST by Dylan Hardison [:dylan]
Modified: 2016-01-05 14:57 PST (History)
1 user (show)
See Also:
Due Date:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
1224001_1.patch (5.60 KB, patch)
2015-12-01 07:24 PST, Dylan Hardison [:dylan]
dkl: review-
Details | Diff | Splinter Review
1224001_3.patch (6.01 KB, patch)
2015-12-31 13:38 PST, Dylan Hardison [:dylan]
dkl: review+
Details | Diff | Splinter Review

Description User image Dylan Hardison [:dylan] 2015-11-11 14:36:22 PST
For bugs with a see-also on an aha.io feature, ship the feature when the bug is resolved.

Open question: Do we unship if a bug is re-opened?
Comment 1 User image Dylan Hardison [:dylan] 2015-11-13 06:39:18 PST
I had a meeting with Romain and Karen today, and we're not going to "Ship" features when bugs are closed, but rather mark them as "ready to ship".
Comment 2 User image Dylan Hardison [:dylan] 2015-11-17 14:23:12 PST
Push connector worked! Resolved a bug to fixed and it set my DEMO feature to Ready to Ship. Patch soon.
Comment 3 User image Dylan Hardison [:dylan] 2015-12-01 07:24:05 PST
Created attachment 8694216 [details] [diff] [review]
1224001_1.patch

Finally works. 

To test this you'll need to set up an aha! account.
Go to http://www.aha.io/ to start a free trial. When asked if you want a default set of features (or a "demo" something) say yes. 

For example, I setup bugzilla.aha.io and then added
https://bugzilla.aha.io/features/DEMO-1 to the see also of a bug. When I resolve the bug as fixed it will connect (via the push connector, so the daemon must be running) to aha and mark it as "Ready To Ship". I also added a check to prevent it from taking a Shipped feature and puting it back to "Ready to ship".
Otherwise I've cut down the code to do the bare minimum.
Comment 4 User image David Lawrence [:dkl] 2015-12-01 10:54:14 PST
Comment on attachment 8694216 [details] [diff] [review]
1224001_1.patch

Review of attachment 8694216 [details] [diff] [review]:
-----------------------------------------------------------------

Functions as expected. Just a few minor changes needed.

::: extensions/Push/lib/Connector/Aha.pm
@@ +21,5 @@
> +
> +use DateTime;
> +use JSON 'decode_json', 'encode_json';
> +use LWP::UserAgent;
> +use List::MoreUtils 'any';

'any' not used

@@ +22,5 @@
> +use DateTime;
> +use JSON 'decode_json', 'encode_json';
> +use LWP::UserAgent;
> +use List::MoreUtils 'any';
> +use Scalar::Util 'blessed';

'blessed' not used

@@ +116,5 @@
> +}
> +
> +sub _aha_feature_uri {
> +    my ($self, $feature_id) = @_;
> +    my $uri  = $self->_aha_uri("api/v1/features/$feature_id");

nit: extraneous white space

@@ +124,5 @@
> +
> +sub _aha_update_feature {
> +    my ($self, $feature_id, $workflow_status) = @_;
> +    my $feature_uri = $self->_aha_feature_uri($feature_id);
> +    my $ua  = $self->_user_agent;

ditto

@@ +126,5 @@
> +    my ($self, $feature_id, $workflow_status) = @_;
> +    my $feature_uri = $self->_aha_feature_uri($feature_id);
> +    my $ua  = $self->_user_agent;
> +
> +    $ua->put($feature_uri, 'Content-Type' => 'application/json', Content => encode_json({workflow_status => $workflow_status}));

nit: add whitespace after { and before } for readability

@@ +139,5 @@
> +}
> +
> +sub send {
> +    my ($self, $message) = @_;
> +    my $logger = Bugzilla->push_ext->logger;

$logger not used

@@ +150,5 @@
> +        foreach my $see_also (@{ $bug->see_also }) {
> +            if ($see_also->isa('Bugzilla::BugUrl::Aha')) {
> +                my $feature_id = $see_also->get_feature_id;
> +                my $feature = $self->_aha_get_feature($feature_id);
> +                unless (lc($feature->{feature}{workflow_status}{name}) eq 'shipped') {

we should also check to see if the feature exists as well before trying to update it. the bugzilla user may have entered a bogus feature id.
Comment 5 User image Dylan Hardison [:dylan] 2015-12-31 13:38:04 PST
Created attachment 8703206 [details] [diff] [review]
1224001_3.patch

This should happily ignore invalid features
Comment 6 User image David Lawrence [:dkl] 2016-01-04 13:44:58 PST
Comment on attachment 8703206 [details] [diff] [review]
1224001_3.patch

Review of attachment 8703206 [details] [diff] [review]:
-----------------------------------------------------------------

r=dkl
Comment 7 User image Dylan Hardison [:dylan] 2016-01-05 14:57:06 PST
To ssh://gitolite3@git.mozilla.org/webtools/bmo/bugzilla.git
   efe494e..ead96ae  master -> master

Note You need to log in before you can comment on or make changes to this bug.