From 78d73c5d9f12acf455de101db2b2877c46ffbfb6 Mon Sep 17 00:00:00 2001 From: Thomas Carpentier Date: Fri, 21 Jun 2024 17:27:26 +0200 Subject: [PATCH] Use Timepstamp in device name to be unique --- main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index a1323ee..c497fcd 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "os/exec" "strings" "sync" + "time" "github.com/bitrise-io/go-steputils/stepconf" "github.com/bitrise-io/go-steputils/tools" @@ -238,12 +239,15 @@ func main() { adbSerialPortList = strings.Split(c.GMCloudSaaSAdbSerialPort, ",") } - buildNumber := os.Getenv("BITRISE_BUILD_NUMBER") + workflowID := os.Getenv("BITRISE_TRIGGERED_WORKFLOW_ID") + log.Infof("Use workflow : %s ", workflowID) log.Infof("Start %d Android instances on Genymotion Cloud SaaS", len(recipesList)) var wg sync.WaitGroup + t := time.Now().UnixNano() for cptInstance := 0; cptInstance < len(recipesList); cptInstance++ { - instanceName := fmt.Sprint("gminstance_bitrise_", buildNumber, "_", cptInstance) + instanceName := fmt.Sprint("bitrise_", workflowID, "_", t, "_", cptInstance) + log.Infof("Start instance : %s on Genymotion Cloud SaaS", instanceName) wg.Add(1) if len(adbSerialPortList) >= 1 { go startInstanceAndConnect(&wg, recipesList[cptInstance], instanceName, adbSerialPortList[cptInstance]) @@ -254,8 +258,7 @@ func main() { wg.Wait() for cptInstance := 0; cptInstance < len(recipesList); cptInstance++ { - - instanceName := fmt.Sprint("gminstance_bitrise_", buildNumber, "_", cptInstance) + instanceName := fmt.Sprint("bitrise_", workflowID, "_", t, "_", cptInstance) instanceUUID, InstanceADBSerialPort := getInstanceDetails(instanceName) instancesList = append(instancesList, instanceUUID)