Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Power Shell and non-interactive JIRA Session

Deleted user June 7, 2018

I'm looking for a way to create a new issue which can be called from an older version of Jenkins. Scenario is simple - in the case of a build error create a new ticket.

Because of the Jenkins version I have decided to use the Jenkins PostBuild Script plugin. I'm also using the JiraPS powershell module. This contains a New-JiraSession function which takes a PSCredential Object....so New-JiraSession -Credential <PSCredential>

Since this is only for a demo initially I simply store the pw in a secure string..

$username = "MyName"
$pwd = Get-Content C:\TEMP\cred.txt | ConvertTo-SecureString
$jiraCredentialObject = New-Object System.Management.Automation.PSCredential($username,$pwd)
New-JiraSession -Credential $jiraCredentialObject 

I use a cmd wrapper to start the PS Script from Jenkins since it's not capable of triggering directy. It works fine and runs through creating the ticket in PowerShell ISE and also in the PS Terminal....Being called from Jenkins however causes a Windows credentials dialog to appear although PS is being called "non-interactive".  I also deliberately use New-Object and to create my own new CredentialObject not Get-Credential which is interactive and definitely pops the dialog interrupting the ticket creation....

This may be a Windows (shell) problem and sorry if this is off-topic. On the off-chance that someone in the community has used PS with JIRA before - would be grateful for any ideas

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events