jenkinsci / seed-plugin

Seed Jenkins plug-in
https://plugins.jenkins.io/seed/
38 stars 13 forks source link

Cannot trigger pipeline when using a custom naming convention #17

Closed dcoraboeuf closed 9 years ago

dcoraboeuf commented 9 years ago

Given the following configuration:

strategies:
  - id: ci
    branch-start-expression: "${project}/${project}-*/${project}-*-ci"
classes:
    - id: my-class
      branch-strategy: ci

If the project p uses the my-class class, then firing the following event:

curl -X POST "http://192.168.99.101:32769/seed-http/commit?project=p&branch=master&commit=100"

raises the following error:

{"status":"ERROR","message":"Cannot find job in context [/p/p-master] with path [p-master-build]"}

The p-master-ci build should have been fired instead.

dcoraboeuf commented 9 years ago

At trigger time, the project has no longer any notion of a class which was associated to it when it was generated in the first place.

This information must be saved and retrieved. The configuration of the project seed cannot be used because its own path is subject to the configuration of the project.

Upon generation, the configuration of the project can be saved in a seed/<project>.yaml project and retrieved from there.

This has also the big benefit of storing a snapshot of the project configuration at the time it was generated, making it isolated from any global change.

dcoraboeuf commented 9 years ago

The project configuration is saved in the Jenkins configuration and reused upon branch/pipeline generation and upon an trigger event.

If the project configuration must be actualised, the project seed must be regenerated.