Skip to content

fix(ci): improve for parallelism issue in Groovy

Raphael Defosseux requested to merge ci-fix-groovy-parallelism-issue into develop

Post merge of !2367 (merged)

I noticed that groovy does not handle that well parallelism on the variables. By default, there are global.

And in my case, I cannot have make testBullet variable local to post:

          post {
             always {
               script {
                 testBullet = finalizeSlaveJob('RAN-RHEL8-Cluster-Image-Builder')
               }
             }
             failure {
               script {
                 currentBuild.result = 'FAILURE'
                 failingStages += testBullet
               }
             }
           }

And second point, when finalizeSlaveJob is called twice in parallel, only one HTLM file is artifacted:

See !2394 (comment 99557)

  • Only the RAN-SA-OAIUE-CN5G HTLM report was artifacted, not the NSA pipeline one
03:47:34  Copied 1 artifact from "RAN-NSA-B200-Module-LTEBOX-Container" build number 4266
03:47:34  Copied 1 artifact from "RAN-SA-OAIUE-CN5G" build number 819
[Pipeline] fileExists
[Pipeline] fileExists
[Pipeline] sh
[Pipeline] sh
03:47:35  + sed -i -e s#TEMPLATE_BUILD_TIME#2023-10-16 00:57:24# test_results-RAN-SA-OAIUE-CN5G.html
[Pipeline] archiveArtifacts
03:47:35  + sed -i -e s#TEMPLATE_BUILD_TIME#2023-10-16 00:57:24# test_results-RAN-SA-OAIUE-CN5G.html
03:47:35  Archiving artifacts
[Pipeline] }
[Pipeline] archiveArtifacts
03:47:35  Archiving artifacts

That's why I put a protected section in the whole finalizeSlaveJob function.

As usual, in documentation since it cannot be tested before merge.

Merge request reports