Detect which type of machine you're building on

#1

Hi,

Is there a way to know if your steps are running on Standard or Elite Machines?
I would like to run some steps only on the elite machines because the standard ones can’t handle it.

Friendly regards,

Seppe

0 Likes

#2

Hi @seppe_r!

Well, the way to do that is checking/knowing whether you have an Elite Organization subscription or not :wink:

As Elite machines are restricted to those kinds of plans.

0 Likes

#3

Well the problem is. We generate bitrise.ymls for 2 orgs one is elite and one isn’t…
But they use the same workflow. And I would like to detect it in the step :slight_smile:

Or maybe I should detect the cpu core count?

0 Likes

#4

I see! We’ve gave this some thought and recommend using the following template:

#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x

# write your script here
brew install jq
json=$(curl -H 'Authorization: '${router}'' "https://api.bitrise.io/v0.1/apps/${BITRISE_APP_SLUG}/builds/${BITRISE_BUILD_SLUG}")
stack=$(echo "${json}" | jq -r '.data | .stack_config_type')

if [[ $stack == *"elite"* ]]; then
  envman add --key ELITE_RUN --value true
else
  envman add --key ELITE_RUN --value false
fi
0 Likes

#5

Ah thanks!

But I should paste my access token in the router? Or secret var?

0 Likes

#6

Would definitely recommend only using the token as a secret!

0 Likes