aboutsummaryrefslogtreecommitdiff
path: root/locale/fr/LC_MESSAGES/_tils/2020-11-12-diy-bare-bones-ci-server-with-bash-and-nix.po
blob: f1bf8afe5afcebd92f0920465357e2615d5dc2d6 (about) (plain) (blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#
msgid ""
msgstr ""

msgid "title: DIY bare bones CI server with Bash and Nix"
msgstr ""

msgid "date: 2020-11-12 3"
msgstr ""

msgid "layout: post"
msgstr ""

msgid "lang: en"
msgstr ""

msgid "ref: diy-bare-bones-ci-server-with-bash-and-nix"
msgstr ""

msgid ""
"With a server with Nix installed (no need for NixOS), you can leverage its "
"build isolation for running CI jobs by adding a [post-receive](https://git-"
"scm.com/book/en/v2/Customizing-Git-Git-Hooks) Git hook to the server."
msgstr ""

msgid ""
"In most of my project I like to keep a `test` attribute which runs the test "
"with `nix-build -A test`. This way, a post-receive hook could look like:"
msgstr ""

msgid ""
"We initially (lines #5 to #8) create a log file, named after *when* the run "
"is running and for *which* commit it is running for. The `exec` and `tee` "
"combo allows the output of the script to go both to `stdout` *and* the log "
"file. This makes the logs output show up when you do a `git push`."
msgstr ""

msgid ""
"Lines #10 to #13 create a fresh clone of the repository and line #20 runs "
"the test command."
msgstr ""

msgid "Upsides"
msgstr ""

msgid "No vendor lock-in, as all you need is a server with Nix installed."
msgstr ""

msgid ""
"And if you pin the Nixpkgs version you're using, this very simple setup "
"yields extremely sandboxed runs on a very hermetic environment."
msgstr ""

msgid "Downsides"
msgstr ""

msgid ""
"Besides the many missing shiny features of this very simplistic CI, `nix-"
"build` can be very resource intensive. Specifically, it consumes too much "
"memory. So if it has to download too many things, or the build closure gets "
"too big, the server might very well run out of memory."
msgstr ""

msgid ""
"#!/usr/bin/env bash\n"
"set -Eeuo pipefail\n"
"set -x\n"
"\n"
"LOGS_DIR=\"/data/static/ci-logs/libedn\"\n"
"mkdir -p \"$LOGS_DIR\"\n"
"LOGFILE=\"${LOGS_DIR}/$(date -Is)-$(git rev-parse master).log\"\n"
"exec &> >(tee -a \"${LOGFILE}\")\n"
"\n"
"unset GIT_DIR\n"
"CLONE=\"$(mktemp -d)\"\n"
"git clone . \"$CLONE\"\n"
"pushd \"$CLONE\"\n"
"\n"
"finish() {\n"
"  printf \"\\n\\n>>> exit status was %s\\n\" \"$?\"\n"
"}\n"
"trap finish EXIT\n"
"\n"
"nix-build -A test\n"
msgstr ""

msgid "eu_categories: ci"
msgstr ""

msgid ""
"After using a similar post-receive hook for a while, I now even generate a "
"simple HTML file to make the logs available ([example "
"project](https://euandreh.xyz/remembering/ci.html)) through the browser."
msgstr ""

#~ msgid ""
#~ "After using a similar post-receive hook for a while, I now even generate a "
#~ "simple HTML file to make the logs available ([example "
#~ "project](https://euandreh.xyz/remembering/)) through the browser."
#~ msgstr ""

#~ msgid ""
#~ "After using a similar post-receive hook for a while, I now even generate a "
#~ "simple HTML file to make the [logs available](https://ci.euandreh.xyz/) "
#~ "through the browser."
#~ msgstr ""

#~ msgid ""
#~ "#!/usr/bin/env bash\n"
#~ "set -Eeuo pipefail\n"
#~ "set -x\n"
#~ "\n"
#~ "LOGS_PREFIX=\"/data/static/ci-logs/libedn\"\n"
#~ "mkdir -p \"$LOGS_DIR\"\n"
#~ "LOGFILE=\"${LOGS_DIR}/$(date -Is)-$(git rev-parse master).log\"\n"
#~ "exec &> >(tee -a \"${LOGFILE}\")\n"
#~ "\n"
#~ "unset GIT_DIR\n"
#~ "CLONE=\"$(mktemp -d)\"\n"
#~ "git clone . \"$CLONE\"\n"
#~ "pushd \"$CLONE\"\n"
#~ "\n"
#~ "finish() {\n"
#~ "  printf \"\\n\\n>>> exit status was %s\\n\" \"$?\"\n"
#~ "}\n"
#~ "trap finish EXIT\n"
#~ "\n"
#~ "nix-build -A test\n"
#~ msgstr ""