From 2c95365d1e56cbc19b7c31c58f84f854116b1239 Mon Sep 17 00:00:00 2001 From: Paller Date: Tue, 9 Nov 2021 11:32:15 +0800 Subject: [PATCH] feat: allows which agent to use, defaults to use all available agents --- src/sdg/Gauntlet.groovy | 20 +++++++++++++++++++- vars/getGauntEnv.groovy | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/sdg/Gauntlet.groovy b/src/sdg/Gauntlet.groovy index 199654da..c45aa4e2 100644 --- a/src/sdg/Gauntlet.groovy +++ b/src/sdg/Gauntlet.groovy @@ -774,6 +774,18 @@ def set_required_hardware(List board_names) { gauntEnv.required_hardware = board_names } +/** + * Set list of required agent for test + * @param agent_names list of strings of names of agent to use + * Strings must be associated with an existing agent. + * For example: sdg-nuc-01, master + */ +def set_required_agent(List agent_names) { + assert agent_names instanceof java.util.List + gauntEnv.required_agent = agent_names + gauntEnv.agents_online = getOnlineAgents() +} + /** * Set URI source. Set URI source. Supported are ip or serial * @param iio_uri_source String of URI source @@ -1017,7 +1029,13 @@ private def getOnlineAgents() { continue } if (!computer.offline) { - online_agents.add(computer.name) + if (!gauntEnv.required_agent.isEmpty()){ + if (computer.name in gauntEnv.required_agent){ + online_agents.add(computer.name) + } + }else{ + online_agents.add(computer.name) + } } } println(online_agents) diff --git a/vars/getGauntEnv.groovy b/vars/getGauntEnv.groovy index 324f41eb..9509ac2a 100644 --- a/vars/getGauntEnv.groovy +++ b/vars/getGauntEnv.groovy @@ -23,6 +23,7 @@ private def call(hdlBranch, linuxBranch, bootPartitionBranch,firmwareVersion, bo agents: [], boards: [], required_hardware: [], + required_agent: [], firmware_boards: ['pluto','m2k'], enable_docker: false, docker_image: 'tfcollins/sw-ci:latest',