On Thu, Dec 17, 2020 at 10:38 AM Yannick Lacaute <[email protected]>
wrote:

> Hi Charles,
>
> I am working on a pipeline (build java > build docker > deploy pod in
> Openshift) and currently I have no unit test.
> I think you achieved something huge !! Well done by the way :)
>
Many thanks.

>
> Could you please give me someone web links or tips in order to do the same
> as you ?
>
They are still a lot of things todo as by example we suffer from Eclipse
Sisu/Guice issues when the Maven job starts -
https://stackoverflow.com/questions/65353903/error-injecting-public-org-apache-maven-repository-internal-defaultversionresol
but what I'm currently developing i available here : client:
https://github.com/ch007m/jenkins-job-dsl/tree/main/src/test/java/dev/snowdrop


> Do you use https://github.com/jenkinsci/JenkinsPipelineUnit ?
>
No. This project doesn't seem to bootstrap a jenkins server as we can do
using the @Rule Jenkinsrule ....

Is there a sample project from which we can start ?
>
See my previous remark

Should we just have to follow the same organization in JenkinsPipelineUnit
> > test ?
> Have you automatised your scripts or do you have to play them sometimes to
> update your project ?
>
I plan to create jobs using my Groovy DSL scripts with a seed job to create
all the children jobs such as a shell job, maven job, ...

>
> Thank for you advices
>
> PS : Currently my pipeline is declared in a shared library.
>
>
>
> Regards
>
>
>
> On Thu, Dec 17, 2020 at 9:51 AM Charles Moulliard <[email protected]>
> wrote:
>
>> I created 2 groovy scripts that I execute in a jenkins instance to figure
>> out the list to be used and to be configured within the `build.gradle` file
>>
>> Jenkins.instance.pluginManager.plugins
>> .findAll { !(it.shortName in ['job-dsl', 'structs']) }
>> .collect { "testPlugins
>> '${it.manifest.mainAttributes.getValue("Group-Id")}:${it.shortName}:${it.version}'"
>> }
>> .sort()
>> .each { println it }
>>
>> and testCompile dependencies
>> Jenkins.instance.pluginManager.plugins
>> .findAll { !(it.shortName in ['job-dsl', 'structs']) }
>> .collect { "testCompile
>> '${it.manifest.mainAttributes.getValue("Group-Id")}:${it.shortName}:${it.version}@jar'"
>> }
>> .sort()
>> .each { println it }
>>
>> On Wednesday, December 16, 2020 at 6:48:41 PM UTC+1 Charles Moulliard
>> wrote:
>>
>>> Hi
>>>
>>> As a java unit test will need jar files, it is then needed to load them
>>> nd to declare them within the pom.xml file or build.gradle file
>>>
>>> Example:
>>>
>>> testCompile("org.jenkins-ci.main:jenkins-test-harness:${jenkinsTestHarness}")
>>>     testCompile("org.jenkins-ci.main:jenkins-war:${jenkinsCore}")
>>>
>>> testCompile("org.jenkins-ci.plugins:script-security:${jenkinsTestSecurityScript}@jar
>>> ")
>>>
>>>     // Add the jar file as the testPlugins will install the hpi/jpi
>>> files and not the jar needed by the junit test
>>>     testCompile 'org.jenkins-ci.tools:git-parameter:0.9.13@jar'
>>>
>>>     testCompile 'org.jenkins-ci.plugins:structs:1.20@jar'
>>>     testCompile 'org.jenkins-ci.plugins:git:3.10.0@jar'
>>>     testCompile 'org.jenkins-ci.plugins:git-client:3.5.1@jar'
>>>     testCompile 'org.jenkins-ci.plugins:credentials:2.3.9@jar'
>>>     testCompile 'org.jenkins-ci.plugins:scm-api:2.6.4@jar'
>>>     testCompile 'org.jenkins-ci.plugins:matrix-project:1.18@jar'
>>>     testCompile
>>> 'org.jenkins-ci.plugins:global-variable-string-parameter:1.2@jar'
>>>     testCompile 'org.jenkins-ci.plugins:junit:1.47@jar'
>>>
>>>     testCompile 'org.jenkins-ci.plugins:workflow-remote-loader:1.5@jar'
>>>     testCompile
>>> 'org.jenkins-ci.plugins.workflow:workflow-aggregator:2.6@jar'
>>>     testCompile 'org.jenkins-ci.plugins.workflow:workflow-api:2.40@jar'
>>>     testCompile
>>> 'org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.18@jar'
>>>     testCompile
>>> 'org.jenkins-ci.plugins.workflow:workflow-scm-step:2.11@jar'
>>>     testCompile 'org.jenkins-ci.plugins.workflow:workflow-cps:2.80@jar'
>>>     testCompile
>>> 'org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.35@jar'
>>>     testCompile 'org.jenkins-ci.plugins.workflow:workflow-job:2.38@jar'
>>>     testCompile
>>> 'org.jenkins-ci.plugins.workflow:workflow-multibranch:2.20@jar'
>>>     testCompile
>>> 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.23@jar'
>>>     testCompile 'org.jenkins-ci.plugins.workflow:workflow-support:3.3@jar
>>> '
>>>
>>>     testCompile 'org.jenkins-ci.plugins:matrix-auth:2.6.2@jar'
>>>
>>>     testCompile 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r'
>>>
>>>     // Plugins to install in test jenkins instance running locally
>>>     testPlugins 'org.jenkins-ci.main:maven-plugin:3.8'
>>>
>>>     testPlugins 'org.jenkins-ci.plugins:cloudbees-folder:5.14'
>>>     testPlugins 'org.jenkins-ci.plugins:credentials:2.3.9'
>>>     testPlugins 'org.jenkins-ci.plugins:structs:1.20'
>>>     testPlugins
>>> 'org.jenkins-ci.plugins:global-variable-string-parameter:1.2'
>>>
>>>     testPlugins 'org.jenkins-ci.tools:git-parameter:0.9.13'
>>>     testPlugins 'org.jenkins-ci.plugins:git:3.10.0'
>>>     testPlugins 'org.jenkins-ci.plugins:git-client:3.5.1'
>>>     testPlugins 'org.jenkins-ci.plugins:scm-api:2.6.4'
>>>     testPlugins 'org.jenkins-ci.plugins:matrix-project:1.18'
>>>
>>>     testPlugins 'org.jenkins-ci.plugins:workflow-remote-loader:1.5'
>>>     testPlugins 'org.jenkins-ci.plugins.workflow:workflow-aggregator:2.6'
>>>     testPlugins 'org.jenkins-ci.plugins.workflow:workflow-api:2.40'
>>>     testPlugins
>>> 'org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.18'
>>>     testPlugins 'org.jenkins-ci.plugins.workflow:workflow-scm-step:2.11'
>>>     testPlugins 'org.jenkins-ci.plugins.workflow:workflow-cps:2.80'
>>>     testPlugins
>>> 'org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.35'
>>>     testPlugins 'org.jenkins-ci.plugins.workflow:workflow-job:2.38'
>>>     testPlugins
>>> 'org.jenkins-ci.plugins.workflow:workflow-multibranch:2.20'
>>>     testPlugins 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.23'
>>>     testPlugins 'org.jenkins-ci.plugins.workflow:workflow-support:3.3'
>>>
>>>     testPlugins 'org.jenkins-ci.plugins:matrix-auth:2.6.2'
>>>
>>>     testPlugins 'org.jenkins-ci.plugins:junit:1.47'
>>>
>>>     testPlugins 'org.jenkins-ci.plugins:matrix-project:1.18'
>>>
>>> As you can imagine, this process is long,tedious, will change when we
>>> upgrade to another jenkins server (as the list of the default plugins will
>>> be updated).
>>>
>>> Question:
>>> Is there a script, tool able to grab from jenkins the plugins list and
>>> next to create the corresponding plugins to be imported for Jenkinsrule
>>> unit test and GAVs dependencies (pom.xml or build.gradle) ?
>>>
>>> Cheers
>>>
>>> charles
>>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/37fb12c3-604e-4ad5-881a-4836e1a7dca3n%40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/37fb12c3-604e-4ad5-881a-4836e1a7dca3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Yannick LACAUTE
> Consultant indépendant
> 39 rue de Wattignies, 75012 Paris
> Tel : 06 16 85 95 76
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CAG1W_Ax2PcOyYAcgMWxZ5_PZJeoamWDkvBPhjJvbv9_9Hyi6JQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAG1W_Ax2PcOyYAcgMWxZ5_PZJeoamWDkvBPhjJvbv9_9Hyi6JQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPb1sSvCtJ%3DDu%2BYmyJwVxswJDc0g%2BMT-y-xtTJQD1NhxVyPcig%40mail.gmail.com.

Reply via email to