Skip to content

Commit c7eb55a

Browse files
committed
Add build-fbc job to build file-based catalogs on Konflux
1 parent 92709c0 commit c7eb55a

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed

jobs/build/build-fbc/Jenkinsfile

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
node() {
2+
checkout scm
3+
def buildlib = load('pipeline-scripts/buildlib.groovy')
4+
def commonlib = buildlib.commonlib
5+
commonlib.describeJob("build-fbc", """
6+
<h2>Build FBC segments for OLM operators on Konflux</h2>
7+
""")
8+
9+
properties([
10+
disableResume(),
11+
[
12+
$class: 'ParametersDefinitionProperty',
13+
parameterDefinitions: [
14+
string(
15+
name: 'ART_TOOLS_COMMIT',
16+
description: 'Override the art-tools submodule; Format is ghuser@commitish e.g. jupierce@covscan-to-podman-2',
17+
defaultValue: "",
18+
trim: true
19+
),
20+
choice(
21+
name: 'BUILD_VERSION',
22+
choices: commonlib.ocpVersions,
23+
description: 'OCP Version',
24+
),
25+
string(
26+
name: 'ASSEMBLY',
27+
description: 'Assembly name.',
28+
defaultValue: "stream",
29+
trim: true,
30+
),
31+
string(
32+
name: 'DOOZER_DATA_PATH',
33+
description: 'ocp-build-data fork to use (e.g. test customizations on your own fork)',
34+
defaultValue: "https://github.com/openshift-eng/ocp-build-data",
35+
trim: true,
36+
),
37+
string(
38+
name: 'DOOZER_DATA_GITREF',
39+
description: '(Optional) Doozer data path git [branch / tag / sha] to use',
40+
defaultValue: "",
41+
trim: true,
42+
),
43+
string(
44+
name: 'OPERATOR_NVRS',
45+
description: '(Optional) List **only** the operator NVRs you want to build bundles for, everything else gets ignored. The operators should not be mode:disabled/wip in ocp-build-data',
46+
defaultValue: "",
47+
trim: true,
48+
),
49+
string(
50+
name: 'ONLY',
51+
description: '(Optional) List **only** the operators you want ' +
52+
'to build, everything else gets ignored.\n' +
53+
'Format: Comma and/or space separated list of brew '+
54+
'packages (e.g.: cluster-nfd-operator-container)\n' +
55+
'Leave empty to build all (except EXCLUDE, if defined)',
56+
defaultValue: '',
57+
trim: true,
58+
),
59+
string(
60+
name: 'EXCLUDE',
61+
description: '(Optional) List the operators you **don\'t** want ' +
62+
'to build, everything else gets built.\n' +
63+
'Format: Comma and/or space separated list of brew ' +
64+
'packages (e.g.: cluster-nfd-operator-container)\n' +
65+
'Leave empty to build all (or ONLY, if defined)',
66+
defaultValue: '',
67+
trim: true,
68+
),
69+
booleanParam(
70+
name: 'DRY_RUN',
71+
description: 'Just show what would happen, without actually executing the steps',
72+
defaultValue: false,
73+
),
74+
booleanParam(
75+
name: 'MOCK',
76+
description: 'Pick up changed job parameters and then exit',
77+
defaultValue: false,
78+
),
79+
], // parameterDefinitions
80+
], // ParametersDefinitionProperty
81+
]) // properties
82+
83+
commonlib.checkMock()
84+
85+
stage('Import FBC catalog objects') {
86+
script {
87+
// Prepare working dirs
88+
buildlib.init_artcd_working_dir()
89+
def doozer_working = "${WORKSPACE}/doozer_working"
90+
buildlib.cleanWorkdir(doozer_working)
91+
92+
// Create artcd command
93+
withCredentials([
94+
string(credentialsId: 'redis-server-password', variable: 'REDIS_SERVER_PASSWORD'),
95+
string(credentialsId: 'art-bot-slack-token', variable: 'SLACK_BOT_TOKEN'),
96+
file(credentialsId: 'openshift-bot-ocp-konflux-service-account', variable: 'KONFLUX_SA_KUBECONFIG'),
97+
string(credentialsId: 'konflux-art-images-username', variable: 'KONFLUX_ART_IMAGES_USERNAME'),
98+
string(credentialsId: 'konflux-art-images-password', variable: 'KONFLUX_ART_IMAGES_PASSWORD'),
99+
file(credentialsId: 'konflux-gcp-app-creds-prod', variable: 'GOOGLE_APPLICATION_CREDENTIALS'),
100+
]) {
101+
def cmd = [
102+
"artcd",
103+
"-v",
104+
"--working-dir=./artcd_working",
105+
"--config=./config/artcd.toml",
106+
]
107+
if (params.DRY_RUN) {
108+
cmd << "--dry-run"
109+
}
110+
cmd += [
111+
"build-fbc",
112+
"--version=${params.BUILD_VERSION}",
113+
"--assembly=${params.ASSEMBLY}",
114+
"--data-path=${params.DOOZER_DATA_PATH}",
115+
"--data-gitref=${params.DOOZER_DATA_GITREF}",
116+
"--kubeconfig=${env.KONFLUX_SA_KUBECONFIG}",
117+
]
118+
if (only)
119+
cmd << "--only=${only.join(',')}"
120+
if (exclude)
121+
cmd << "--exclude=${exclude.join(',')}"
122+
if (operator_nvrs)
123+
cmd << "--operator-nvrs=${operator_nvrs.join(',')}"
124+
125+
// Run pipeline
126+
timeout(activity: true, time: 60, unit: 'MINUTES') { // if there is no log activity for 1 hour
127+
echo "Will run ${cmd}"
128+
withEnv(["BUILD_URL=${env.BUILD_URL}"]) {
129+
try {
130+
sh(script: cmd.join(' '), returnStdout: true)
131+
} catch (err) {
132+
throw err
133+
} finally {
134+
commonlib.safeArchiveArtifacts([
135+
"artcd_working/**/*.log",
136+
"artcd_working/**/*.yaml",
137+
])
138+
}
139+
} // withEnv
140+
} // timeout
141+
} // withCredentials
142+
} // script
143+
} //stage
144+
} // node

0 commit comments

Comments
 (0)