aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/clean.sh7
-rw-r--r--common/git-clone.sh (renamed from common/make-run.sh)9
-rw-r--r--common/make.sh18
-rw-r--r--eventline/ev-scripts-deploy.yaml15
4 files changed, 44 insertions, 5 deletions
diff --git a/common/clean.sh b/common/clean.sh
new file mode 100644
index 0000000..40ec605
--- /dev/null
+++ b/common/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Input environment:
+# - NAME: a name for the script/tasks
+
+rm -rf "/tmp/${NAME}"
diff --git a/common/make-run.sh b/common/git-clone.sh
index 8c719b2..1a1a89c 100644
--- a/common/make-run.sh
+++ b/common/git-clone.sh
@@ -1,15 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
+# Input environment:
+# - NAME: a name for the script/tasks
+# - URL: the url of the repository to clone
+
WORKDIR="/tmp/${NAME}"
cleanup() {
- cd /
rm -rf "${WORKDIR}"
}
trap cleanup EXIT
git clone -q "${URL}" "${WORKDIR}"
-cd "${WORKDIR}"
-make run
+
+trap - EXIT
diff --git a/common/make.sh b/common/make.sh
new file mode 100644
index 0000000..c3b0912
--- /dev/null
+++ b/common/make.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Input environment:
+# - NAME: a name for the script/tasks
+# - TARGET: the Makefile target to run
+
+WORKDIR="/tmp/${NAME}"
+
+cleanup() {
+ rm -rf "${WORKDIR}"
+}
+
+trap cleanup EXIT
+
+(cd "${WORKDIR}" && make "${TARGET}")
+
+trap - EXIT
diff --git a/eventline/ev-scripts-deploy.yaml b/eventline/ev-scripts-deploy.yaml
index e01c567..21fb320 100644
--- a/eventline/ev-scripts-deploy.yaml
+++ b/eventline/ev-scripts-deploy.yaml
@@ -1,7 +1,14 @@
name: "ev-scripts-deploy"
steps:
- - script:
- path: "../common/make-run.sh"
+ - label: git clone
+ script:
+ path: "../common/git-clone.sh"
+ - label: make run
+ script:
+ path: "../common/make.sh"
+ - label: clean
+ script:
+ path: "../common/clean.sh"
identities:
- eventline-self
parameters:
@@ -9,6 +16,10 @@ parameters:
type: string
default: "ev-scripts-deploy"
environment: NAME
+- name: target
+ type: string
+ default: "run"
+ environment: TARGET
- name: url
type: string
default: "https://git.adyxax.org/adyxax/ev-scripts"