summaryrefslogtreecommitdiff
path: root/playbooks/roles/src/templates/volumes/soft-serve/hooks/update
blob: c209b41ae243401f7af079b634df8c09b47b36d5 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash

# -- <logo> --
function logo() {
    git config --global color.ui auto

cat <<'EOF'
--|                                                        |--
--|                    ~ welcome to ~                      |--
--|                                                        |--
--|   .-.   _                       .--. .--.              |--
--|   :.:  :_;                     : .-': .-'              |--
--|   :.:  .-..---.     .--.  .--. : `; : `;.--.  .--.     |--
--|   :.:_ : :`-'_.' _ '  ..'' .; :: :  : :' '_.'' '_.'    |--
--|   `.__;:_;`.___;:_;`.__.'`.__.':_;  :_;`.__.'`.__.'    |--
--|                                                        |--
--|        ~₊˚⊹ ⋆˚✿˖°~   -────୨ৎ────-   ~₊˚⊹ ⋆˚✿˖°~        |--
--|   ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀                  |--
--|   ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠒⠉⠉⠉⣀⣂⣅⠬⡉⠭⢛⠿⢟⡶⣄⡀⠀⠀⠀⠀  we'll get brewing   |--
--|   ⠀⠀⠀⠀⠀⠀⠀⣠⠞⠁⠀⣄⢎⢩⢸⢉⣵⡖⢰⣶⣮⢹⣦⣡⢊⢻⡿⣦⠀⠀⠀  right away!         |--
--|   ⠀⠀⠀⠀⠀⠀⢠⡇⠀⠀⢎⠕⢭⢪⡶⠈⢿⣷⣿⠟⣋⣚⣯⣒⣣⡑⢨⢻⡇⠀⣀⣀⠀⠀⠀                  |--
--|   ⠀⠀⠀⠀⠀⣀⡼⣧⠀⠄⡊⢼⡩⣾⢌⠳⡜⣉⡠⡜⡞⣵⣊⡧⡠⠝⣣⡾⠁⠀⠻⠿⠗⠀⠀   /) /) (\ (\    |--
--|   ⠀⠀⠀⣢⣾⡟⣥⠻⣷⣌⡀⠬⡘⢅⡟⡇⡮⣷⡾⡿⢋⣉⢣⢔⣎⠿⠊⠀⠀⡴⣛⠆⠌⠀⠀  ( . .) (. . )   |--
--|   ⠀⢀⣶⡟⣡⣿⣿⣟⢯⣟⢿⣷⣶⣯⣬⣵⣾⣷⣶⡾⠧⠞⠓⠉⠀⠀⠀⢀⠘⠈⠀⠠⢘⡤⠀  ( づ ˚♡︎˖  ⊂ )   |--
--|   ⠄⣾⠏⣐⣛⡻⢿⣿⣯⣿⣿⣿⣾⣽⣛⣍⢃⡂⢄⠀⡀⠀⡀⠄⢂⠄⠡⢈⠒⡈⢒⠘⠴⢀⠀                  |--
--|   ⢰⣿⠀⠈⠻⣜⣄⠈⢙⣾⢿⣿⣿⣿⡿⣜⢣⡜⢢⠁⠄⡐⢠⢉⠂⠌⠀⡀⠄⠐⡀⠄⠐⠀⢐      ___         |--
--|   ⠸⣟⠀⡐⡅⠈⠑⠀⠊⠝⠈⢖⡿⠿⣿⣾⡱⢊⠅⡌⡰⢌⢆⠣⠈⢀⠐⠀⠄⠂⠠⡈⠠⣈⡧     (...)        |--
--|   ⠀⢿⣆⠱⣘⣧⣤⣀⣀⡀⢒⡥⣑⢨⠒⡰⠯⠾⡼⠶⠙⢈⠀⣀⠂⡄⢂⣁⢢⣑⣶⡽⣳⠟⠁  _    \ _        |--
--|   ⠀⠀⠻⣧⡜⢹⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣴⡀⡀⠀⠛⠺⢿⣶⣿⣾⣷⣿⣿⣿⢟⣵⠏⠀⠀ ('>    <')       |--
--|   ⠀⠀⠀⠈⠿⣶⣉⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣧⣤⢀⠀⠀⠈⠉⠙⠻⣯⡷⠟⠁⠀⠀⠀ (v)    (v)       |--
--|   ⠀⠀⠀⠀⠀⠈⠙⠿⣶⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣞⣤⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀\(__w  w__)/      |--
--|   ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠿⠿⠿⠿⠿⠿⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀                  |--
--|                                                        |--
--|                                                        |--
EOF
}
# -- </logo> --

# -- <continuous_integration> --
refname="$1"
_oldrev="$2"
rev="$3"

post_trigger_ci_jobs() {
    local host="ci_server"
    local port="9000"
    local path="/job"
    local json_payload=$(printf '{"type": "ci_pipeline", "arguments": {"remote": "%s", "rev": "%s", "refname": "%s"}}' "$1" "$2" "$3")

    echo "> $json_payload"

    which curl 2&>/dev/null || apk add -q curl
    curl -X POST \
         -H "Content-Type: application/json" \
         -H "Connection: close" \
         -d "$json_payload" \
         --no-progress-meter \
         "http://$host:$port$path"

    echo "... Done"
}
# -- </continuous_integration> --

# -- <main> --
remote="ssh://{{ src_domain }}:2222/$(basename "$PWD")"

logo
post_trigger_ci_jobs "$remote" "$rev" "$refname"
# -- </main> --