question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate explicit seed job and run it once during start-up

See original GitHub issue

Feature Request

I have multiple groovy job DSL scripts stored in a Git repository like this:

.
└───job-dsl
        javaapi-job-dsl.groovy
        webapps-job-dsl.groovy
        webservices-job-dsl.groovy

I would like to define only one pipeline seed job which checks out the Git repository and runs all groovy scripts it can find under the job-dsl sub-directory once during JCASC start-up phase (or when triggered manually through the UI or automatically (SCM Poll) later on).

Creating this seed job seems possible with the jobs directive but AFAICS there is no possibility to have it run once during the JCASC start-up phase, correct?

Would it make sense to add this feature or is there something fundamentally wrong in my approach?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
rmmacalacommented, Nov 1, 2019

Well I may have found a workaround that works for me. Using startup-trigger-plugin:2.9.3 and adding a trigger to my pipeline I was able to get the job to start on start up. There are still issues with trying to queue the job with - script: queue(‘unit-tests’).

- script: >
      pipelineJob('unit-tests') {
                triggers {
                    hudsonStartupTrigger {
                      quietPeriod("60")
                      runOnChoice("ON_CONNECT")
                      label("")
                      nodeParameterName("")
                    }
                }
        .............
     }

3reactions
AnalogJcommented, Aug 8, 2019

we use the following queue command to trigger the DSL run after the JCasC plugin runs.

However it only seems to work 50% of the time…

- script: queue('Utility-Jobs-DSL')

After some additional research this could be related to https://github.com/jenkinsci/configuration-as-code-plugin/issues/619

I wonder if I’m just using an older version of the JCasC plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jenkins Tutorial: Implementing a Seed Job - HappyCoders.eu
Tutorial, part 3: Configure Jenkins Script Security - Create a seed job to automatically generate Jenkins jobs for new Java projects.
Read more >
Start jenkins job immediately after creation by seed job
To queue the job only if it's new, you need to use the Jenkins API to test if the job already exists.
Read more >
Random Seeds and Reproducibility - Towards Data Science
Completely deterministic! Once you set the random seed to 42 (obviously!), the first four generated integers are 10, 1, 0, and 4, in...
Read more >
How To Automate Jenkins Job Configuration Using Job DSL
In this step, you will run the seed job and confirm that the jobs defined within the Job DSL script are indeed created....
Read more >
Numpy Random Seed, Explained - Sharp Sight
Once you understand pseudo-random numbers, numpy.random.seed will make more sense. WTF is a pseudo-random number? At the risk of being a bit of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found