JavaScript job runner
JobKit
JavaScript Job Runner
JobKit allows you to write job scripts in javascript and run it via jobkit
cli or using jobkit-server triggered by git poll.
JobKit runs your job scripts in a docker container and remove it after it ends.
Installation
Globally:
npm install -g jobkit
Locally:
npm install --save-dev jobkit
Job file
Create a job file such as test.js
:
-- -------------------- ---- ------- -------------- - ----- -- ------ ------ ---- ---- ------ -- -- - ----- ----- - ----- ---------------------- ----- ------------- ----- ---------- ----- ---------------------------------------------------- ---- ----- ------------- ----- --------- ----- ----- ---------------- ----- --------- ----- ----- ---------- ----- ------------ ----- -------------- -
Running
jobkit test.js
Add parameters
jobkit test.js -p foo=1 -p bar=hello
You can read these parameters in your job file via params
attribute:
module.exports = ({ params }) => console.log(params.foo, params.bar)
Set environment variables
jobkit test.js -e FOO=1 -e BAR=hello
That will set these environment variables to the job process:
module.exports = () => console.log(process.env.FOO, process.env.BAR)
HomePage
https://github.com/jaystack/jobkit#readme
Repository
git+https://github.com/jaystack/jobkit.git
来源:JavaScript中文网 ,转载请注明来源 https://www.javascriptcn.com/post/6005668081e8991b448e2997