question

laurent-33 avatar image
0 Votes"
laurent-33 asked laurent-33 commented

webjob on webapp, and shell globbing for file path

Hello,

I write a little bash script that I would like to run with a triggered webjob, and there is an error with this line :

             main_chunk=$(ls $WEBROOT_PATH/static/js/main.*.js)

The error is that it cannot find the file.


What I have noticed :

  • when running the script manually, doing 'sh update.sh' in the cmd console in the advanced tool of the webapp in azure portal => it is OK, file is well found

  • if I replace the (not really) regex star '*' of the file path, example : main_chunk=$(ls $WEBROOT_PATH/static/js/main.165484.chunck.js) => OK, the webjob is sucessfull


So I think it is the shell globbing that seems not to work with the webjob execution (but ok with cmd console).
If you have some idea to solve this,

Thanks for your help,
laurent





azure-webappsazure-webapps-content-deploymentazure-webapps-webjobs
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @laurent-33,

You pose an interesting question. If I'm not mistaken, WebJobs run inside a JobHost context from the SDK. This could be what's causing the globbing to fail. I've reached out to the product group and will update once I have a response.

Regards,
Ryan

0 Votes 0 ·

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered laurent-33 commented

Hi @laurent-33,

We do have a workaround. Enclose the environment variable in quotes (") e.g. "$WEBROOT"/static/js/main.*.js and the globbing should work as expected.

Regards,
Ryan

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you very much for your quick and focused answer.
It works as expected now.

Laurent

1 Vote 1 ·