Fetch and keep the issue, also keep the issue_ref

This commit is contained in:
Graham Christensen 2019-01-24 20:31:16 -05:00
parent 9546c2e4aa
commit d6f74507e8
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -7,6 +7,7 @@ use crate::maintainers;
use crate::maintainers::ImpactedMaintainers;
use amqp::protocol::basic::{BasicProperties, Deliver};
use hubcaps;
use hubcaps::issues::Issue;
use ofborg::acl::ACL;
use ofborg::checkout;
use ofborg::commentparser::Subset;
@ -122,11 +123,11 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
let gists = self.github.gists();
let pulls = repo.pulls();
let pull = pulls.get(job.pr.number);
let issue = repo.issue(job.pr.number);
let issue_ref = repo.issue(job.pr.number);
let issue: Issue;
let auto_schedule_build_archs: Vec<systems::System>;
match issue.get() {
match issue_ref.get() {
Ok(iss) => {
if iss.state == "closed" {
self.events.notify(Event::IssueAlreadyClosed);
@ -142,16 +143,19 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
&job.repo.full_name,
);
}
issue = iss;
}
Err(e) => {
self.events.notify(Event::IssueFetchFailed);
info!("Error fetching {}!", job.pr.number);
info!("E: {:?}", e);
return self.actions().skip(&job);
}
}
};
self.tag_from_title(&issue);
self.tag_from_title(&issue_ref);
let mut overall_status = CommitStatus::new(
repo.statuses(),
@ -247,7 +251,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
let changed_paths = co
.files_changed_from_head(&job.pr.head_sha)
.unwrap_or_else(|_| vec![]);
self.tag_from_paths(&issue, &changed_paths);
self.tag_from_paths(&issue_ref, &changed_paths);
overall_status.set_with_description("Merging PR", hubcaps::statuses::State::Pending);
@ -257,11 +261,11 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
info!("Failed to merge {}", job.pr.head_sha);
update_labels(&issue, &["2.status: merge conflict".to_owned()], &[]);
update_labels(&issue_ref, &["2.status: merge conflict".to_owned()], &[]);
return self.actions().skip(&job);
} else {
update_labels(&issue, &[], &["2.status: merge conflict".to_owned()]);
update_labels(&issue_ref, &[], &["2.status: merge conflict".to_owned()]);
}
overall_status
@ -510,7 +514,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
stdenvtagger.changed(stdenvs.changed());
}
update_labels(
&issue,
&issue_ref,
&stdenvtagger.tags_to_add(),
&stdenvtagger.tags_to_remove(),
);
@ -519,7 +523,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
let mut addremovetagger = PkgsAddedRemovedTagger::new();
addremovetagger.changed(&removed, &added);
update_labels(
&issue,
&issue_ref,
&addremovetagger.tags_to_add(),
&addremovetagger.tags_to_remove(),
);
@ -580,7 +584,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
}
update_labels(
&issue,
&issue_ref,
&rebuild_tags.tags_to_add(),
&rebuild_tags.tags_to_remove(),
);