Skip to content

Commit 5508e49

Browse files
author
Ryan Hitchman
committed
Use bash ranges "{1..3}" instead of "$(seq 1 3)".
1 parent 364f2da commit 5508e49

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

cluster/aws/util.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,7 @@ function ssh-to-node {
15471547

15481548
local ip=$(get_ssh_hostname ${node})
15491549

1550-
for try in $(seq 1 5); do
1550+
for try in {1..5}; do
15511551
if ssh -oLogLevel=quiet -oConnectTimeout=30 -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "echo test > /dev/null"; then
15521552
break
15531553
fi

cluster/gce/util.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ function ssh-to-node {
15331533
local node="$1"
15341534
local cmd="$2"
15351535
# Loop until we can successfully ssh into the box
1536-
for try in $(seq 1 5); do
1536+
for try in {1..5}; do
15371537
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
15381538
break
15391539
fi

cluster/gke/util.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function ssh-to-node() {
339339
local node="$1"
340340
local cmd="$2"
341341
# Loop until we can successfully ssh into the box
342-
for try in $(seq 1 5); do
342+
for try in {1..5}; do
343343
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
344344
break
345345
fi

cluster/photon-controller/util.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ function pc-create-vm {
284284

285285
# Wait for the VM to be started and connected to the network
286286
have_network=0
287-
for i in $(seq 120); do
287+
for i in {1..120}; do
288288
# photon -n vm networks print several fields:
289289
# NETWORK MAC IP GATEWAY CONNECTED?
290290
# We wait until CONNECTED is True

examples/k8petstore/k8petstore-loadbalancer.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ $kubectl create -f bps-load-gen-rc.json --namespace=$NS
230230
#This script assumes the cloud provider is able to create a load balancer. If this not the case, you may want to check out other ways to make the frontend service accessible from outside (https://github.com/kubernetes/kubernetes/blob/master/docs/services.md#external-services)
231231
function getIP {
232232
echo "Waiting up to 1 min for a public IP to be assigned by the cloud provider..."
233-
for i in `seq 1 20`;
233+
for i in {1..20};
234234
do
235235
PUBLIC_IP=$($kubectl get services/frontend --namespace=$NS -o template --template="{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}")
236236
if [ -n "$PUBLIC_IP" ]; then
@@ -249,7 +249,7 @@ function pollfor {
249249
pass_http=0
250250

251251
### Test HTTP Server comes up.
252-
for i in `seq 1 150`;
252+
for i in {1..150};
253253
do
254254
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
255255
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "

examples/k8petstore/k8petstore-nodeport.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function pollfor {
267267
pass_http=0
268268

269269
### Test HTTP Server comes up.
270-
for i in `seq 1 150`;
270+
for i in {1..150};
271271
do
272272
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
273273
echo "Trying curl frontend:3000 via $TEST_IP:$NODE_PORT, attempt ${i}. Expect a few failures while pulling images... "

examples/k8petstore/k8petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function pollfor {
233233
pass_http=0
234234

235235
### Test HTTP Server comes up.
236-
for i in `seq 1 150`;
236+
for i in {1..150};
237237
do
238238
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
239239
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "

hack/jenkins/e2e-runner.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ fi
236236
if [[ -n "${CLOUDSDK_BUCKET:-}" ]]; then
237237
# Retry the download a few times to mitigate transient server errors and
238238
# race conditions where the bucket contents change under us as we download.
239-
for n in $(seq 3); do
239+
for n in {1..3}; do
240240
gsutil -mq cp -r "${CLOUDSDK_BUCKET}" ~ && break || sleep 1
241241
# Delete any temporary files from the download so that we start from
242242
# scratch when we retry.

hack/jenkins/upload-to-gcs.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function upload_version() {
8686
fi
8787

8888
local -r json_file="${gcs_build_path}/started.json"
89-
for upload_attempt in $(seq 3); do
89+
for upload_attempt in {1..3}; do
9090
echo "Uploading version to: ${json_file} (attempt ${upload_attempt})"
9191
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(
9292
echo "{"
@@ -103,7 +103,7 @@ function upload_artifacts_and_build_result() {
103103
local -r build_result=$1
104104
echo -n 'Run finished at '; date -d "@${timestamp}"
105105

106-
for upload_attempt in $(seq 3); do
106+
for upload_attempt in {1..3}; do
107107
echo "Uploading to ${gcs_build_path} (attempt ${upload_attempt})"
108108
echo "Uploading build result: ${build_result}"
109109
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(

hack/make-rules/test-cmd.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function kubectl-with-retry()
110110
{
111111
ERROR_FILE="${KUBE_TEMP}/kubectl-error"
112112
preserve_err_file=${PRESERVE_ERR_FILE-false}
113-
for count in $(seq 0 3); do
113+
for count in {0..3}; do
114114
kubectl "$@" 2> ${ERROR_FILE} || true
115115
if grep -q "the object has been modified" "${ERROR_FILE}"; then
116116
kube::log::status "retry $1, error: $(cat ${ERROR_FILE})"
@@ -694,7 +694,7 @@ runTests() {
694694
## If the resourceVersion is the same as the one stored in the server, the patch will be applied.
695695
# Command
696696
# Needs to retry because other party may change the resource.
697-
for count in $(seq 0 3); do
697+
for count in {0..3}; do
698698
resourceVersion=$(kubectl get "${kube_flags[@]}" pod valid-pod -o go-template='{{ .metadata.resourceVersion }}')
699699
kubectl patch "${kube_flags[@]}" pod valid-pod -p='{"spec":{"containers":[{"name": "kubernetes-serve-hostname", "image": "nginx"}]},"metadata":{"resourceVersion":"'$resourceVersion'"}}' 2> "${ERROR_FILE}" || true
700700
if grep -q "the object has been modified" "${ERROR_FILE}"; then

0 commit comments

Comments
 (0)