From 7486ecd8269400c4354ebacd3cd52ff7e2e5c341 Mon Sep 17 00:00:00 2001 From: Imran Hussain <imranh@sucs.org> Date: Fri, 31 Dec 2021 17:47:09 +0000 Subject: [PATCH] Add CI/CD to doorkey --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ public/pull.php | 14 ++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 public/pull.php diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..10ffec3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,24 @@ +stages: + - test + - deploy + + +#before_script: + +php-syntax-check: + stage: test + script: + - apt-get clean + - apt-get update + - apt-get install -y php-cli + - php -l public/index.php + - php -l public/pull.php + +deploy-live: + stage: deploy + image: curlimages/curl:7.80.0 + script: + - curl --fail-with-body https://doorkey.sucs.org/pull.php + only: + - master + environment: live diff --git a/public/pull.php b/public/pull.php new file mode 100644 index 0000000..57ff895 --- /dev/null +++ b/public/pull.php @@ -0,0 +1,14 @@ +<?php + +exec("cd ..; git reset --hard HEAD; git pull", $retArr, $retVal); + +if ($retVal == 0) { + print("ok"); + exit(0); +} + +print("not ok\n"); +var_dump($retArr); +var_dump($retVal); + +?> \ No newline at end of file -- GitLab