How does Jira edge connector (JEC)?

Martin Kožej January 7, 2025

Hi everybody,

we are trying to use Jira edge connector (JEC) to establish a communication between our Cloud Jira and on-prem tool.

Unfortunately I cannot seem to make it work, so I guess I am missing something. And documentation for JEC is very limited.

So I followed instructions provided by Atlassian: 

Install JEC and prepare config file

{
    "apiKey" : "xxx-xxx-xxx",
    "baseUrl" : "https://api.atlassian.com",
    "logLevel" : "debug",
    "actionMappings" : {
        "testJEC" : {
            "sourceType" : "local",
            "filepath" : "/home/jsm/jec/scripts/othertest.py",
            "env" : [],
            "stdout" : "/home/jsm/jec/output/testout.txt",
            "stderr" :   "/home/jsm/jec/output/testout.txt"
        }
    },
    "pollerConf" : {
        "pollingWaitIntervalInMillis" : 100,
        "visibilityTimeoutInSeconds" : 30,
        "maxNumberOfMessages" : 10
    },
    "poolConf" : {
        "maxNumberOfWorker": 12,
        "minNumberOfWorker": 4,
        "queueSize" : 0,
        "keepAliveTimeInMillis" : 6000,
        "monitoringPeriodInMillis" : 15000
    }
}

Prepare simple script

Simple script othertest.py that just writes text in a file (so that I can see that it has been triggered)

f = open("output.txt", "w")
f.write("Test file\n")
f.close()

Create automation

Automation should trigger action testJEC. Also I used apiKey generated here in the config file.

JEC_automation.png

Run JEC

Run JEC using

 

sudo systemctl start jec

 

So after all this set up, when I trigger my automation, it should call on-prem JEC through Connection and through config file it should select action testJEC which should run a script othertest.py as defined in config file. But nothing happenes. So what am I doing wrong?

I checked and I can ping to my server and from my server to api.atlassian.com. Automation runs successfully. 

1 answer

1 accepted

0 votes
Answer accepted
Nikolai Ruban January 7, 2025

Hi Martin,

do you run JEC in the container or straight on the machine?

are there errors or warnings in the logs of JEC?

Martin Kožej January 15, 2025

Hello Nikolai,

sorry, didn't received any notifications.

For testing purposes I have created VM digitalocean, but JEC is installed directly on this VM.

Systemctl provides no errors nor warnings and as far as I am aware there are no other logs for this. There are no output logs created.

Nikolai Ruban January 15, 2025

Hi @Martin Kožej 

please check the logs JEC log file is located:

On Linux: /var/log/jec/jec<pid>. log.
At the end of the file name of the log, there is program identifier (pid) to identify which process is running.

origin: https://github.com/atlassian/jec/blob/master/README.md

Martin Kožej January 19, 2025

Hey Nikolai,

thanks. Just providing the log location has been a great help.

With my own python script, there was a problem of permissions which I took care of.

I can see that messages are received, but there seems to be some additional issues that I don't understand.

Received 1 messages from the queue[xxx]. 
Job[xxx] is being submitted
Job[xxx] is submitted to worker[xxx]
Message[xxx] is deleted from the queue[xxx].
Could not create named pipe with name /var/tmp/jec/jecCallbackPipe-xxx. Error: no such file or directory
Could not open named pipe to write default callback context
Could not write to named pipe
Action[testJEC] execution of message[xxx] failed: exec: "python": executable file not found in $PATH Stderr:
Job[xxx] has been processed by worker[xxx].
Could not open named pipe. Error: open /var/tmp/jec/jecCallbackPipe-xxx: no such file or directory
Error reading from the named pipe:invalid argument
Could not delete named pipe /var/tmp/jec/jecCallbackPipe-xxx
Successfully sent result of message[xxx] to Jira Service Management and it took 0.313138 seconds.
Nikolai Ruban January 20, 2025

User that runs jec.service should have Write access to the folder /var/tmp/jec

check folder permissions and correct accordingly.

 

Martin Kožej January 23, 2025

Okay, that worked, thanks! Now I can create a namedPipe in /var/tmp/jec, however I ran into another problem when I run jec_action_executor.py:

DEBUG[2025-01-23T09:58:17.793182336Z] Action[createIssue] execution of message[xxx] failed: exit status 2 Stderr: usage: jec_action_executor.py [-h] -payload QUEUEPAYLOAD -apiKey APIKEY
-jsmUrl JSMURL -logLevel LOGLEVEL [-url URL]
[-username USERNAME] [-password PASSWORD]
[-key KEY] [-issueTypeName ISSUETYPENAME]
jec_action_executor.py: error: unrecognized arguments: --jecNamedPipe /var/tmp/jec/jecCallbackPipe-xxx

 Am I just dumb, or should I change something further?

Nikolai Ruban January 23, 2025

I don;t see this parameter in the script. But as far it is called from EdgeConnector it seems you are almost there. :)

Nikolai Ruban January 23, 2025

@Martin KožejOh, I see your config in the description. It is still the same?
In your current example actionMappings:testJEC it points to othertest.py
I wonder where this jecNamedPipe parameter comes from.

Martin Kožej January 24, 2025

The config file is the same, but I did not exclude it all:

{
"apiKey": "xxx",
"baseUrl": "https://api.atlassian.com",
"logLevel": "DEBUG",
"actionMappings": {
"postActionToJEC": {
"filepath": "/home/jsm/jec/scripts/test.py",
"sourceType": "local",
"env": [],
"stdout": "/home/jsm/jec/scripts/test_out.txt",
"stderr": "/home/jsm/jec/scripts/test_err.txt"
},
"testJEC": {
"filepath": "/home/jsm/jec/scripts/othertest.py",
"sourceType": "local",
"env": [],
"stdout": "/home/jsm/jec/scripts/test1_out.txt",
"stderr": "/home/jsm/jec/scripts/test2_err.txt"
},
"createIssue": {
"filepath": "/home/jsm/jec/scripts/jec_action_executor.py",
"sourceType": "local",
"env": [],
"stdout": "/home/jsm/jec/output/out1.txt",
"stderr": "/home/jsm/jec/output/err1.txt"
},
"resolveIssue": {
"filepath": "/home/jsm/jec/scripts/jec_action_executor.py",
"sourceType": "local",
"env": [],
"stdout": "/home/jsm/jec/output/out1.txt",
"stderr": "/home/jsm/jec/output/err1.txt"
},
"addComment": {
"filepath": "/home/jsm/jec/scripts/jec_action_executor.py",
"sourceType": "local",
"env": [],
"stdout": "/home/jsm/jec/output/out1.txt",
"stderr": "/home/jsm/jec/output/err1.txt"
}
},
"pollerConf": {
"pollingWaitIntervalInMillis": 100,
"visibilityTimeoutInSec": 30,
"maxNumberOfMessages": 10
},
"poolConf": {
"maxNumberOfWorker": 12,
"minNumberOfWorker": 4,
"monitoringPeriodInMillis": 15000,
"keepAliveTimeInMillis": 6000,
"queueSize": 0
}
}

It is basic config, I have just added the postActionToJEC and testJEC actions. When I run those two actions, it works just fine. But when I run the createIssue, the error comes up.

As you can see, here are no parameters specified and there is also no mention of jecNamePipe in jec_action_executor.py. So I really have no idea where that parameter comes from.

Nikolai Ruban January 24, 2025

What if you modify jec_action_executor.py and add this missing parameter?

or replace jec_action_executor.py with test.py ?

Martin Kožej January 24, 2025

In the automation I am calling postActionToJEC, testJEC and createIssue.

Both postActionToJEC and testJEC work as intended. The only issue is with createIssue.

For some reason, somewhere, there is parameter --jecNamedPipe added, and the script doesn't know what to do with it.

I looked in both config files at my disposal, but none of them mention this parameter. The files being the one mentioned above and then /etc/systemd/system/jec.service

[Unit]
Description=Jira Edge Connector (JEC)

[Service]
Group=jec
User=jec
Type=simple
ExecStart=/usr/local/bin/JiraEdgeConnector

Environment="JEC_CONF_SOURCE_TYPE=local"
Environment="JEC_CONF_LOCAL_FILEPATH=/home/jsm/jec/conf/jec-config.json"

[Install]
WantedBy=multi-user.target
Nikolai Ruban January 24, 2025

as far there are no documentation yet, just modify config file and replace createissue action script with jec_action_executor.py with test.py

Martin Kožej February 10, 2025

Hey there.

I still don't understand where the parameter is coming from, since it is not in the config file. For some reason JEC is just trying to send additional parameter, if there are other parameters included in the file.

Nonetheless other scripts work well and if I add jecNamedPipe parameter to jec_action_executor.py it works as well.

I have already tested getting info to other system through JEC, so everything is working.

Thank you for your help.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events