Skip to content

Commit

Permalink
Use Timepstamp in device name to be unique
Browse files Browse the repository at this point in the history
  • Loading branch information
thomascarpentier committed Jun 21, 2024
1 parent 975a2f7 commit 78d73c5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os/exec"
"strings"
"sync"
"time"

"github.com/bitrise-io/go-steputils/stepconf"
"github.com/bitrise-io/go-steputils/tools"
Expand Down Expand Up @@ -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])
Expand All @@ -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)
Expand Down

0 comments on commit 78d73c5

Please sign in to comment.