jenkinsci / seed-plugin

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

Branch Jobs generated incorrectly #20

Closed nllarson closed 8 years ago

nllarson commented 8 years ago

I have a seed job configured like this:

Seed YAML:

http-enabled: no
github-enabled: no
bitbucket-enabled: yes
projects:
   - id: "client/application-api"
     name: "application-api"

Seed Job Config:

screen shot 2016-01-22 at 7 42 36 am

And

screen shot 2016-01-22 at 7 42 51 am

I then run the seed with these params:

Project Id: client/application-api SCM Url: https://bitbucket.com/client/application-api.git SCM Creds: (selected from dropdown)

It generates a Project folder and Project Seed. It looks fine, it takes a parameter of a BRANCH name.

screen shot 2016-01-22 at 7 49 58 am

projectseeed

From here is where I am kind of confused. I can't get the build to pick up PUSHES unless I manually start the Branch Seed for one of my branches. (Is this the correct way?) I manually start the application-api-seed job, enter a branch name of 'develop' and let it do its thing. It generates the application-api-develop folder and seed. But the jobs that are created from my seed.groovy file are not created. Here is that error.

screen shot 2016-01-22 at 7 56 16 am

I looked at your Jenkins instance and noticed that the Inject Environment Variables... option is selected and populated on your Branch Seed job. (like this:)

screen shot 2016-01-22 at 7 57 25 am

If I copy these properties to my config (but with my correct values) things seem to work, but I am fairly sure I shouldn't have to do that for each branch for each project.

I am using Jenkins 1.643 and Seed-Plugin 0.18.0

dcoraboeuf commented 8 years ago

Hi Nick,

Is it possible to post part of your seed.groovy file, at least around the line in error (line 22)? Because you're right, the BRANCH is normally injected as a variable and your seed.groovy should not fail on this.

Damien

dcoraboeuf commented 8 years ago

Is the envInject plugin installed? If not, this is a requirement for the seed plugin, and it might be missing in the list of dependencies?

dcoraboeuf commented 8 years ago

I confirm that envinject is not currently a dependency of the seed plugin, meaning that it was probably not installed.

I'll fix this soon for the 0.19.

In the meantime, as a workaround, you can install the envinject plugin yourself. You might have to regenerate your branch folder though.

Thanks for the issue! Damien

nllarson commented 8 years ago

I basically copied the seed.groovy from the versioning project.

screen shot 2016-01-22 at 10 35 28 am

And the Environment Injector plugin is there.

screen shot 2016-01-22 at 10 26 09 am

dcoraboeuf commented 8 years ago

If I understand correctly, your issue boils down to the fact that the following configuration, with your own settings of course:

screen shot 2016-01-22 at 7 57 25 am

is not present in the seed job of your branch folder, even if the envinject plugin is installed correctly.

If you extract the config.xml of your job, if the environment section correctly generated? For example, for the nemerosa/versioning sample, the corresponding XML is:

<buildWrappers>
        <EnvInjectBuildWrapper>
            <info>
                <propertiesContent>PROJECT=nemerosa/versioning
PROJECT_CLASS=
PROJECT_SCM_TYPE=git
PROJECT_SCM_URL=https://github.com/nemerosa/versioning
PROJECT_SCM_CREDENTIALS=
BRANCH=master
SEED_PROJECT=versioning
SEED_BRANCH=master</propertiesContent>
                <loadFilesFromMaster>false</loadFilesFromMaster>
            </info>
        </EnvInjectBuildWrapper>
    </buildWrappers>
dcoraboeuf commented 8 years ago

If this is present, but nothing is displayed, it might be a plugin version conflict.

nllarson commented 8 years ago

That must be my issue. I do see those lines in my config.xml. So a plugin version conflict with the envInject plugin? Thanks for your help so far btw!

nllarson commented 8 years ago

I've also noticed this in my Jenkins Config 'Manage Old Data' So something about the way the job generation is working isn't quite right when it comes to the xml.

hudson.model.FreeStyleProject application-api/application-api-release-0.6.5/application-api-release-0.6.5-build CannotResolveClassException: au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger

hudson.model.FreeStyleProject application-api/application-api-release-0.6.5/application-api-release-0.6.5-build CannotResolveClassException: EnvInjectBuildWrapper

nllarson commented 8 years ago

I then created a new job by hand, and put in some 'Injected Properties', the config.xml for those looked like this:

    <EnvInjectBuildWrapper plugin="envinject@1.92.1">
      <info>
        <propertiesContent>FOO=bar
WACKA=wacka</propertiesContent>
        <loadFilesFromMaster>false</loadFilesFromMaster>
      </info>
    </EnvInjectBuildWrapper>
  </buildWrappers>

Where the generated job's config.xml looked like this:

      <buildWrappers>
        <EnvInjectBuildWrapper>
            <info>
                <propertiesContent>PROJECT=client/application-api
PROJECT_CLASS=
PROJECT_SCM_TYPE=git
PROJECT_SCM_URL=https://bitbucket.org/client/application-api.git
PROJECT_SCM_CREDENTIALS=UUID-1234
BRANCH=develop
SEED_PROJECT=application-api
SEED_BRANCH=develop</propertiesContent>
                <loadFilesFromMaster>false</loadFilesFromMaster>
            </info>
        </EnvInjectBuildWrapper>
        <EnvInjectPasswordWrapper>
            <injectGlobalPasswords>true</injectGlobalPasswords>
            <passwordEntries/>
        </EnvInjectPasswordWrapper>
    </buildWrappers>
dcoraboeuf commented 8 years ago

Hi Nick,

I've upgraded the seed plugin to use the latest version of the envinject plugin (1.92.1). No problem so far.

Have you had a look in Jenkins log files to see if you had an error linked to the generation of your job?

Thanks, Damien.

nllarson commented 8 years ago

Damien,

Thanks, I'll give the new version a look in the morning. I'll give the logs a look too. Thanks again!