Skip to content

Commit 886ba93

Browse files
committed
ci: move the linux build to a container
Referenced issue: * status-im/infra-ci#188
1 parent 9358f33 commit 886ba93

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed

ci/Jenkinsfile.linux

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
#!/usr/bin/env groovy
2+
/* beacon_chain
3+
* Copyright (c) 2019-2025 Status Research & Development GmbH
4+
* Licensed and distributed under either of
5+
* * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
6+
* * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
7+
* at your option. This file may not be copied, modified, or distributed except according to those terms.
8+
*/
9+
10+
11+
pipeline {
12+
agent {
13+
dockerfile {
14+
label 'linuxcontainer'
15+
filename 'linux.Dockerfile'
16+
dir 'ci'
17+
args '--volume=/nix:/nix ' +
18+
'--volume=/etc/nix:/etc/nix '
19+
}
20+
}
21+
22+
parameters {
23+
choice(
24+
name: 'VERBOSITY',
25+
description: 'Value for the V make flag to increase log verbosity',
26+
choices: [0, 1, 2]
27+
)
28+
string(
29+
name: 'NIM_COMMIT',
30+
description: 'Value for the NIM_COMMIT make flag to choose Nim commit',
31+
defaultValue: nimCommitForJob(),
32+
)
33+
}
34+
35+
options {
36+
disableRestartFromStage()
37+
timestamps()
38+
ansiColor('xterm')
39+
/* This also includes wait time in the queue. */
40+
timeout(time: 24, unit: 'HOURS')
41+
/* Limit builds retained. */
42+
buildDiscarder(logRotator(
43+
numToKeepStr: '5',
44+
daysToKeepStr: '30',
45+
artifactNumToKeepStr: '3',
46+
))
47+
/* Throttle number of concurrent builds. */
48+
throttleJobProperty(
49+
throttleEnabled: true,
50+
throttleOption: 'category',
51+
categories: ['nimbus-eth2'],
52+
maxConcurrentPerNode: 1,
53+
maxConcurrentTotal: 9
54+
)
55+
/* Abort old builds for non-main branches. */
56+
disableConcurrentBuilds(
57+
abortPrevious: !isMainBranch()
58+
)
59+
}
60+
61+
environment {
62+
NPROC = Runtime.getRuntime().availableProcessors()
63+
MAKEFLAGS = "V=${params.VERBOSITY} NIM_COMMIT=${params.NIM_COMMIT} -j${env.NPROC}"
64+
XDG_CACHE_HOME = "${env.WORKSPACE_TMP}/.cache"
65+
}
66+
67+
stages {
68+
stage('Deps') {
69+
steps {
70+
timeout(20) {
71+
script {
72+
/* To allow the following parallel stages. */
73+
nix.develop('make QUICK_AND_DIRTY_COMPILER=1 update', pure: false)
74+
/* Allow the following parallel stages. */
75+
nix.develop('make deps', pure: false)
76+
/* Download test vectors. */
77+
nix.develop('./scripts/setup_scenarios.sh', pure: false)
78+
}
79+
}
80+
}
81+
}
82+
83+
stage('Build') {
84+
steps {
85+
timeout(50) {
86+
script {
87+
nix.develop('make LOG_LEVEL=TRACE', pure: false)
88+
}
89+
}
90+
}
91+
}
92+
93+
stage('Check Docs') {
94+
steps {
95+
script {
96+
nix.develop('./scripts/check_docs_help_msg.sh', pure: false)
97+
}
98+
}
99+
}
100+
101+
stage('Tests') {
102+
parallel {
103+
stage('General') {
104+
steps {
105+
timeout(60) {
106+
script {
107+
nix.develop('make DISABLE_TEST_FIXTURES_SCRIPT=1 test', pure: false)
108+
nix.develop('git diff --exit-code --ignore-submodules=all', pure: false)
109+
}
110+
}
111+
}
112+
}
113+
114+
stage('REST') {
115+
steps {
116+
timeout(5) {
117+
script {
118+
nix.develop('make restapi-test', pure: false)
119+
}
120+
}
121+
}
122+
post { always {
123+
sh 'tar cjf restapi-test.tar.gz resttest0_data/*.txt'
124+
} }
125+
}
126+
}
127+
post { always { timeout(5) {
128+
archiveArtifacts(artifacts: '*.tar.gz', allowEmptyArchive: true)
129+
} } }
130+
}
131+
132+
stage('Finalizations') {
133+
stages { /* parallel builds of minimal / mainnet not yet supported */
134+
stage('minimal') {
135+
steps {
136+
timeout(26) {
137+
script {
138+
nix.develop('make local-testnet-minimal', pure: false)
139+
}
140+
}
141+
}
142+
post { always {
143+
sh 'tar cjf local-testnet-minimal.tar.gz local-testnet-minimal/logs/*'
144+
} }
145+
}
146+
147+
stage('mainnet') {
148+
steps {
149+
timeout(62) {
150+
script {
151+
nix.develop('make local-testnet-mainnet', pure: false)
152+
}
153+
}
154+
}
155+
post { always {
156+
sh 'tar cjf local-testnet-mainnet.tar.gz local-testnet-mainnet/logs/*'
157+
} }
158+
}
159+
}
160+
post {
161+
always { timeout(10) {
162+
/* DEBUG: Show file sizes to catch too big ones. */
163+
sh 'ls -hl *.tar.gz'
164+
archiveArtifacts(
165+
artifacts: '*.tar.gz',
166+
excludes: '**/geth-*.tar.gz', /* `scripts/geth_binaries.sh` */
167+
allowEmptyArchive: true
168+
)
169+
} }
170+
}
171+
}
172+
}
173+
174+
post {
175+
always {
176+
cleanWs(
177+
disableDeferredWipeout: true,
178+
deleteDirs: true
179+
)
180+
}
181+
}
182+
}
183+
184+
def isMainBranch() {
185+
return ['stable', 'testing', 'unstable'].contains(env.BRANCH_NAME)
186+
}
187+
188+
def nimCommitForJob() {
189+
return JOB_NAME.contains('nimv2_2') ? 'upstream/version-2-2' : ''
190+
}

ci/linux.Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM debian:bookworm-slim
2+
3+
RUN apt-get update && apt-get install -yq --no-install-recommends --fix-missing \
4+
ca-certificates \
5+
curl \
6+
git \
7+
bzip2 \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
RUN groupadd -r jenkins --gid 1001 \
11+
&& useradd -r -m -g jenkins --uid 1001 -d /home/jenkins jenkins
12+
13+
RUN groupadd -g 999 docker && \
14+
usermod -a -G docker jenkins
15+
16+
USER jenkins
17+
18+
ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin"
19+
ENV NIX_REMOTE=daemon
20+
ENV HOME=/home/jenkins
21+
22+
ENTRYPOINT [""]

0 commit comments

Comments
 (0)