jenkinsci / publish-over-ftp-plugin

https://plugins.jenkins.io/publish-over-ftp/
21 stars 33 forks source link

[JENKINS-14340] Remote directory of a Transfer Set should resolve env variable more than once #40

Closed jira-importer closed 2 years ago

jira-importer commented 12 years ago

This is a small feature improvement for "Publish Over ..."

I tested the plugin beforehand (1.7) and read this information:

https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+...#PublishOver...-Remotedirectory

https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+...#PublishOver...-examples

The "Eg 3 Environment variables" works for variables that need be resolved only once (e.g $JOB_NAME/$BUILD_NUMBER)

However, this won't work with a variable $MY_JOB_PARAM that is defined as $JOB_NAME/$BUILD_NUMBER.

Would it be possible to have a mechanism to resolve the env variable more than once? Possibly, the level of resolution could be specified by a number to enter.


Originally reported by chantivlad, imported from: Remote directory of a Transfer Set should resolve env variable more than once
  • status: Closed
  • priority: Major
  • resolution: Incomplete
  • resolved: 2022-03-20T19:09:44+11:00
  • imported: 2022/01/10
jira-importer commented 12 years ago

slide_o_mix:

Might be useful to integrate token macro

jira-importer commented 12 years ago

chantivlad:

So you suggest "Publish Over ..." to integrate following plugin https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin right ?

jira-importer commented 12 years ago

slide_o_mix:

Yes, that is my thought.

jira-importer commented 12 years ago

chantivlad:

Could you please have a look at the solution proposed by Slide-O-Mix?
This looks really promising and could allow a more powerful handling of variables within the plugin.
Thanks a lot in advance.

jira-importer commented 12 years ago

bap:

This is non trivial due to the way variables are currently resolved in the publish over plugins.

I will look into it at some point, and see if the token macro plugin can be used to resolve variables without affecting the current behaviour.

jira-importer commented 12 years ago

chantivlad:

I guess this relates to my request https://issues.jenkins-ci.org/browse/JENKINS-14340.
I see the need to resolve "natural" environment variables and parameters as more natural though since "Free style job" does it in a shell build step, and Publish Over SSH does not do it in "Send files or execute commands over SSH after the build runs".

Here is a easy job config.xml for reproducing the issue on 1.486 with publish over SSH 1.9:

'1.0' encoding='UTF-8'?>

  
  
  false
  
    
      

  foo
  
  i_am_foo


  bar
  
  i_am_bar


  foobar
  
  ${foo}_${bar}

      
    
  
  "hudson.scm.NullSCM"/>
  true
  false
  false
  false
  "vector"/>
  false
  
    
      #!/bin/bash

echo
echo "Build Step"
echo "we have foo=${foo}"
echo "we have bar=${bar}"
echo "we have foobar=${foobar}"
    
  
  
  
    "publish-over-ssh@1.9">
      
SSH: 

  
    
      TempArtifacts_deployer
      false
      

  
  
  
  
  false
  false
  false
  false
  false
  #!/bin/bash

echo
echo "SSH deployer after the build runs"
echo "we have foo=${foo}"
echo "we have bar=${bar}"
echo "we have foobar=${foobar}"
  120000
  false

      
      false
      false
    
  
  false
  false
  false
  "jenkins.plugins.publish_over_ssh.BapSshAlwaysRunPublisherPlugin" reference="../.."/>

      
    
  

The output of that job is

Building remotely on ******** in workspace /****************/PublishOverSSHTest
[PublishOverSSHTest] $ /bin/bash /tmp/hudson8155249335332678275.sh

Build Step
we have foo=i_am_foo
we have bar=i_am_bar
we have foobar=i_am_foo_i_am_bar
SSH: Connecting from host [********]
SSH: Connecting with configuration [********] ...
SSH: EXEC: STDOUT/STDERR from command [#!/bin/bash

echo
echo "SSH deployer after the build runs"
echo "we have foo=i_am_foo"
echo "we have bar=i_am_bar"
echo "we have foobar=${foo}_${bar}"] ...

SSH deployer after the build runs
we have foo=i_am_foo
we have bar=i_am_bar
we have foobar=_
SSH: EXEC: completed after 601 ms
SSH: Disconnecting configuration [********] ...
SSH: Transferred 0 file(s)
Notifying upstream projects of job completion
Finished: SUCCESS
jira-importer commented 11 years ago

utopius:

This is increasingly annoying in regard of the promoted builds plugin as the CIFS plugin does not resolve environment variables which are passed to a promotion as parameters. So I have to encapsulate the CIFS publishing in a seperate job.

jira-importer commented 2 years ago

gmcdonald:

For your information, all publish-over-ssh component type JENKINS issues related to the Publish Over SSH plugin have been transferred to Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues

Here is the direct link to this issue in Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues/215
And here is the link to a search for related issues: https://github.com/jenkinsci/publish-over-ssh-plugin/issues?q=%22JENKINS-14340%22

(Note: this is an automated bulk comment)

jira-importer commented 2 years ago

gmcdonald:

Closing ticket, please use the corresponding Github Issue as linked above.