@@ -113,9 +113,14 @@ create_uesr_data () {
113
113
# ENCODED_USER_DATA=$(echo "$USER_DATA" | base64 | tr -d \\n)
114
114
cat << EOF > user_data.sh
115
115
#!/bin/bash
116
+ export RUNNER_LABEL="${INSTANCE_TYPE} "
116
117
if command -v yum &> /dev/null; then
118
+ # add rhel to the label
119
+ export RUNNER_LABEL="rhel,${INSTANCE_TYPE} "
117
120
yum install -y curl jq libicu
118
121
else
122
+ # add ubuntu to the label
123
+ export RUNNER_LABEL="ubuntu,${INSTANCE_TYPE} "
119
124
apt-get update
120
125
apt-get install -y curl jq
121
126
fi
@@ -135,7 +140,7 @@ tar xzf ./actions-runner-linux-x64-2.311.0.tar.gz
135
140
# Create the runner and start the configuration experience
136
141
# there is a bug in the github instruction. The config script does not work with sudo unless we set RUNNER_ALLOW_RUNASROOT=true
137
142
export RUNNER_ALLOW_RUNASROOT=true
138
- ./config.sh --replace --unattended --name ${RUNNER_NAME} --url "https://github.com/${GITHUB_REPO} " --token ${RUNNER_TOKEN}
143
+ ./config.sh --replace --unattended --name ${RUNNER_NAME} --url "https://github.com/${GITHUB_REPO} " --token ${RUNNER_TOKEN} --labels " \$ {RUNNER_LABEL}"
139
144
# Last step, run it!
140
145
./run.sh
141
146
EOF
@@ -216,9 +221,9 @@ create_runner () {
216
221
# then we extract the minimum required price and use that as the new bid price
217
222
if [[ " $INSTANCE_JSON " == * " SpotMaxPriceTooLow" * ]]; then
218
223
debug " SpotMaxPriceTooLow error, extracting minimum required price"
219
- MIN_PRICE=$( echo -n " $INSTANCE_JSON " | awk ' {print $NF}' | head -c -2)
224
+ MIN_PRICE=$( echo -n " $INSTANCE_JSON " | awk ' {print $NF}' | head -c -2 | tr -d ' \r ' )
220
225
debug " Minimum required price: ${MIN_PRICE} "
221
- # BID_PRICE=$(echo "$MIN_PRICE * 1.1 " | bc)
226
+ BID_PRICE=$( echo " $MIN_PRICE * 1.01 " | bc)
222
227
BID_PRICE=$MIN_PRICE
223
228
continue
224
229
else
0 commit comments