Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Default value for tag does not work #18

Open
sja opened this issue May 28, 2014 · 3 comments
Open

Default value for tag does not work #18

sja opened this issue May 28, 2014 · 3 comments

Comments

@sja
Copy link
Contributor

sja commented May 28, 2014

My configuration contains this:

        # Does not work
        tag: 'myRepoOne'
        refs:
          - 'refs/heads/feature_(.*)'

But that does not use the tag on creating jobs. I had to put a tag on the ref config:

        # Works
        tag: 'myRepoOne'
        refs:
          - 'refs/heads/feature_(.*)'
              'tag': 'myRepoOne'
@gvalkov
Copy link
Owner

gvalkov commented May 29, 2014

That's strange. One of the tests checks exactly for this and it seems to work:

processing ref: refs/heads/feature/one
. job name: feature-one
. job exists: False
. job created
. config:
  . enable: sticky
  . namesep: -
  . substitute: {'@@JOB_NAME@@': '{shortref}'}
  . re: refs/heads/feature/(.*)
  . tag: group1
  . namefmt: {shortref}
  . template: master-job-1
  . overwrite: True
  . sanitize: {'@!?#&|\\^_$%*': '_'}
Deleted branch feature/one (was 1583e8b).

processing ref: refs/heads/test
. job name: test
. job exists: False
. job created
. config:
  . enable: sticky
  . namesep: -
  . substitute: {'@@JOB_NAME@@': '{shortref}'}
  . re: refs/heads/test
  . tag: group2
  . namefmt: {shortref}
  . template: master-job-1
  . overwrite: True
  . sanitize: {'@!?#&|\\^_$%*': '_'}

Could you run jennkins-autojobs with the -d flag?

@arienkock
Copy link

I've had the same issue. The problem for me was that the xpath expression doesn't match anything so there is this trace as a result:

Traceback (most recent call last):
  File "/usr/local/bin/jenkins-makejobs-svn", line 11, in <module>
    sys.exit(_main())
  File "/usr/local/lib/python3.4/site-packages/jenkins_autojobs/svn.py", line 135, in _main
    main.main(argv[1:], config=config, create_job=create_job, list_branches=list_branches)
  File "/usr/local/lib/python3.4/site-packages/jenkins_autojobs/main.py", line 160, in main
    job_name = create_job(branch, tmpl, config, branch_config)
  File "/usr/local/lib/python3.4/site-packages/jenkins_autojobs/svn.py", line 127, in create_job
    tag_method=config['tag-method']
  File "/usr/local/lib/python3.4/site-packages/jenkins_autojobs/job.py", line 92, in create
    self.tag_config(tag, tag_method)
  File "/usr/local/lib/python3.4/site-packages/jenkins_autojobs/job.py", line 72, in tag_config
    desc_el = self.xml.xpath('/project/description')[0]
IndexError: list index out of range

I don't know much about jenkins config.xml format, but with version 1.625.3 I had:

<maven2-moduleset plugin="[email protected]">
  <actions/>
  <description>Hello</description>
  ...

@gvalkov
Copy link
Owner

gvalkov commented Jan 31, 2016

Hello @arienkock,

I believe you've encountered a new issue with jenkins-autojobs. Apparently, it's possible to have a config.xml without a //project/description element. Commit 0619831 should fix this.

As for the original issue, I still can't seem to figure out how it can't work. Running with -d would really help shed some light on the problem. As mentioned, the test_tag_element and test_tag_description tests in tests/test_git.py check exactly for this behavior.

Groetjes,
Georgi

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants