Skip to content

Commit dec986d

Browse files
committed
Pull request project-chip#1802: [Matter SQA] Bring SQA changes to silabs_slc_1.3
Merge in WMN_TOOLS/matter from matter_sqa_new_stage to silabs_slc_1.3 Squashed commit of the following: commit d15447ca7153045c559df0e874dbc4d0d1efe619 Author: Stefan Livadariu <stlivada@silabs.com> Date: Tue Apr 30 11:39:12 2024 -0400 removed function not in use anymore commit bce84480d98b8f60c86f27aebf98c8bc23be468e Merge: d1670197cf 83a9794 Author: Stefan Livadariu <stlivada@silabs.com> Date: Tue Apr 30 11:27:57 2024 -0400 Merge branch 'silabs_slc_1.3' of https://stash.silabs.com/scm/wmn_tools/matter into matter_sqa_new_stage commit d1670197cf40024cfec58bbfcc50946bd255cd4b Author: Stefan Livadariu <stlivada@silabs.com> Date: Mon Apr 29 10:57:36 2024 -0400 matter sqa modifications for sqa build pipeline ... and 457 more commits
1 parent b2f0cf9 commit dec986d

File tree

2 files changed

+78
-73
lines changed

2 files changed

+78
-73
lines changed

Jenkinsfile

+15-65
Original file line numberDiff line numberDiff line change
@@ -201,73 +201,11 @@ def initExtensionWorkspaceAndScm()
201201
sh 'scripts/checkout_submodules.py --shallow --platform silabs linux'
202202

203203
// ************************************************************************************
204-
// Update or create SQA build pipeline for RC and silabs_slc before continuing
204+
// Load variables for SQA Build Pipeline
205205
// ************************************************************************************
206206

207-
if(env.BRANCH_NAME.startsWith("RC_slc") || env.BRANCH_NAME.startsWith("silabs_slc")){
208-
def sqaBranchName = "sqa_" + env.BRANCH_NAME
209-
def sqaMatterBuildNumber = env.BUILD_NUMBER.toInteger() - 1
210-
def branchExists = sh(script: "git rev-parse --verify --quiet origin/${sqaBranchName}", returnStatus: true)
211-
echo "branchExists: $branchExists"
212-
if (branchExists == 0) {
213-
//If SQA build branch exists, checkout the branch, merge the RC/silabs branch to update it, update matter build number, update sqa matter build number and push to repo
214-
echo "Branch $sqaBranchName exists. Updating branch $sqaBranchName"
215-
try {
216-
sh """
217-
git checkout ${sqaBranchName}
218-
git merge origin/${env.BRANCH_NAME} -X theirs
219-
echo Merge successful.
220-
echo MATTER_BUILD_NUMBER=${env.BUILD_NUMBER} > jenkins/matterBuildNumber.groovy
221-
echo SQA_MATTER_BUILD_NUMBER=${sqaMatterBuildNumber} > jenkins/sqaMatterBuildNumber.groovy
222-
git add jenkins/matterBuildNumber.groovy jenkins/sqaMatterBuildNumber.groovy
223-
git config --global user.email "buildengineer@silabs.com"
224-
git config --global user.name "Ember Buildengineer"
225-
git commit -m "Update SQA branch, matter build number and sqa matter build number"
226-
git push origin ${sqaBranchName}
227-
"""
228-
} catch (e) {
229-
echo "Updating SQA branch failed: ${e.message}"
230-
}
231-
} else {
232-
//If SQA build branch does not exist, need to create it, add CRON trigger, add matter build number and initialize sqa matter build number to 0 and then push to repo
233-
echo "Branch $sqaBranchName does not exist. Creating branch $sqaBranchName"
234-
try {
235-
sh"""
236-
git checkout -b ${sqaBranchName}
237-
sed -i '7i\\ pipelineTriggers([cron(\"0 1 * * *\")]),' Jenkinsfile
238-
echo MATTER_BUILD_NUMBER=${env.BUILD_NUMBER} > jenkins/matterBuildNumber.groovy
239-
echo SQA_MATTER_BUILD_NUMBER=${sqaMatterBuildNumber} > jenkins/sqaMatterBuildNumber.groovy
240-
git add Jenkinsfile jenkins/matterBuildNumber.groovy jenkins/sqaMatterBuildNumber.groovy
241-
git config --global user.email "buildengineer@silabs.com"
242-
git config --global user.name "Ember Buildengineer"
243-
git commit -m 'Create SQA branch, insert CRON trigger, save matter build number and initialize sqa matter build number'
244-
git push origin -u ${sqaBranchName}
245-
"""
246-
} catch (e) {
247-
echo "Creating SQA branch failed: ${e.message}"
248-
}
249-
}
250-
// Checkout original branch to continue
251-
sh "git checkout ${env.BRANCH_NAME}"
252-
// If it's a SQA branch, compare CI build number to SQA build number. This logic is used to trigger building the binaries if the CI build number is greater than the SQA build number.
253-
// If it's not, then exit pipeline successfully without building SQA binaries to avoid duplicates
254-
// This logic is a placeholder for now, cleaner option would be to trigger the SQA branch when DEV branch changes it
255-
} else if (env.BRANCH_NAME.startsWith("sqa_")){
256-
pipelineFunctions.sqaBuildNumberAndBranch()
257-
if(MATTER_BUILD_NUMBER > SQA_MATTER_BUILD_NUMBER){
258-
sh"""
259-
git checkout ${env.BRANCH_NAME}
260-
echo SQA_MATTER_BUILD_NUMBER=${SQA_MATTER_BUILD_NUMBER + 1} > jenkins/sqaMatterBuildNumber.groovy
261-
git add Jenkinsfile jenkins/matterBuildNumber.groovy jenkins/sqaMatterBuildNumber.groovy
262-
git config --global user.email "buildengineer@silabs.com"
263-
git config --global user.name "Ember Buildengineer"
264-
git commit -m 'Update sqa matter build number'
265-
git push origin ${env.BRANCH_NAME}
266-
"""
267-
} else {
268-
currentBuild.result = 'ABORTED'
269-
error "No new build from DEV"
270-
}
207+
if (env.BRANCH_NAME.startsWith("sqa_")){
208+
pipelineFunctions.matterBranchAndBuild()
271209
}
272210

273211
// ************************************************************************************
@@ -446,6 +384,18 @@ def pipeline()
446384
}
447385
}
448386

387+
// This stage is used for RC_slc or silabs_slc branches to create or update the SQA Build Pipeline.
388+
if(env.BRANCH_NAME.startsWith('RC_slc') || env.BRANCH_NAME.startsWith('silabs_slc')){
389+
stage("Create/Update SQA Build Pipeline")
390+
{
391+
advanceStageMarker()
392+
def parallelNodesBuild = [:]
393+
parallelNodesBuild["Create/Update"] = containerWrapper('NONE', buildFarmLargeLabel, null, "", 'matter/', { pipelineFunctions.createOrUpdateSQABuildPipeline() })
394+
parallelNodesBuild.failFast = false
395+
parallel parallelNodesBuild
396+
}
397+
}
398+
449399
stage("Push to Artifactory and UBAI")
450400
{
451401
advanceStageMarker()

jenkins/jenkinsFunctions.groovy

+63-8
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ def buildOtaImages(){
187187
appsToBuild += getBuildConfigs(board="BRD4187C", appName="thermostat", otaVersion="2", ncp = "", configs = software_version_2, useWorkspace = true, additionalComponents = "")
188188
appsToBuild += getBuildConfigs(board="BRD4187C", appName="window-app", otaVersion="2", ncp = "", configs = software_version_2, useWorkspace = true, additionalComponents = "")
189189
appsToBuild += getBuildConfigs(board="BRD4187C", appName="lighting-app", otaVersion="3", ncp = "", configs = software_version_3, useWorkspace = true, additionalComponents = "")
190+
appsToBuild += getBuildConfigs(board="BRD4187C", appName="lighting-app", otaVersion="2", ncp = "wf200", configs = software_version_2, useWorkspace = true, additionalComponents = "")
191+
appsToBuild += getBuildConfigs(board="BRD4187C", appName="lighting-app", otaVersion="2", ncp = "917-ncp", configs = software_version_2, useWorkspace = true, additionalComponents = "")
192+
appsToBuild += getBuildConfigs(board="BRD4187C", appName="lighting-app", otaVersion="2", ncp = "rs911x", configs = software_version_2, useWorkspace = true, additionalComponents = "")
190193
slcBuild(appsToBuild, "OTA Images")
191194
}
192195
// Builds all Wifi examples by board (depending on build type)
@@ -667,7 +670,7 @@ def triggerSqaSmokeAndRegressionTest(buildTool,matterBranchName=env.BRANCH_NAME,
667670
echo 'in product jenkin.... '
668671
//Regression triggered by SQA build branch
669672
if(env.BRANCH_NAME.startsWith('sqa_')){
670-
sqaFunctions.commitToMatterSqaPipelines(buildTool, 'regression', matterBranchName, matterBuildNumber)
673+
sqaFunctions.commitToMatterSqaPipelines(buildTool, 'regression-slc', matterBranchName, matterBuildNumber)
671674
sqaFunctions.commitToMatterSqaPipelines(buildTool, 'regression-ota', matterBranchName, matterBuildNumber)
672675
sqaFunctions.commitToMatterSqaPipelines(buildTool, 'endurance-customers-issues', matterBranchName, matterBuildNumber)
673676
sqaFunctions.commitToMatterSqaPipelines(buildTool, 'regression-enhanced-groups', matterBranchName, matterBuildNumber)
@@ -1032,24 +1035,76 @@ def copyWifiFirmware(){
10321035
cp third_party/silabs/wiseconnect-wifi-bt-sdk/firmware/RS916W.2.*.rps ${savedDirectory}/out/WiFi-Firmware/rs911x/Evk_1.5/
10331036
"""
10341037
}
1035-
// Retrieve the CI branch, build number and SQA build number to be used in the SQA build branch logic
1036-
def sqaBuildNumberAndBranch()
1038+
// This stage is used for RC_slc or silabs_slc branches to create or update the SQA Build Pipeline.
1039+
def createOrUpdateSQABuildPipeline()
1040+
{
1041+
def matterPath = env.WORKSPACE + "/matter"
1042+
dir(matterPath){
1043+
def sqaBranchName = "sqa_" + env.BRANCH_NAME
1044+
def branchExists = sh(script: "git rev-parse --verify --quiet origin/${sqaBranchName}", returnStatus: true)
1045+
echo "branchExists: $branchExists"
1046+
if (branchExists == 0) {
1047+
// If SQA build branch exists, checkout the branch, merge the RC/silabs branch to update it, add the
1048+
// CI Matter Build Number for reference and then push.
1049+
echo "Branch $sqaBranchName exists. Updating branch $sqaBranchName"
1050+
try {
1051+
sh """
1052+
cd ..
1053+
git reset --hard HEAD
1054+
git status
1055+
git checkout ${sqaBranchName}
1056+
git config --global user.email "buildengineer@silabs.com"
1057+
git config --global user.name "Ember Buildengineer"
1058+
git merge origin/${env.BRANCH_NAME} -X theirs
1059+
echo Merge successful.
1060+
echo MATTER_BUILD_NUMBER=${env.BUILD_NUMBER} > jenkins/matterBuildNumber.groovy
1061+
git add jenkins/matterBuildNumber.groovy
1062+
git commit -m "Update SQA branch and Matter build number."
1063+
git push origin ${sqaBranchName}
1064+
"""
1065+
} catch (e) {
1066+
echo "Updating SQA branch failed: ${e.message}"
1067+
}
1068+
} else {
1069+
// If SQA build branch does not exist, need to create it, add pollSCM trigger, add the CI Matter Build
1070+
// number and then push.
1071+
echo "Branch $sqaBranchName does not exist. Creating branch $sqaBranchName"
1072+
try {
1073+
sh"""
1074+
cd ..
1075+
git reset --hard HEAD
1076+
git status
1077+
git checkout -b ${sqaBranchName}
1078+
git config --global user.email "buildengineer@silabs.com"
1079+
git config --global user.name "Ember Buildengineer"
1080+
sed -i '7i\\ pipelineTriggers([pollSCM("0 1 * * *")]),' Jenkinsfile
1081+
echo MATTER_BUILD_NUMBER=${env.BUILD_NUMBER} > jenkins/matterBuildNumber.groovy
1082+
git add jenkins/matterBuildNumber.groovy Jenkinsfile
1083+
git commit -m 'Create SQA branch, insert pollSCM trigger and save Matter build number to file.'
1084+
git push origin -u ${sqaBranchName}
1085+
"""
1086+
} catch (e) {
1087+
echo "Creating SQA branch failed: ${e.message}"
1088+
}
1089+
}
1090+
}
1091+
}
1092+
// SQA Build Branch only: Retrieve the Matter CI branch and build number.
1093+
def matterBranchAndBuild()
10371094
{
10381095
def branchName = env.BRANCH_NAME.substring(4)
10391096
env.matterBranchName = env.BRANCH_NAME.substring(4)
10401097
echo "Matter Branch Name: ${matterBranchName}"
1041-
if (fileExists('jenkins/matterBuildNumber.groovy') && fileExists('jenkins/sqaMatterBuildNumber.groovy')) {
1042-
echo "MatterBuildNumber and sqaMatterBuildNumber files exist"
1098+
if (fileExists('jenkins/matterBuildNumber.groovy')) {
1099+
echo "MatterBuildNumber file exists."
10431100
try{
10441101
env.matterBuildNumber = load 'jenkins/matterBuildNumber.groovy'
1045-
env.sqaMatterBuildNumber = load 'jenkins/sqaMatterBuildNumber.groovy'
10461102
echo "Matter Build Number: ${MATTER_BUILD_NUMBER}"
1047-
echo "SQA Matter Build Number: ${SQA_MATTER_BUILD_NUMBER}"
10481103
} catch (Exception e) {
10491104
echo "Error loading file."
10501105
}
10511106
} else {
1052-
echo "MatterBuildNumber or sqaMatterBuildNumber files do not exist."
1107+
echo "MatterBuildNumber file does not exist."
10531108
}
10541109
}
10551110
return this

0 commit comments

Comments
 (0)