diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-25 16:58:38 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-26 04:05:02 +0200 |
commit | 532b3ae9b5cd8609237e04db768cc1f750d8631d (patch) | |
tree | f65253a6ce9970d1d93e6bb6c65758d6fa98373a /src/ci.h | |
parent | cmake: ignore unused parameters for now (diff) | |
download | cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.tar.gz cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.zip |
add some more code
This adds a basic "worker" program.
You can now do something like
./server &
./worker &
./client ci_run URL REV
and the server should pass a message to worker, after which it should
clone the repository at URL, checkout REV, and try to run the CI script.
It's extremely unfinished: I need to sort out the graceful shutdown, how
the server manages workers, etc.
Diffstat (limited to 'src/ci.h')
-rw-r--r-- | src/ci.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ci.h b/src/ci.h new file mode 100644 index 0000000..4267b89 --- /dev/null +++ b/src/ci.h @@ -0,0 +1,28 @@ +#ifndef __CI_H__ +#define __CI_H__ + +typedef enum { + RUN_ERROR = -1, + RUN_SUCCESS, + RUN_FAILURE, + RUN_NO, +} run_result; + +run_result ci_run(int *ec); + +/* + * This is a high-level function. It's basically equivalent to the following + * sequence in bash: + * + * dir="$( mktemp -d )" + * git clone --no-checkout "$url" "$dir" + * pushd "$dir" + * git checkout "$rev" + * ./ci + * popd + * rm -rf "$dir" + * + */ +run_result ci_run_git_repo(const char *url, const char *rev, int *ec); + +#endif |