Hello!
This is what I'm trying to achieve:
Given a sw issue
When commited
Then fetch the component from the commit and update components field as Compass Component
I've been able to:
From {{commit.url}} I've follow documentation Automation smart values - text fields | Cloud automation Cloud | Atlassian Support
I save the component name on this variable {{Component}}, that I use later.
Creating two variables:
{{ExistingComponents}} = {{#issue.components}}{ "name": "{{name}}"} {{^last}}, {{/}}{{/}}
{{AllComponents}} = {{ExistingComponents}} , { "name": "{{Component}}"}
Editing issue Components field:
{ "fields": { "components" : [ {{AllComponents}} ] } }
All Compass Components were overwrited and when I hover over the components I get this message:
component-name can be removed from this issue, but to add it again, switch to Jira components from the Components page.
For a question like this, context is important for the community to help. Please post the following:
Until we see those...
Have you tried writing those created variables to the audit log when the rule runs to confirm they contain what you expected?
Kind regards,
Bill
Thanks for that information, @David Ortiz Bollain
Please try to stay with one thread when responding. That will help others reading this in the future know if there are multiple possible solutions to the question. Thanks!
When creating variables, I recommend not using names which could be confused (by a person or automation) with existing smart values. One way to do that is to always add a prefix to variable names, for example using varCommit versus Commit.
Back to your question...
After some research, I found this suggestion to add automation support for Compass Components: https://jira.atlassian.com/browse/AUTO-1219 which is marked as "fixed", but I found a problem...my testing shows when using JSON to add the Compass Component by name, it instead adds standard Components to both the issue and project.
Adding it using the Compass Component by ID with JSON does work as expected.
If you only have the name and the Compass Component has already been assigned to issues in the project, you could use the REST API and the Send Web Request action to find the ID, filtering by the componentSource=compass and query=yourName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your quick response.
We will check the workaround and keep an eye on AUTO-1219.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your reply Bill.
We have several company-managed projects that share n Compass components.
We are able to fetch a component from a commit and inform the component field, but Jira do not identify it as a Compass component
On commit creation
1. {{Commit}} variable is {{commit.url}}
2. {{CommitShort}} variable is {{Commit.replace("repo instance", "")}}
3. {{Component}} variable is {{CommitShort.split("/").first}}
After these steps we are able to get the component to add to the issue.
In the following steps we will add the component.
4. We identify the components that are currently in the issue by creating {{Existing.Components}} variable {{#issue.components}}{ "name": "{{name}}"} {{^last}}, {{/}}{{/}}
5. We add the new component identified in step 3. Creating a new variable {{AllComponents}} that concatenates the variables from step 3 and 4: {{ExistingComponents}} , { "name": "{{Component}}"}
6. All components, old and new, are added to the Component field.
{
"fields": {
"components" : [ {{AllComponents}} ]
}
}
Components are informed, but Jira does not consider them to be Compass Components, when we hover over the component we get this information.
These components are present in our Compass Component application, with the same name, but when informed via automation, are not identified as Compass Components, instead old version components are created and informed.
Compass switch is active for those projects.
Overview of the automation:
In this example, we can see how a component is identified from the commit, and shares name with a Compass component already present in the issue.
When editing the component field only one component is informed, a non Compass component, and the Compass component is not present anymore.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.