how to connect shared path using jira and read a text files names in jira

Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2022

Hi Team,

I have a scenario like, from JIRA I need to connect to a remote windows machine and read a list of files in a Folder like below it exists.  I need to read all the file anmes and disply in a JIRA cusotm field dropdown.  Please assist me how to connect from JIRA to remote wondows machine and read these files names? 

Remote folder in Windows Maachines.PNG

 

3 answers

0 votes
Snehal Jadhav January 25, 2023

hi @Nic Brough -Adaptavist- 

I am working with Devender, basically we are working on project where we have need to add custom field in jira with version number. we have shared path as mentioned above in which folders describing the version numbers. We have to access folder name and show it in dropdown  as version number. this is requirement. we are not able to access this folder maybe because its on shared path. Do you know how to access it?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 25, 2023

Welcome to the Atlassian Community!

I can think of three ways to do this, but all of them depend on knowing how you are sharing the "shared" directory.  If you cannot access it, there's nothing you can do.

Two of them are going to need you to write an app, not just a script, and the third is going to require you to code something externally (but nothing complex, and Scriptrunner can do all the work inside Jira pretty much off-the-shelf)

They all need to know exactly how the directory is shared, and the apps will require extra libraries to enable the file system reads.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 6, 2022

How are you exposing the file's directory to the network?

You're going to need to write something that can do a "dir" on that shared directory, get the list of file names, and drop it either into the options for a custom field, or into a database so you can use a database-picker field to draw it in.

Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2022

Hi @Nic Brough -Adaptavist- ,

I am using below script and getting this error; An error occurred, the field will have no value

 

Script:-

import groovy.io.FileType 

def list = [] 

def dir = new File("\\..../...APPS/..P01/..Setup/...Releases/..Main System/")

dir.eachFileRecurse (FileType.FILES) { file ->

list << file

println "Hello"

}

==================================

 

An error occured the filed will have no value - JIRA ERROR- Script runner.PNG

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 9, 2022

Your script appears to be referring to a local file, that's not going to work.

Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2022

Hi @Nic Brough -Adaptavist- ,

Could you please share me the code snippet which can be useful in my scenario?

 

Thank you,

Dev G

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2022

I can't - you need to refer to your files via a listing of their network share locations, not a local file location, and I can't know what you've set up!

Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 22, 2022

Hi @Nic Brough -Adaptavist- ,

 

I have a working script for 2 different shared paths like shown below. 

Line (7) , is obsolutley working fine but line (5) is not working where code is same .Shared path errors using Groovy script in JIRA.PNG

 

Please @Nic Brough -Adaptavist- , help me on this issue, its blocking my deleverables form long time. 

 

 

Note:-Same shard path is working using Python but nit with this Groovy in JIRA

 

 

Thank you in advance,

Dev G

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 23, 2022

That doesn't look like a valid path to the JVM.  Not that it's an incorrect string for the path, but it's not shared with the server, so it can't read from it.

0 votes
Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2022

Hi  @Nic Brough -Adaptavist- , 

 

Could you please help in this. Thank you.

Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2022

Hi @Nic Brough -Adaptavist, 

My requirement is "Using JIRA scriopt runner, how can I access a shared folder/files on windows network?".

Then I need to read all the files names and get the list and display on JIRA cusotm filed.

 

Thank you,

Dev G

Suggest an answer

Log in or Sign up to answer