Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JEC Callback from Scripting in PowerShell

Benjamin Sørensen
October 16, 2025

Hey all,

 

Has anyone gotten Callback to work when having JEC trigger PowerShell scripts via an Automation?

I've been trying, and cannot for the life of me get it to work.

I'm writing some very simple JSON back into the Named Pipe during the execution, but the smart value {{jecAction.output}} never returns anything other than "Execution Finished!"

3 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Benjamin Sørensen
December 16, 2025

Made it work in PowerShell, but the function is useless to us after all duo to how little data can be passed to the Named Pipe

0 votes
Gideon Nolte _Eficode_
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 Champions.
December 11, 2025

Hi @Benjamin Sørensen

I'm not that sure, that json would work. It took me some time to get it to work with strings. Assuming, you got the pipe info provided from the invocation ("\\.\pipe\jecCallbackPipe-xxxxxx") in a var called $jecNamedPipe, the code below should allow you to send back $resp

 

$resp = "No error"

$pipeName = [System.IO.Path]::GetFileName($jecNamedPipe)
$pipe = New-Object System.IO.Pipes.NamedPipeClientStream($pipeName)
$pipe.Connect() # waits for server
$writer = New-Object System.IO.StreamWriter($pipe)
$writer.AutoFlush = $true

$writer.WriteLine($resp)
$writer.Flush()

$writer.Dispose()
$pipe.Dispose()

With my initial setup, I tried to create a stream for $jecNamedPipe (the path) but NamedPipeClientStream only expects the name... 

Hope this helped.

Best regards
Gideon from Eficode

0 votes
Antoine _Klee Group_
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 Champions.
December 11, 2025

Same question here.

Benjamin Sørensen
December 11, 2025

Hi Antoine,

I ended up getting a working script.

JEC Pipelines however has such a rediculously small character limit that it is unusable for our case.

Let me know if you want the working PowerShell code snippit

Antoine _Klee Group_
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 Champions.
December 12, 2025

Hi Benjamin, what do you mean by the jec pipeline (i don't know anything about powershell advanced scripting sorry)

Benjamin Sørensen
December 12, 2025

JEC Uses a technology called Named Pipes to read data back into Jira Automation when you execute an on-premises script.

It's a small type of data storage that exists in-memory.

Issue is, Atlassian has coded JEC to close the storage when you write X amount of data (The largest data I could send back into Jira Automation was somthing like 1024 Characters, which doesn't give me a lot of room for data), which makes it basically unusable for us. This means when we use JEC to grab some data On-Premises with PowerShell and send it back through the Named Pipe, we could risk the comment containing the data to just cut off halfway through the paragraph.

I ended up writing a small PowerShell function that sends data back into Jira through the REST-API instead, to comment the data on the Work Item that triggered the Jira Automation

Like Antoine _Klee Group_ likes this
Antoine _Klee Group_
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 Champions.
December 16, 2025

Alright thanks.

How do I "return" data to this "named pipe" ? Do you have some MWE in Powershell (and hopefully Python as well...)

Benjamin Sørensen
December 16, 2025

Here's a PowerShell Function you can use in your script to write some data to the pipe. You can adjust the sleep timers to something less than 5 seconds if your system can handle it.

The Parameter $PipeName is passed to your script by JEC as the 9'th argument. In your script you can access it with the variable $args[9]

So to use the function here in your script, you would as an example do:

Write-JecPipe -PipeName $args[9] -Content "FooBar"

Here's the function:

function Write-JecPipe {

    param (

        [Parameter(Mandatory = $true)]$PipeName,

        [Parameter(Mandatory = $true)]$Content

    )

    $pipe = [System.IO.Pipes.NamedPipeClientStream]::new(".", $PipeName.Split("\")[4], [System.IO.Pipes.PipeDirection]::Out)

    $pipe.Connect()

    $writer = [System.IO.StreamWriter]::new($pipe)

    $writer.AutoFlush = $false

    $writer.Write($Content)

    $writer.Flush()

    Start-Sleep -Seconds 5

    $writer.Close()

    Start-Sleep -Seconds 5

    $pipe.Close()

}

I'm unfortunately not proficcient in Python, byt Atlassian actually has an example of how to do this in Python

Check out their GitHub repo here: jec/_scripts/example.py at master · atlassian/jec · GitHub

Antoine _Klee Group_
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 Champions.
December 16, 2025

Awesome thanks a lot for your help!

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events