Skip to content

Commit 36e8a38

Browse files
Merge pull request #18 from Genymobile/dev/unique-device-name
Use Timestamp in device name to be unique
2 parents 975a2f7 + 78d73c5 commit 36e8a38

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os/exec"
88
"strings"
99
"sync"
10+
"time"
1011

1112
"github.com/bitrise-io/go-steputils/stepconf"
1213
"github.com/bitrise-io/go-steputils/tools"
@@ -238,12 +239,15 @@ func main() {
238239
adbSerialPortList = strings.Split(c.GMCloudSaaSAdbSerialPort, ",")
239240
}
240241

241-
buildNumber := os.Getenv("BITRISE_BUILD_NUMBER")
242+
workflowID := os.Getenv("BITRISE_TRIGGERED_WORKFLOW_ID")
243+
log.Infof("Use workflow : %s ", workflowID)
242244

243245
log.Infof("Start %d Android instances on Genymotion Cloud SaaS", len(recipesList))
244246
var wg sync.WaitGroup
247+
t := time.Now().UnixNano()
245248
for cptInstance := 0; cptInstance < len(recipesList); cptInstance++ {
246-
instanceName := fmt.Sprint("gminstance_bitrise_", buildNumber, "_", cptInstance)
249+
instanceName := fmt.Sprint("bitrise_", workflowID, "_", t, "_", cptInstance)
250+
log.Infof("Start instance : %s on Genymotion Cloud SaaS", instanceName)
247251
wg.Add(1)
248252
if len(adbSerialPortList) >= 1 {
249253
go startInstanceAndConnect(&wg, recipesList[cptInstance], instanceName, adbSerialPortList[cptInstance])
@@ -254,8 +258,7 @@ func main() {
254258
wg.Wait()
255259

256260
for cptInstance := 0; cptInstance < len(recipesList); cptInstance++ {
257-
258-
instanceName := fmt.Sprint("gminstance_bitrise_", buildNumber, "_", cptInstance)
261+
instanceName := fmt.Sprint("bitrise_", workflowID, "_", t, "_", cptInstance)
259262
instanceUUID, InstanceADBSerialPort := getInstanceDetails(instanceName)
260263

261264
instancesList = append(instancesList, instanceUUID)

0 commit comments

Comments
 (0)