Moving From Parameterized Trigger Plugin to Pipelines

2017-08-24 Thread AJ Ferrigno
Hello,

I am trying to move towards Pipelines instead of our Build Flow /
Parameterized Trigger plugin setup. It is mostly making sense, but there is
one thing that seems very cumbersome / maybe even impossible under
Pipelines which I can do with ease via the Parameterized Trigger plugin
(see documentation here
).

I like the concept of being able to trigger another job, and specify a
properties file (each line is in the format x=y) somewhere in my job's
workspace which automatically become the parameters of the next job in the
sequence. It would be awesome to have this functionality exist somewhere in
Pipelines as a step or some one-liner I could use.

For example, say I have this pipeline (basically: create parameters for a
deploy, then deploy using those parameters):

>
> pipeline {
> agent any
>
> stages {
> stage('Parameters') {
>  steps {
> build job: "DeployParameters", parameters: [string(name:
> 'project', value: project), string(name: 'branchName', value: branchName)]
> /* grab artifact file "artifact.txt" from
> "DeployParameters" job and set a bunch of variables based on it */
> }
> }
> stage('Deploy') {
>  steps {
> build job: "DeployJob", parameters: /* pass in all
> parameters set above */
>  }


First of all, looking at the commented lines, is the above possible at all,
using a step or otherwise? I tried using the below code to do something
similar, but it (Jenkins v2.74) complained "Scripts not permitted to use
new java.util.Properties"

step([$class: 'CopyArtifact',
>  filter: 'artifact.txt',
>  projectName: "DeployParameters"])
> script {
>  def content = readFile 'artifact.txt'
>  Properties properties = new Properties()
>  InputStream is = new ByteArrayInputStream(content.getBytes());
>  properties.load(is)
>  def runtimeString = 'variable_i_want'
>  variable_i_want = properties."$runtimeString" }


I know I can probably tell my Jenkins installation to allow
java.util.Properties, but that seems like an unsustainable hack. I don't
think I'm doing anything terribly insecure here, so I would really like to
be above-board about it.

Second, even if I could get the above code to work, it is simply too long
and un-maintainable. Especially since I would probably be re-using this
many times, it would be awesome to replace this functionality in the
Parameterized Trigger plugin with a simple one-liner. It may even help
somebody else somewhere.

Has anybody else needed something like this? If this is a feature request
not currently thought of, what would it take to get this solution developed?

Thanks for any help,
AJ

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAKzFqnPUNHyZOjQztGKkTKuA7d27oYgj0AqgHfh94Ehs6E6Rug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Migrate Build Flow to Pipeline

2016-06-01 Thread AJ Ferrigno
Hello,

I am working towards migrating our Build Flow DSL to Pipelines. I would
like to create some sort of migration document to help other people, since
I can't seem to find a straight-forward document anywhere quite yet.

I have figured most things out thanks to documentation and experimentation.
However, there is one thing I can't find the Pipeline equivalent for.

In our current Build Flow DSL, we execute builds of other jobs in parallel,
using code like below:

param = parallel ([
param1: {build (execution1, flow_job_1)},
param2: {build (execution2, flow_job_1)},
])

Once we finish executing those jobs, we need to grab an artifact from each
of those executions, which will then inform parameters for subsequent jobs.
We accomplish this currently by getting the build ID via the following
snippet, and then grabbing an artifact via http from the Jenkins server
itself.

param.param1.getLastBuild()

What is the Pipeline equivalent of the above snippet? How would I be able
to grab the build number of each of these parallel jobs using Pipelines? Or
alternatively, is there some sort of "artifact grabber" plugin where I can,
say, grab one of param1's artifacts and copy into the current workspace?
Even if there were, I don't know what I'd pass it, as I don't think the
build step plugin or parallel plugin returns anything at all besides
true/false.

Thanks for any help,
AJ

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAKzFqnP2bGbD_ArABQaeC3Nd7c-iGdiGQ1zgS%2BrPckgza8J_NA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Upgrading to Jenkins 2.2 Breaks Build Flow Plugin DSL Editing

2016-05-24 Thread AJ Ferrigno
Hello,

We have been using the Build Flow plugin for about a year now. We have a 
large block of DSL which we mostly needed for parallel execution.

I have just tried upgrading to Jenkins 2.2, and I am now unable to edit the 
DSL in our existing Build Flow job. I open the job, click configuration, 
scroll down to where the DSL would be, and the entire DSL just disappears 
from view. The only way I can edit the DSL is to navigate to the config.xml 
file on the master, change it there, and then reload configuration from 
disk. Obviously, this is an inconvenience.

I have tried making a brand new (blank) Build Flow job and the same issue 
happens. Once I paste in my DSL, save it, then return to the configuration 
and scroll down, the DSL box disappears.

Upgrading to Jenkins 2.6 does not fix the issue (in fact, it breaks other 
things sadly). Upgrading all my plugins does not fix the issue.

It looks like this plugin is deprecated in favor of Pipelines and may no 
longer be supported. I will need to investigate Pipelines to see how to 
move away from our DSL. However, there was a change this month to link it 
to Pipelines. Is it possible to get this problem fixed as well? I even 
volunteer myself to fixing it, although I am not a Jenkins developer and 
wouldn't know where to start debugging this thing. I'm hoping someone else 
would understand why something would disappear from the page as a result of 
the 2.2 upgrade. Maybe after having it explained, I can make the hopefully 
small code change to get it fixed.

Thanks in advance,
AJ

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9c600c2b-9a10-4f1b-87ed-bf6a8bf90dd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.