History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-3255
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Alexey Shumkin
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Add the "store created issue ID to a variable" for "Create GitLab Issue" step

Created: 14/Sep/18 11:01 PM   Updated: 18/Sep/18 10:20 PM
Component/s: None
Affects Version/s: 8.0.14
Fix Version/s: 8.0.20

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
For my workflow it is neccessary to know the newly created issue ID.
I propose to add a setting kinda "Store a created issue ID to a variable" for the "Create GitLab Issue" step to allow user to keep its value to be able to close the issue later in pipeline without a commit message usage.

 All   Comments   Work Log   Change History      Sort Order:
Alexey Shumkin [18/Sep/18 08:57 PM]
Now the created issue(-s) is (are) in related issues.

But there's a question now "How can I get its ID from the build step?". E.g. my workflow is the following:
1. First QB-config "beta-build" creates an application build and creates an task/issue in GitLab for a tester to test the build.
2. Tester tests the application. And if it's ok recommends the build and reassign the GitLab issue to a lead/release manager.
3. Lead/release manager receives a notification from GitLab and promotes the recommended build to "release-build" config which closes issue(-s) opened during "beta-build".

In this workflow, how can I releated issues IDs from "release-build" config? Actually, I can pass them as a promoted variable from "beta-build", but how can I list them (in a script?) after creation?

I've found the following https://support.pmease.com/PMEase/QuickBuild/topics/3143/how-to-get-the-list-of-issue-tracker-issues-for-a-build?0 but it is considering plugin development as I just want to list them in a standard step (somehow).

Alexey Shumkin [18/Sep/18 10:13 PM]
I've solved this with in the following way:

I promote (to "release-build" config) to a variable "GitLabIssueIDs" variable value which is calculated with the following script:

${groovy:

import com.pmease.quickbuild.plugin.tracker.core.utils.TrackerHelper;
import com.pmease.quickbuild.plugin.report.engine.metadata.ReportCategory;
import com.pmease.quickbuild.plugin.report.engine.ReportHelper;
import com.pmease.quickbuild.plugin.scm.gitlab.GitLabPlugin;
import com.pmease.quickbuild.plugin.tracker.core.extensionpoint.Issue;

ReportCategory category = ReportHelper.getCategory(GitLabPlugin.class);

List<Issue> issues = TrackerHelper.getIssues(category, configuration, build.id, build.id, 0, 100, true);
ArrayList<String> issueIDs = new ArrayList<String>();
for (Issue issue: issues) {
  issueIDs.add(issue.issueKey);
\}

String.join(" ", issueIDs);
}

then in a Update GitLab Issue step I use "GitLabIssueIDs" variable value as the "Issue keys" (Nota bene: a list must be a "space-separated" list)

Alexey Shumkin [18/Sep/18 10:20 PM]
Unfortunately, I cannot get list of related issues (with the scripot above) during the build (th elist is empty). I can only get it AFTER the build (during promotion)