Skip to content

Commit 084a106

Browse files
committed
run shfmt
1 parent f4f9a84 commit 084a106

File tree

1 file changed

+67
-67
lines changed

1 file changed

+67
-67
lines changed

e2e-tests/functions

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -85,39 +85,39 @@ deploy_operator() {
8585
}
8686

8787
upgrade_operator_image() {
88-
local image=$1
88+
local image=$1
8989

90-
kubectl -n ${OPERATOR_NS:-$NAMESPACE} set image deployment/percona-server-mysql-operator manager=${image}
90+
kubectl -n ${OPERATOR_NS:-$NAMESPACE} set image deployment/percona-server-mysql-operator manager=${image}
9191
}
9292

9393
deploy_operator_gh() {
94-
local git_tag=$1
94+
local git_tag=$1
9595

96-
echo "applying ${git_tag}/deploy/crd.yaml"
97-
kubectl apply \
98-
--server-side \
99-
--force-conflicts \
100-
-f "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/crd.yaml"
96+
echo "applying ${git_tag}/deploy/crd.yaml"
97+
kubectl apply \
98+
--server-side \
99+
--force-conflicts \
100+
-f "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/crd.yaml"
101101

102-
local rbac="rbac"
103-
local operator="operator"
104-
if [ -n "${OPERATOR_NS}" ]; then
105-
rbac="cw-rbac"
106-
operator="cw-operator"
102+
local rbac="rbac"
103+
local operator="operator"
104+
if [ -n "${OPERATOR_NS}" ]; then
105+
rbac="cw-rbac"
106+
operator="cw-operator"
107107

108-
create_namespace "${OPERATOR_NS}"
109-
fi
108+
create_namespace "${OPERATOR_NS}"
109+
fi
110110

111-
echo "applying ${git_tag}/deploy/${rbac}.yaml"
111+
echo "applying ${git_tag}/deploy/${rbac}.yaml"
112112
kubectl apply \
113-
-n "${OPERATOR_NS:-$NAMESPACE}" \
114-
-f "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/${rbac}.yaml"
113+
-n "${OPERATOR_NS:-$NAMESPACE}" \
114+
-f "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/${rbac}.yaml"
115115

116-
echo "applying ${git_tag}/deploy/${operator}.yaml"
117-
curl -s "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/${operator}.yaml" \
118-
| yq eval '(select(documentIndex==1).spec.template.spec.containers[] | select(.name=="manager").env[] | select(.name=="DISABLE_TELEMETRY").value) = "true"' \
119-
| yq eval '(select(documentIndex==1).spec.template.spec.containers[] | select(.name=="manager").env[] | select(.name=="LOG_LEVEL").value) = "DEBUG"' \
120-
| kubectl -n "${OPERATOR_NS:-$NAMESPACE}" apply -f -
116+
echo "applying ${git_tag}/deploy/${operator}.yaml"
117+
curl -s "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/${operator}.yaml" \
118+
| yq eval '(select(documentIndex==1).spec.template.spec.containers[] | select(.name=="manager").env[] | select(.name=="DISABLE_TELEMETRY").value) = "true"' \
119+
| yq eval '(select(documentIndex==1).spec.template.spec.containers[] | select(.name=="manager").env[] | select(.name=="LOG_LEVEL").value) = "DEBUG"' \
120+
| kubectl -n "${OPERATOR_NS:-$NAMESPACE}" apply -f -
121121
}
122122

123123
destroy_operator() {
@@ -369,20 +369,20 @@ get_operator_pod() {
369369
}
370370

371371
get_operator_image() {
372-
kubectl get pods -n "${OPERATOR_NS:-$NAMESPACE}" \
373-
--selector=app.kubernetes.io/name=percona-server-mysql-operator \
374-
-o 'jsonpath={.items[].spec.containers[].image}'
372+
kubectl get pods -n "${OPERATOR_NS:-$NAMESPACE}" \
373+
--selector=app.kubernetes.io/name=percona-server-mysql-operator \
374+
-o 'jsonpath={.items[].spec.containers[].image}'
375375
}
376376

377377
get_cr() {
378378
local name_suffix=$1
379-
local image_mysql=${2:-${IMAGE_MYSQL}}
380-
local image_backup=${3:-${IMAGE_BACKUP}}
381-
local image_orchestrator=${4:-${IMAGE_ORCHESTRATOR}}
382-
local image_router=${5:-${IMAGE_ROUTER}}
383-
local image_toolkit=${6:-${IMAGE_TOOLKIT}}
384-
local image_haproxy=${7:-${IMAGE_HAPROXY}}
385-
local image_pmm_client=${8:-${IMAGE_PMM_CLIENT}}
379+
local image_mysql=${2:-${IMAGE_MYSQL}}
380+
local image_backup=${3:-${IMAGE_BACKUP}}
381+
local image_orchestrator=${4:-${IMAGE_ORCHESTRATOR}}
382+
local image_router=${5:-${IMAGE_ROUTER}}
383+
local image_toolkit=${6:-${IMAGE_TOOLKIT}}
384+
local image_haproxy=${7:-${IMAGE_HAPROXY}}
385+
local image_pmm_client=${8:-${IMAGE_PMM_CLIENT}}
386386

387387
yq eval "$(printf '.metadata.name="%s"' "${test_name}${name_suffix:+-$name_suffix}")" "${DEPLOY_DIR}/cr.yaml" \
388388
| yq eval "$(printf '.spec.initImage="%s"' "${IMAGE}")" - \
@@ -407,13 +407,13 @@ get_cr() {
407407
}
408408

409409
get_cr_gh() {
410-
local name_suffix=$1
410+
local name_suffix=$1
411411

412-
curl -s "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/cr.yaml" \
413-
| yq eval "$(printf '.metadata.name="%s"' "${test_name}${name_suffix:+-$name_suffix}")" - \
414-
| yq eval '.spec.secretsName="test-secrets"' - \
415-
| yq eval '.spec.sslSecretName="test-ssl"' - \
416-
| yq eval '.spec.upgradeOptions.apply="disabled"' -
412+
curl -s "https://raw.githubusercontent.com/percona/percona-server-mysql-operator/${git_tag}/deploy/cr.yaml" \
413+
| yq eval "$(printf '.metadata.name="%s"' "${test_name}${name_suffix:+-$name_suffix}")" - \
414+
| yq eval '.spec.secretsName="test-secrets"' - \
415+
| yq eval '.spec.sslSecretName="test-ssl"' - \
416+
| yq eval '.spec.upgradeOptions.apply="disabled"' -
417417
}
418418

419419
get_client_pod() {
@@ -1205,41 +1205,41 @@ check_scheduled_backup_labels() {
12051205
fi
12061206

12071207
latest_operator_version_in_vs() {
1208-
local latest=$(curl -s https://check.percona.com/versions/v1/ps-operator | jq -r '.versions[].operator' | sort -V | tail -n1)
1208+
local latest=$(curl -s https://check.percona.com/versions/v1/ps-operator | jq -r '.versions[].operator' | sort -V | tail -n1)
12091209

1210-
# if testing on release branch and version service is already updated with new operator images
1211-
# use the older version of operator as initial point for test
1212-
if [[ ${latest} == "${OPERATOR_VERSION}" ]]; then
1213-
latest=$(curl -s https://check.percona.com/versions/v1/ps-operator | jq -r '.versions[].operator' | sort -V | tail -n2 | head -n1)
1214-
fi
1210+
# if testing on release branch and version service is already updated with new operator images
1211+
# use the older version of operator as initial point for test
1212+
if [[ ${latest} == "${OPERATOR_VERSION}" ]]; then
1213+
latest=$(curl -s https://check.percona.com/versions/v1/ps-operator | jq -r '.versions[].operator' | sort -V | tail -n2 | head -n1)
1214+
fi
12151215

1216-
echo ${latest}
1216+
echo ${latest}
12171217
}
12181218

12191219
latest_operator_image_in_vs() {
1220-
local version=$(latest_operator_version_in_vs)
1220+
local version=$(latest_operator_version_in_vs)
12211221

1222-
curl -s https://check.percona.com/versions/v1/ps-operator/${version}/latest | jq -r '.versions[].matrix.operator[].imagePath'
1222+
curl -s https://check.percona.com/versions/v1/ps-operator/${version}/latest | jq -r '.versions[].matrix.operator[].imagePath'
12231223
}
12241224

12251225
get_cr_with_latest_versions_in_vs() {
1226-
local version=$(latest_operator_version_in_vs)
1227-
local latest_versions=$(curl -s https://check.percona.com/versions/v1/ps-operator/${version}/latest)
1228-
1229-
local image_mysql=$(echo ${latest_versions} | jq -r '.versions[].matrix.mysql[].imagePath')
1230-
local image_backup=$(echo ${latest_versions} | jq -r '.versions[].matrix.backup[].imagePath')
1231-
local image_orchestrator=$(echo ${latest_versions} | jq -r '.versions[].matrix.orchestrator[].imagePath')
1232-
local image_router=$(echo ${latest_versions} | jq -r '.versions[].matrix.orchestrator[].imagePath')
1233-
local image_toolkit=$(echo ${latest_versions} | jq -r '.versions[].matrix.toolkit[].imagePath')
1234-
local image_haproxy=$(echo ${latest_versions} | jq -r '.versions[].matrix.haproxy[].imagePath')
1235-
local image_pmm_client=$(echo ${latest_versions} | jq -r '.versions[].matrix.pmm[].imagePath')
1236-
1237-
get_cr "" \
1238-
${image_mysql} \
1239-
${image_backup} \
1240-
${image_orchestrator} \
1241-
${image_router} \
1242-
${image_toolkit} \
1243-
${image_haproxy} \
1244-
${image_pmm_client}
1226+
local version=$(latest_operator_version_in_vs)
1227+
local latest_versions=$(curl -s https://check.percona.com/versions/v1/ps-operator/${version}/latest)
1228+
1229+
local image_mysql=$(echo ${latest_versions} | jq -r '.versions[].matrix.mysql[].imagePath')
1230+
local image_backup=$(echo ${latest_versions} | jq -r '.versions[].matrix.backup[].imagePath')
1231+
local image_orchestrator=$(echo ${latest_versions} | jq -r '.versions[].matrix.orchestrator[].imagePath')
1232+
local image_router=$(echo ${latest_versions} | jq -r '.versions[].matrix.orchestrator[].imagePath')
1233+
local image_toolkit=$(echo ${latest_versions} | jq -r '.versions[].matrix.toolkit[].imagePath')
1234+
local image_haproxy=$(echo ${latest_versions} | jq -r '.versions[].matrix.haproxy[].imagePath')
1235+
local image_pmm_client=$(echo ${latest_versions} | jq -r '.versions[].matrix.pmm[].imagePath')
1236+
1237+
get_cr "" \
1238+
${image_mysql} \
1239+
${image_backup} \
1240+
${image_orchestrator} \
1241+
${image_router} \
1242+
${image_toolkit} \
1243+
${image_haproxy} \
1244+
${image_pmm_client}
12451245
}

0 commit comments

Comments
 (0)