parser error with jjb 6.2.0

58 views
Skip to first unread message

Víctor Seva

unread,
Apr 25, 2024, 7:26:31 AM4/25/24
to jenkins-job-builder
Hi we are trying to upgrade or configs from jjb 3.3.0 and I'm facing an error. I'm using a simple example just to show it.

# using !include in job-template
- job-template: !include: include002.yaml.inc
- project:
name: acc-cdi
jobs:
- test-gerrit


# include002.yaml.inc
name: test-gerrit
builders:
- shell:
!include-raw-verbatim: include-raw-vars.sh


With this simple config I get this error:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <jenkins_jobs.expander.StrExpander object at 0x7f215b12d1d0>
obj = '#!/bin/bash\n#\n# sample script to check that variables aren\'t expanded\n# when using the !include-raw-verbatim: app...} ${VAR2}"\n\n[[ -n "${VAR3}" ]] && {\n    # this next section is executed as one\n    echo "${VAR3}"\n    exit 0\n}\n'
params = {'name': 'acc-cdi', 'template-name': 'test-gerrit'}, key_pos = <Pos /home/vseva/data/projects/jenkins-job-builder/tests/loader/fixtures/include002.yaml.inc:2:4>, value_pos = <Pos /home/vseva/data/projects/jenkins-job-builder/tests/loader/fixtures/include002.yaml.inc:3:6>

    def __call__(self, obj, params, key_pos, value_pos):
        try:
            return self._formatter.format(str(obj), **params)
        except JenkinsJobsException as x:
            lines = str(obj).splitlines()
>           start_ofs = value_pos.body.index(lines[0])
E           ValueError: substring not found

jenkins_jobs/expander.py:66: ValueError
----------------------------------------------------------------------------------------------------------------------------------- 

I would say this is a bug since parser is trying to expand something that is included via !include-raw-verbatim

Here are the tests I've created to verify this scenario[0] 

Should I create a bug report or We are doing something wrong?

Cheers,
Victor




Vsevolod Fedorov

unread,
Apr 25, 2024, 11:52:44 AM4/25/24
to Víctor Seva, jenkins-job-builder

Yes,

That looks like a bug.

Vsevolod.

--
You received this message because you are subscribed to the Google Groups "jenkins-job-builder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins-job-bui...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkins-job-builder/421b6d28-afb4-4481-ae03-1021c4beb60bn%40googlegroups.com.

Víctor Seva

unread,
Apr 26, 2024, 2:40:47 PM4/26/24
to jenkins-job-builder
Reply all
Reply to author
Forward
0 new messages