We have a special Jira setup so that 1 Epic in our master project = 1 Jira project full of stories/bugs/etc (Governance/compliance wanted this)
Each Issue type has a custom column called 'Ideal days'
For each Epic to get the total estimated days we have a custom function that Sums all 'Ideal days' of issues linked to that Epic that are in the backlog (we manually do this).
With Groovy Runner can I auto-link all issues in a project (in the backlog) to an Epic? Thanks
If you want to link issues without cloning them, you should use IssueLinkManager.getLinkCollection().
The code should look something something like this:
IssueLinkManager issueLinkManager = ComponentManager.getInstance().getIssueLinkManager()
issueLinkManager.getLinkCollection(someIssue, yourUser).each() {
it.getOutwardIssues("Some Link Name")
}
There is a built-in script that clones an issue and links it. You should be able to link based on that code: https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Clonesanissueandlinks
Related
I have 100+ feature files that each year need to be updated with the year of the request ie this year they show 22-23 but next it will be 23-24 in almost every test. We created a step that allowed us to us a variable instead that we set in config eg
currentYear: 22-23
which we can then manipulate in our step to use currentYear+1 currentYear-5 etc. This all works fine and means that annually we simply change the config however on the output it shows the variable name rather than the value...eg
And Path Parameters:
year: [currentYear]
What I need it to do is show that as the value it actually used.
year: 22-23
No doubt this is something simple but I can't quite seem to get it! Any pointers would be greatly appreciated.
If you are using Maven you can filter resources before they're used in a test. This would allow you to use a variable in your feature files and have it replaced when tests are executed.
https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
I'm certain Gradle has a similar feature.
Note that these filtered resources will be put on the classpath. So you should use classpath:com/example.feature as your feature path and not src/main/resources/com/example.feature. If JUnit 5 is used #SelectClasspathResource("com/example.feature").
We have a copy of to-be-continuous at Orange, which is currently used like this:
include:
# Python template
- project: "to-be-continuous/python"
ref: "1.2.2"
file: "/templates/gitlab-ci-python.yml"
However I have no idea how the sync works with the Orange repo, and I'm thinking it's better to make all projects directly include the gitlab.com link for faster access to new functionnalities, what do you think, do you expect any issues, security or operational wise?
include:
# Python template
- remote: 'https://gitlab.com/to-be-continuous/python/-/raw/1.2.2/templates/gitlab-ci-python.yml'
To-be-continuous at Orange are syncronised every night with gitlab.com. So you don't miss any newer functionalities. My suggestion is to use 1st include, because our internal repo have more customisation for our needs like devops-store variant, ODE..
Prefer use first include for all current cases.
You have to use second include for example to validate a new functionality not yet merged.
The include/remote may work but requires that your GitLab server has a direct access to the referenced link (gitlab.com in your case).
/!\ the include/remote syntax doesn't not support double include: when you're trying to include a template that itself includes a (local) template.
Is there an out of the box feature to automatically close issues that have not had any activity for a specific period of time e.g. 4 weeks?
If not, what would be the best way to go about implementing this for my Group's issues?
It does not exist per se but you can prepare a script to run into a cronjob or similar tool, so you regularly clean these issues. The script could use the GitLab Issue API, and check issue dates to determine whether to close a specific issue or not. The API has all the required tools for you to make this script with the described logic.
I'm not familier with such option but you can look into Issues list and sort by created or updated.
This solution uses the python-gitlab package. It gets all group issues, adds a comment to those that have been inactive and closes them.
Only prerequisites are to
get a PRIVATE_TOKEN and add it to your environment
find out your group ID and add it below
import datetime
import os
import gitlab
stale_before = datetime.date.today() - datetime.timedelta(days=28)
gl = gitlab.Gitlab(
url="https://gitlab.example.com", private_token=os.environ["PRIVATE_TOKEN"]
)
group = gl.groups.get(123) # your group ID
issues = group.issues.list(all=True, state="opened")
for issue in issues:
updated_at = datetime.datetime.fromisoformat(issue.updated_at).date()
if updated_at < stale_before:
print(f"Closing issue #{issue.iid} (last activity on {updated_at}).")
issue.notes.create({"body": "Closing for inactivity."})
issue.state_event = "close"
issue.save()
In the question Query JIRA versions using wildcards with JQL
The answer is to use something like project=MYPROJ and fixversion in versionMatch("DEVX*") using the asterix at DEVX*.
In my case I have: getting all the issues from CBS-6840 up to CBS-6849
project = CBS AND key in ("CBS-684")*
Similar to the question above what would a need to add instead of versionMatch
You might look at the many add-ons in the Atlassian Marketplace to see if anyone has scripted functions to provide the sort of functionality you are looking for. A pretty accessible work-around that I would suggest is below (using the JIRA / Hipchat issues themselves as an example). It uses the strict ordered-ness of JIRA keys without needing a wildcard.
project = HCPUB and issuekey >= "HCPUB-730" and issuekey <= "HCPUB-739"
You can also always generate the list yourself, which can be a little tedious:
project = HCPUB and issuekey in ('HCPUB-730','HCPUB-731',...)
I'm using Jira and the Script Runner plugin to Create a sub-task on transition. That's all working well. However, I cannot seem to set the 'Assignee' of the Subtask to match the value of the 'Project Manager' listed on the parent (I believe this is a custom field). Below is what I am using, But it does not work. What is the correct way to write this?:
issue.assignee = transientVars["originalissueobject"].cfValues['Project Manager']
Try this:
issue.assignee= ApplicationUsers.toDirectoryUser(cfValues['Project Manager'])
ACG, I wasn't able to get your answer to work, but I found a very similar script here that worked perfectly! Thank you so much for your help!
import com.atlassian.jira.user.ApplicationUsers
cfParent = customFieldManager.getCustomFieldObjectByName('Project Manager')
parentMyFieldValue = transientVars["issue"].getCustomFieldValue(cfParent)
issue.setAssignee(ApplicationUsers.toDirectoryUser(parentMyFieldValue))
For those looking at this answer with a similar problem. Place this code in the "Additional Issue Action" Box within Script Runner's "Create Subtask" Post Function.