Skip to content

Commit 19c4842

Browse files
committed
ci: split Jenkins test gates by branch
1 parent e24ff71 commit 19c4842

4 files changed

Lines changed: 40 additions & 4 deletions

File tree

‎Jenkinsfile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ pipeline {
1212
steps { sh 'scripts/build.sh' }
1313
}
1414
stage('Test') {
15-
steps { sh 'scripts/test.sh' }
15+
steps {
16+
sh 'if [ -n "${CBM_TEST_SUITES:-}" ]; then scripts/test.sh --suites "$CBM_TEST_SUITES"; else scripts/test.sh; fi'
17+
}
1618
}
1719
stage('Archive Linux CLI artifact') {
1820
steps {

‎scripts/jenkins-local-job.sh‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ jenkins_url="${JENKINS_TARGET_URL:-http://192.168.88.146:8080}"
77
cli="${JENKINS_CLI:-/tmp/codebase-memory-cli-jenkins-cli.jar}"
88
job_dir="${JENKINS_HOME:-/var/lib/jenkins}/jobs/$job_name"
99
config="$job_dir/config.xml"
10+
case "$job_name" in
11+
codebase-memory-cli-release-tooling) job_template="$root/scripts/jenkins-local-job.xml" ;;
12+
codebase-memory-cli-main) job_template="$root/scripts/jenkins-main-job.xml" ;;
13+
*) echo "unsupported JENKINS_JOB_NAME: $job_name" >&2; exit 2 ;;
14+
esac
1015

1116
if [[ -r /home/nate/.config/osint-suite/jenkins.env ]]; then
1217
# Reuse the host's existing Jenkins credentials when no explicit ones were set.
@@ -30,9 +35,9 @@ case "${1:-}" in
3035
curl -fsS "$jenkins_url/jnlpJars/jenkins-cli.jar" -o "$cli"
3136
fi
3237
if cli get-job "$job_name" >/dev/null 2>&1; then
33-
cli update-job "$job_name" < "$root/scripts/jenkins-local-job.xml"
38+
cli update-job "$job_name" < "$job_template"
3439
else
35-
cli create-job "$job_name" < "$root/scripts/jenkins-local-job.xml"
40+
cli create-job "$job_name" < "$job_template"
3641
fi
3742
echo "configured $job_name"
3843
;;

‎scripts/jenkins-local-job.xml‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
<?xml version='1.1' encoding='UTF-8'?>
22
<flow-definition plugin="workflow-job">
3-
<description>Script-triggered codebase-memory-cli release-tooling build and test.</description>
3+
<description>Fast incremental codebase-memory-cli release-tooling build and test.</description>
44
<properties>
55
<org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty>
66
<abortPrevious>false</abortPrevious>
77
</org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty>
8+
<hudson.model.ParametersDefinitionProperty>
9+
<parameterDefinitions>
10+
<hudson.model.StringParameterDefinition>
11+
<name>CBM_TEST_SUITES</name>
12+
<defaultValue>cli daemon daemon_ipc pipeline</defaultValue>
13+
<description>Focused incremental test suites for release-tooling. Leave empty only to run the full gate manually.</description>
14+
<trim>true</trim>
15+
</hudson.model.StringParameterDefinition>
16+
</parameterDefinitions>
17+
</hudson.model.ParametersDefinitionProperty>
818
</properties>
919
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition">
1020
<scm class="hudson.plugins.git.GitSCM">

‎scripts/jenkins-main-job.xml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version='1.1' encoding='UTF-8'?>
2+
<flow-definition plugin="workflow-job">
3+
<description>Full codebase-memory-cli main build and test gate.</description>
4+
<properties>
5+
<org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty>
6+
<abortPrevious>false</abortPrevious>
7+
</org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty>
8+
</properties>
9+
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition">
10+
<scm class="hudson.plugins.git.GitSCM">
11+
<userRemoteConfigs><hudson.plugins.git.UserRemoteConfig><url>file:///lump/apps/codebase-memory-cli</url></hudson.plugins.git.UserRemoteConfig></userRemoteConfigs>
12+
<branches><hudson.plugins.git.BranchSpec><name>refs/heads/main</name></hudson.plugins.git.BranchSpec></branches>
13+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations><submoduleCfg class="empty-list"/><extensions/>
14+
</scm>
15+
<scriptPath>Jenkinsfile</scriptPath><lightweight>true</lightweight>
16+
</definition>
17+
<triggers/>
18+
<disabled>false</disabled>
19+
</flow-definition>

0 commit comments

Comments
 (0)