diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..c107bc35 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,27 @@ +## What is the purpose of the change + +For example: Making PowerJob better + +## Brief changelog + +It is best to associate an existing issue + +## Verifying this change + +Do I need to test? +Has testing been completed? +Test method? + +Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 3 checklist before request the community to review your PR`. + +- [x] Make sure there is a [Github issue](https://github.com/PowerJob/PowerJob/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. +- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. +- [x] Follow the git commit specification + * feat: xxx -> The feat type is used to identify production changes related to new backward-compatible abilities or functionality. + * perf: xxx -> The perf type is used to identify production changes related to backward-compatible performance improvements. + * fix: xxx -> The fix type is used to identify production changes related to backward-compatible bug fixes. + * docs: xxx -> The docs type is used to identify documentation changes related to the project - whether intended externally for the end users (in case of a library) or internally for the developers. + * test: xxx -> The test type is used to identify development changes related to tests - such as refactoring existing tests or adding new tests. + * refactor: xxx -> The refactor type is used to identify development changes related to modifying the codebase, which neither adds a feature nor fixes a bug - such as removing redundant code, simplifying the code, renaming variables, etc. + + \ No newline at end of file diff --git a/README.md b/README.md index b9bdf8db..1f173b5c 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,17 @@ Refer to [PowerJob Introduction](https://www.yuque.com/powerjob/en/introduce) fo ### Online trial - Address: [try.powerjob.tech](http://try.powerjob.tech/#/welcome?appName=powerjob-agent-test&password=123) -- Recommended to read the documentation first: [here](https://www.yuque.com/powerjob/en/trial) +- Recommend reading the documentation first: [here](https://www.yuque.com/powerjob/en/trial) # Documents **[Docs](https://www.yuque.com/powerjob/en/introduce)** **[中文文档](https://www.yuque.com/powerjob/guidence/intro)** +## Stargazers over time + +[![Stargazers over time](https://starchart.cc/PowerJob/PowerJob.svg)](https://starchart.cc/PowerJob/PowerJob) + # Known Users [Click to register as PowerJob user!](https://github.com/PowerJob/PowerJob/issues/6) ღ( ´・ᴗ・\` )ღ Many thanks to the following registered users. ღ( ´・ᴗ・\` )ღ @@ -62,7 +66,7 @@ PowerJob is released under Apache License 2.0. Please refer to [License](./LICEN # Others -- Any developer interested in getting more involved in PowerJob may join our [Gitter Community](https://gitter.im/PowerJob/community) and make [contributions](https://github.com/PowerJob/PowerJob/pulls)! +- Any developer interested in getting more involved in PowerJob may join our [Reddit](https://www.reddit.com/r/PowerJob) or [Gitter](https://gitter.im/PowerJob/community) community and make [contributions](https://github.com/PowerJob/PowerJob/pulls)! - Reach out to me through email **tengjiqi@gmail.com**. Any issues or questions are welcomed on [Issues](https://github.com/PowerJob/PowerJob/issues). diff --git a/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/processor/built/ScriptProcessor.java b/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/processor/built/ScriptProcessor.java index 9b84bb5f..7d070a3e 100644 --- a/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/processor/built/ScriptProcessor.java +++ b/powerjob-worker/src/main/java/com/github/kfcfans/powerjob/worker/core/processor/built/ScriptProcessor.java @@ -8,6 +8,8 @@ import com.github.kfcfans.powerjob.worker.log.OmsLogger; import com.google.common.collect.Sets; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.SystemUtils; import java.io.*; import java.net.URL; @@ -44,6 +46,9 @@ public abstract class ScriptProcessor implements BasicProcessor { File dir = new File(script.getParent()); boolean success = dir.mkdirs(); + if (!success) { + throw new RuntimeException("create script folder failed."); + } success = script.createNewFile(); if (!success) { throw new RuntimeException("create script file failed"); @@ -70,11 +75,18 @@ public abstract class ScriptProcessor implements BasicProcessor { OmsLogger omsLogger = context.getOmsLogger(); omsLogger.info("SYSTEM===> ScriptProcessor start to process"); - - // 1. 授权 - ProcessBuilder chmodPb = new ProcessBuilder("/bin/chmod", "755", scriptPath); - // 等待返回,这里不可能导致死锁(shell产生大量数据可能导致死锁) - chmodPb.start().waitFor(); + + if (SystemUtils.IS_OS_WINDOWS) { + if (StringUtils.equals(fetchRunCommand(), "/bin/bash")) { + omsLogger.warn("Current OS is {} where shell scripts cannot run.", SystemUtils.OS_NAME); + return new ProcessResult(false, "Shell scripts cannot run on Windows"); + } + } else { + // 1. 授权 + ProcessBuilder chmodPb = new ProcessBuilder("/bin/chmod", "755", scriptPath); + // 等待返回,这里不可能导致死锁(shell产生大量数据可能导致死锁) + chmodPb.start().waitFor(); + } // 2. 执行目标脚本 ProcessBuilder pb = new ProcessBuilder(fetchRunCommand(), scriptPath);