[almighty] Makefile error and Jenkins naster build

Travis Brown tkbrown at gmail.com
Fri Sep 30 13:49:54 UTC 2016


Is executing $PATH really the intention here or is that just an example?
(PATH usually being an environment var and not an executable)

I haven't written a makefile in over a decade but this sounds more like a
BASH issue with variable interpolation. Two commands are being executed and
bash returns the return code from echo.

Is it an option to separate out the evaluation from the echo?
.SHELLFLAGS=-ec
SHELL=/bin/bash
all:
    echo "$(.SHELLFLAGS)"
    echo "$(SHELL)"
    EVALUATED_PATH="$$(PATH)"
    echo "hallo ${EVALUATED_PATH}"

It seems like this would fail the build properly:

make
echo "-ec"
-ec
echo "/bin/bash"
/bin/bash
EVALUATED_PATH="$(PATH)"
/bin/bash: PATH: command not found
make: *** [all] Error 127



On Fri, Sep 30, 2016 at 1:25 AM, Konrad Kleine <kkleine at redhat.com> wrote:

> Hi Baiju,
>
> the problem is hard to fix because Make offers no command switches (see
> https://www.chemie.fu-berlin.de/chemnet/use/info/make/make_9.html#SEC85)
> for handling errors in subcommands.
>
> The error
>
> > /bin/sh: PATH: command not found
>
> indicates that Make called sh to execute "PATH".
>
> Obviously this is wrong. So I thought I can teach Make to globally use the
> -e switch on the shell to immediately abort if there's an error. It turned
> out that is possible to modify the shell that gets used for executing shell
> commands and also specify the flags. Here's a simple Makefile to set those
> variables (NOTE: they will not work if setting as environment variables):
>
> .SHELLFLAGS=-ec
> SHELL=/bin/bash
> all:
> echo "$(.SHELLFLAGS)"
> echo "$(SHELL)"
> echo "hallo $$(PATH)"
>
>
> When executed with: make && echo ok this results in
>
>
> echo "-ec"
> -ec
> echo "/bin/bash"
> /bin/bash
> echo "hallo $(PATH)"
> /bin/bash: PATH: command not found
> hallo
> ok
>
>
> As you can see it doesn't seem like the shell flags have the desired
> effect because Make still returns 0 instead of 1.
>
> Here you can read on the SHELL variable: https://www.gnu.org/software/
> make/manual/html_node/Choosing-the-Shell.html#Choosing-the-Shell
>
> I try to fiddle around with this but I don't expect much.
>
> Regards
> Konrad
>
> On Fri, Sep 30, 2016 at 7:42 AM, Konrad Kleine <kkleine at redhat.com> wrote:
>
>> Hey Baiju,
>>
>> thank you for spotting this.
>>
>> I'm on it.
>>
>> On Thu, Sep 29, 2016 at 3:46 AM, Baiju Muthukadan <bmuthuka at redhat.com>
>> wrote:
>>
>>> Hi Konrad,
>>>
>>> There was an error in the "make generate" during this master build:
>>> https://ci.centos.org/view/Devtools/job/devtools-almighty-co
>>> re-build-master/44/console
>>>
>>> You can see these lines there:
>>> -----------------------------------------------------------
>>> + make docker-generate
>>> docker exec -t -i "almighty-core-local-build" make generate
>>> cd vendor/github.com/goadesign/goa/goagen && go build -v
>>> [...snip...]
>>> PATH="$(PATH):vendor/github.com/jteeuwen/go-bindata/go-bindata"
>>> vendor/github.com/elazarl/go-bindata-assetfs/go-bindata-asse
>>> tfs/go-bindata-assetfs
>>> -debug
>>> <http://github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs/go-bindata-assetfs-debug>
>>> assets/...
>>>
>>> /bin/sh: PATH: command not found
>>> -----------------------------------------------------------
>>>
>>> But it never made the build to fail and prevented Jenkins to deploy
>>> the artifact. We have fixed this issue here:
>>> https://github.com/almighty/almighty-core/pull/286 I had a look at all
>>> the make files to see any potential similar issue, but I couldn't find
>>> anything. Do you think we need to anything else in Jenkins to capture
>>> these kind of issues? May be use some Jenkins plugin to search for
>>> "command not found" string and make Jenkins to fail?
>>>
>>> Regards,
>>> Baiju M
>>>
>>
>>
>
> _______________________________________________
> almighty-public mailing list
> almighty-public at redhat.com
> https://www.redhat.com/mailman/listinfo/almighty-public
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/almighty-public/attachments/20160930/5a2134d0/attachment.htm>


More information about the almighty-public mailing list