This is an automated email from the ASF dual-hosted git repository.

mcimbalek pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-pipelines.git


The following commit(s) were added to refs/heads/main by this push:
     new 441fd7b4 kie-issues-777: fix nodes without docker being assigned for 
docker jobs (#1184)
441fd7b4 is described below

commit 441fd7b455f1295096efea6ea7ea38bfdfb006ef
Author: Martin Cimbalek <[email protected]>
AuthorDate: Wed Feb 21 13:37:27 2024 +0100

    kie-issues-777: fix nodes without docker being assigned for docker jobs 
(#1184)
    
    default label 'ubuntu' will be used as a base for calling avoidFaultyNodes
---
 jenkins-pipeline-shared-libraries/vars/util.groovy | 24 ++++------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/jenkins-pipeline-shared-libraries/vars/util.groovy 
b/jenkins-pipeline-shared-libraries/vars/util.groovy
index ae7c5d28..63c9a921 100644
--- a/jenkins-pipeline-shared-libraries/vars/util.groovy
+++ b/jenkins-pipeline-shared-libraries/vars/util.groovy
@@ -560,12 +560,12 @@ void waitForDocker() {
  * Method to wrap original label and exclude nodes that were marked as faulty 
in some of the parent folders.
  * Example usage in agent block: `label util.avoidFaultyNodes('ubuntu')`
  * `FAULTY_NODES` environment variable is inherited down the folder tree and 
available in jobs.
- * @param label Node label to be used
+ * @param label Node label to be used. If empty, 'ubuntu' will be used as 
default
  * @return Node label extended with an expression ensuring to exclude nodes 
marked as faulty.
  */
-String avoidFaultyNodes(String label) {
-    if (label == null || label.isEmpty()) {
-        return avoidFaultyNodes()
+String avoidFaultyNodes(String label = 'ubuntu') {
+    if (label.isEmpty()) {
+        label = 'ubuntu'
     }
     String faultyNodesString = env.FAULTY_NODES
     if((faultyNodesString == null) || faultyNodesString.isEmpty()) {
@@ -575,19 +575,3 @@ String avoidFaultyNodes(String label) {
     String result = "(${label}) && !(${String.join(' || ', faultyNodes)})"
     return result.toString()
 }
-
-/**
- * Method to exclude nodes that were marked as faulty in some of the parent 
folders.
- * Example usage in agent block: `label util.avoidFaultyNodes()`
- * `FAULTY_NODES` environment variable is inherited down the folder tree and 
available in jobs.
- * @return Node label expression ensuring to exclude nodes marked as faulty.
- */
-String avoidFaultyNodes() {
-    String faultyNodesString = env.FAULTY_NODES
-    if((faultyNodesString == null) || faultyNodesString.isEmpty()) {
-        return '!dummyLabel'    // we need to put something here because label 
without parameter would cause compile error
-    }
-    String[] faultyNodes = faultyNodesString.split(',')
-    String result = "!(${String.join(' || ', faultyNodes)})"
-    return result.toString()
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to