Skip to content

Commit 8c621b9

Browse files
authored
ci: bump status-jenkins-lib version, don't use a branch (#6446)
* ci: bump status-jenkins-lib version, don't use a branch Also renamed `Jenkinsfile.nix` to `nix.Jenkinsfile` because the filename makes no sense. But left a symlink temporarily to not break things. Signed-off-by: Jakub Sokołowski <[email protected]> * nix: fix hash for Nim compiler checksums repo Signed-off-by: Jakub Sokołowski <[email protected]> * nix: do not create variable name conflicts Signed-off-by: Jakub Sokołowski <[email protected]> --------- Signed-off-by: Jakub Sokołowski <[email protected]>
1 parent 949758e commit 8c621b9

File tree

5 files changed

+89
-88
lines changed

5 files changed

+89
-88
lines changed

ci/Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
77
* at your option. This file may not be copied, modified, or distributed except according to those terms.
88
*/
9-
library 'status-jenkins-lib@v1.8.14'
9+
library 'status-jenkins-lib@v1.9.2'
1010

1111
pipeline {
1212
/* This way we run the same Jenkinsfile on different platforms. */

ci/Jenkinsfile.nix

-85
This file was deleted.

ci/Jenkinsfile.nix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nix.Jenkinsfile

ci/nix.Jenkinsfile

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env groovy
2+
/* beacon_chain
3+
* Copyright (c) 2019-2024 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+
/* This way we run the same Jenkinsfile on different platforms. */
13+
agent { label params.AGENT_LABEL }
14+
15+
parameters {
16+
string(
17+
name: 'AGENT_LABEL',
18+
description: 'Label for targetted CI slave host: linux/macos',
19+
defaultValue: params.AGENT_LABEL ?: getAgentLabel(),
20+
)
21+
choice(
22+
name: 'VERBOSITY',
23+
description: 'Value for the V make flag to increase log verbosity',
24+
choices: [0, 1, 2]
25+
)
26+
}
27+
28+
options {
29+
timestamps()
30+
ansiColor('xterm')
31+
/* This also includes wait time in the queue. */
32+
timeout(time: 1, unit: 'HOURS')
33+
/* Limit builds retained. */
34+
buildDiscarder(logRotator(
35+
numToKeepStr: '5',
36+
daysToKeepStr: '30',
37+
))
38+
/* Abort old builds for non-main branches. */
39+
disableConcurrentBuilds(
40+
abortPrevious: !isMainBranch()
41+
)
42+
}
43+
44+
stages {
45+
stage('Beacon Node') {
46+
steps { script {
47+
nix.flake('beacon_node')
48+
} }
49+
}
50+
51+
stage('Version check') {
52+
steps { script {
53+
sh 'result/bin/nimbus_beacon_node --version'
54+
} }
55+
}
56+
}
57+
58+
post {
59+
always {
60+
cleanWs(
61+
disableDeferredWipeout: true,
62+
deleteDirs: true
63+
)
64+
}
65+
}
66+
}
67+
68+
def isMainBranch() {
69+
return ['stable', 'testing', 'unstable'].contains(env.BRANCH_NAME)
70+
}
71+
72+
/* This allows us to use one Jenkinsfile and run
73+
* jobs on different platforms based on job name. */
74+
def getAgentLabel() {
75+
if (params.AGENT_LABEL) { return params.AGENT_LABEL }
76+
/* We extract the name of the job from currentThread because
77+
* before an agent is picket env is not available. */
78+
def tokens = Thread.currentThread().getName().split('/')
79+
def labels = []
80+
/* Check if the job path contains any of the valid labels. */
81+
['linux', 'macos', 'x86_64', 'aarch64', 'arm64'].each {
82+
if (tokens.contains(it)) { labels.add(it) }
83+
}
84+
return labels.join(' && ')
85+
}

nix/checksums.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ in pkgs.fetchFromGitHub {
88
repo = "checksums";
99
rev = tools.findKeyValue "^ +ChecksumsStableCommit = \"([a-f0-9]+)\"$" sourceFile;
1010
# WARNING: Requires manual updates when Nim compiler version changes.
11-
hash = "sha256-AIiMBqLcGJCTkINHfJ2dN3ogitU7Za9Z9Sv9zjKeOQk=";
11+
hash = "sha256-RB2IXs2xcfYHhV9d7l1mtHW51mtsrqrYRapSoTikvHw=";
1212
}

nix/tools.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let
77
in {
88
findKeyValue = regex: sourceFile:
99
let
10-
linesFrom = sourceFile: splitString "\n" (fileContents sourceFile);
10+
linesFrom = file: splitString "\n" (fileContents file);
1111
matching = regex: lines: map (line: match regex line) lines;
1212
extractMatch = matches: last (flatten (remove null matches));
1313
in

0 commit comments

Comments
 (0)