-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpre-push
executable file
·58 lines (45 loc) · 1.31 KB
/
pre-push
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# A pre-push hook
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
remote="$1"
url="$2"
echo ${PWD}
ls
# Export all data
for task in cpu memory network python sensors system users
do
watchme export system task-$task --out data/task-$task.json vanessa-thinkpad-t460s_vanessa.json --json --force
done
# If the container to do the work doesn't exist, pull it
if [ ! -f "data/python-datascience.sif" ];
then
singularity pull --name data/python-datascience.sif docker://faizanbashir/python-datascience:3.6
fi
# Then run the generate.py script
singularity exec data/python-datascience.sif python3 data/generate.py
# Make the output folder
mkdir -p docs
cp -R data/img/*.png docs/
# Get Listing of files
FILES=$(ls docs/*.png)
# Generate a README with images
echo "# WatchMe System Images" > docs/README.md
for FILE in ${FILES}; do
if [ ! -f "${FILE}" ]; then
echo "Cannot find ${FILE}";
exit 1;
else
FILENAME=$(basename $FILE)
echo "![${FILENAME}](${FILENAME})\n" >> docs/README.md
fi
done
git add docs/*
git commit -a -m 'adding rendering of system images to docs folder'
exit 0