Skip to content

before_script

B1nj0y edited this page Mar 23, 2021 · 9 revisions

A before_script is just normal Bash shell script located in the same folder with the function program file, you may use the before_script to:

do some preparation or set up environment before running the function program install dependencies for those languages that we haven't supported dependency installation at present The only point you should care is the before_script's name, it is the name of the function program file appended a .sh suffix. For example, if there's a function program file named func.py, its corresponding before_script's name should be func.py.sh.

You can find a test case example here. The script test_before_script.py.sh is a before_script for the function program test_before_script.py. We just use these two programs to test the before_script feature.

We also support Bash to create a serverless service, see here. But it's unnecessary to write an additional before_script for Bash functions, you can just write all of it in the function code. Even you wrote a before_script for Bash functions, it won't be executed.

Clone this wiki locally