forked from kronosnet/ci-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-get-artifacts
executable file
·45 lines (35 loc) · 944 Bytes
/
ci-get-artifacts
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
#!/bin/bash
# ENTRY POINT (done)
set -e
publish=/var/www/ci.kronosnet.org/
sourcenode="$1"
sourcedir="$2"
destdir="$publish/$3"
transferset="$4"
mkdir -p "$destdir"
cd "$destdir"
case $transferset in
rpm)
preptar="$(echo cd $sourcedir \&\& rm -f ci-artifacts.tar \&\& find . -name \"*.rpm\" \| tar -cvf ci-artifacts.tar -T -)"
lock="/tmp/ci-rpm-repos.lock"
# this should help to keep PR dirs clean
find "$destdir" -name "*.rpm" -exec rm -f {} \;
;;
cov)
preptar="$(echo cd $sourcedir/cov.html \&\& rm -f ../ci-artifacts.tar \&\& tar -cvf ../ci-artifacts.tar .)"
lock="/tmp/ci-cov-repos.lock"
;;
*)
echo "Unknown transfer set"
exit 1
;;
esac
ssh "$sourcenode".ci.kronosnet.org $preptar
(
flock -e 200
scp "$sourcenode".ci.kronosnet.org:"$sourcedir"/ci-artifacts.tar .
tar -xvpf ci-artifacts.tar
rm -f ci-artifacts.tar
) 200>$lock
ssh "$sourcenode".ci.kronosnet.org rm -f "$sourcedir"/ci-artifacts.tar
exit 0