Powershell Yarn Execution

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Powershell Yarn Execution

Joe Cavanaugh
    stage('Build') {
      steps
{
            powershell
'''
            Write-Output "Starting Yarn Install"
            try {
                \$ErrorActionPreference = '
Stop'
                yarn install
            } catch {
                Write-Output "Install failed : \$PSItem"
            }
            '''

     
}
   
}

However, when I run the command on the server itself in the directory, all i get is 
yarn install v1.5.1
yarn : warning package.json: No license field
At line:1 char:19
+     try {         yarn install --frozen-lockfile     } catch {        ...
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (warning package.json: No license field:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

warning soe@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 2.16s.
[blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
0

Seems to me that the powershell method is incorrectly interpreting the warning as a remote exception... The catch never gets hit, and even if I set the $global:LASTEXITCODE to zero after the yarn install line it still fails. 

Any hints as to what else to try or consider would be greatly appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell version 5.1.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3fba7e28-db0b-43a5-932e-531a4dc7b3aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Powershell Yarn Execution

Joe Cavanaugh
I didn't post the error message : 
ERROR: script returned exit code 1
Finished: FAILURE

On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
    stage('Build') {
      steps
{
            powershell
'''
            Write-Output "Starting Yarn Install"
            try {
                \$ErrorActionPreference = '
Stop'
                yarn install
            } catch {
                Write-Output "Install failed : \$PSItem"
            }
            '''

     
}
   
}

However, when I run the command on the server itself in the directory, all i get is 
yarn install v1.5.1
yarn : warning package.json: No license field
At line:1 char:19
+     try {         yarn install --frozen-lockfile     } catch {        ...
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (warning package.json: No license field:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

warning soe@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 2.16s.
[blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
0

Seems to me that the powershell method is incorrectly interpreting the warning as a remote exception... The catch never gets hit, and even if I set the $global:LASTEXITCODE to zero after the yarn install line it still fails. 

Any hints as to what else to try or consider would be greatly appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell version 5.1.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e1bd6e18-3b45-4a10-a6ce-d722e9634a35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Powershell Yarn Execution

Joe Cavanaugh
bat 'yarn install' works fine. It seems that the powershell key word does not work correctly in declarative pipelines consistently. 

On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:
I didn't post the error message : 
ERROR: script returned exit code 1
Finished: FAILURE

On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
    stage('Build') {
      steps
{
            powershell
'''
            Write-Output "Starting Yarn Install"
            try {
                \$ErrorActionPreference = '
Stop'
                yarn install
            } catch {
                Write-Output "Install failed : \$PSItem"
            }
            '''

     
}
   
}

However, when I run the command on the server itself in the directory, all i get is 
yarn install v1.5.1
yarn : warning package.json: No license field
At line:1 char:19
+     try {         yarn install --frozen-lockfile     } catch {        ...
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (warning package.json: No license field:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

warning soe@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 2.16s.
[blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
0

Seems to me that the powershell method is incorrectly interpreting the warning as a remote exception... The catch never gets hit, and even if I set the $global:LASTEXITCODE to zero after the yarn install line it still fails. 

Any hints as to what else to try or consider would be greatly appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell version 5.1.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Powershell Yarn Execution

slide
Have you tried running the same command in powershell directly to see if the behavior is just powershell itself?

On Thu, Mar 8, 2018 at 8:20 AM Joe Cavanaugh <[hidden email]> wrote:
bat 'yarn install' works fine. It seems that the powershell key word does not work correctly in declarative pipelines consistently. 

On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:
I didn't post the error message : 
ERROR: script returned exit code 1
Finished: FAILURE

On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
    stage('Build') {
      steps
{
            powershell
'''
            Write-Output "Starting Yarn Install"
            try {
                \$ErrorActionPreference = '
Stop'
                yarn install
            } catch {
                Write-Output "Install failed : \$PSItem"
            }
            '''

     
}
   
}

However, when I run the command on the server itself in the directory, all i get is 
yarn install v1.5.1
yarn : warning package.json: No license field
At line:1 char:19
+     try {         yarn install --frozen-lockfile     } catch {        ...
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (warning package.json: No license field:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

warning soe@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 2.16s.
[blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
0

Seems to me that the powershell method is incorrectly interpreting the warning as a remote exception... The catch never gets hit, and even if I set the $global:LASTEXITCODE to zero after the yarn install line it still fails. 

Any hints as to what else to try or consider would be greatly appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell version 5.1.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVctZwinoaGVSpXwAAuUJwdB45WWfcn%2BN%2Bt1uF4kK7Ykow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Powershell Yarn Execution

Joe Cavanaugh
Yep - the middle section of the first post is when I ran directly as the user on the server. The error codes are fine and the build worked just great. It appears to only be an issue when transferring back information to Jenkins to continue doing the pipeline. 

On Thursday, March 8, 2018 at 9:31:45 AM UTC-6, slide wrote:
Have you tried running the same command in powershell directly to see if the behavior is just powershell itself?

On Thu, Mar 8, 2018 at 8:20 AM Joe Cavanaugh <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="3uTxS8SsBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">joe.d.cava...@gmail.com> wrote:
bat 'yarn install' works fine. It seems that the powershell key word does not work correctly in declarative pipelines consistently. 

On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:
I didn't post the error message : 
ERROR: script returned exit code 1
Finished: FAILURE

On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
    stage('Build') {
      steps
{
            powershell
'''
            Write-Output "Starting Yarn Install"
            try {
                \$ErrorActionPreference = '
Stop'
                yarn install
            } catch {
                Write-Output "Install failed : \$PSItem"
            }
            '''

     
}
   
}

However, when I run the command on the server itself in the directory, all i get is 
yarn install v1.5.1
yarn : warning package.json: No license field
At line:1 char:19
+     try {         yarn install --frozen-lockfile     } catch {        ...
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (warning package.json: No license field:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

warning soe@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 2.16s.
[blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
0

Seems to me that the powershell method is incorrectly interpreting the warning as a remote exception... The catch never gets hit, and even if I set the $global:LASTEXITCODE to zero after the yarn install line it still fails. 

Any hints as to what else to try or consider would be greatly appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell version 5.1.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="3uTxS8SsBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bdb03d61-ee14-4e06-aecd-e6bf3c8aef78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Powershell Yarn Execution

Joe Cavanaugh
[SOE.POC] Running batch script C:\Jenkins\workspace\SOE.POC\SOE.POC>yarn install --frozen-lockfile
yarn install v1.5.1
warning package.json: No license field
warning soe@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.33s.
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
For comparison  
[SOE.POC] Running PowerShell script
yarn install v1.5.1
powershell.exe : warning package.json: No license field
At C:\Jenkins\workspace\SOE.POC\SOE.POC@tmp\durable-c8ac6911\powershellWrapper.ps1:3 char:1
+ & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (warning package.json: No license field:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

warning soe@0.0.0: No license field [1/4] Resolving packages...
success Already up-to-date.
Done in 2.41s.
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

On Thursday, March 8, 2018 at 11:17:10 AM UTC-6, Joe Cavanaugh wrote:
Yep - the middle section of the first post is when I ran directly as the user on the server. The error codes are fine and the build worked just great. It appears to only be an issue when transferring back information to Jenkins to continue doing the pipeline. 

On Thursday, March 8, 2018 at 9:31:45 AM UTC-6, slide wrote:
Have you tried running the same command in powershell directly to see if the behavior is just powershell itself?

On Thu, Mar 8, 2018 at 8:20 AM Joe Cavanaugh <[hidden email]> wrote:
bat 'yarn install' works fine. It seems that the powershell key word does not work correctly in declarative pipelines consistently. 

On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:
I didn't post the error message : 
ERROR: script returned exit code 1
Finished: FAILURE

On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
    stage('Build') {
      steps
{
            powershell
'''
            Write-Output "Starting Yarn Install"
            try {
                \$ErrorActionPreference = '
Stop'
                yarn install
            } catch {
                Write-Output "Install failed : \$PSItem"
            }
            '''

     
}
   
}

However, when I run the command on the server itself in the directory, all i get is 
yarn install v1.5.1
yarn : warning package.json: No license field
At line:1 char:19
+     try {         yarn install --frozen-lockfile     } catch {        ...
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (warning package.json: No license field:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

warning soe@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 2.16s.
[blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
0

Seems to me that the powershell method is incorrectly interpreting the warning as a remote exception... The catch never gets hit, and even if I set the $global:LASTEXITCODE to zero after the yarn install line it still fails. 

Any hints as to what else to try or consider would be greatly appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell version 5.1.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1579f126-776f-4410-a9ba-1199f2b7018b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.