From fa49a102c9232d70ec03629a45ffe80b5e5aad8b Mon Sep 17 00:00:00 2001 From: Sergiy Markin Date: Fri, 10 Feb 2023 20:36:47 +0000 Subject: [PATCH] [dbutils] Increase timeout for ON_DEMAND_POD This PS is intended to fix intermittent issue on some sites when database backup ondemand job fails to detect ON_DEMAND_POD when it is still creating. Also this PS has fixes related to using focal as base build image. tox.ini also fixed for compatibility with tox4. This PS also uplifts latest stable HTK version and changes openstackutility version to Yoga. Change-Id: I36e55091adf7dc68758fb9b7145cfa34776522d6 --- .../templates/bin/utility/_dbutils.tpl | 2 +- .../templates/bin/utility/_dbutils.tpl | 2 +- .../templates/bin/utility/_dbutils.tpl | 2 +- test-requirements.txt | 6 +++--- tools/deployment/000-install-packages.sh | 4 ++++ tools/gate/playbooks/docker-image-build.yaml | 2 +- .../roles/osh-run-script/defaults/main.yaml | 4 ++-- tools/helm_tk.sh | 2 +- tox.ini | 16 ++++++++++++++-- zuul.d/base.yaml | 4 ++-- 10 files changed, 30 insertions(+), 14 deletions(-) diff --git a/charts/etcdctl-utility/templates/bin/utility/_dbutils.tpl b/charts/etcdctl-utility/templates/bin/utility/_dbutils.tpl index fa83f17c..f4cedbe2 100755 --- a/charts/etcdctl-utility/templates/bin/utility/_dbutils.tpl +++ b/charts/etcdctl-utility/templates/bin/utility/_dbutils.tpl @@ -119,7 +119,7 @@ function ensure_ondemand_pod_exists() { exit 1 fi - sleep 2s + sleep 10s ONDEMAND_POD=$(kubectl get pods -n "$NAMESPACE" --selector=job-name="$ONDEMAND_JOB" -o json | jq -r .items[].metadata.name) if [[ -z "$ONDEMAND_POD" ]]; then echo "ERROR: Failed to obtain the ONDEMAND_POD name." diff --git a/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl b/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl index 7b1d74cb..8a68d479 100755 --- a/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl +++ b/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl @@ -133,7 +133,7 @@ function ensure_ondemand_pod_exists() { exit 1 fi - sleep 2s + sleep 10s ONDEMAND_POD=$(kubectl get pods -n "$NAMESPACE" --selector=job-name="$ONDEMAND_JOB" -o json | jq -r .items[].metadata.name) if [[ -z "$ONDEMAND_POD" ]]; then echo "ERROR: Failed to obtain the ONDEMAND_POD name." diff --git a/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl b/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl index 9a298b08..2e4dcded 100755 --- a/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl +++ b/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl @@ -133,7 +133,7 @@ function ensure_ondemand_pod_exists() { exit 1 fi - sleep 2s + sleep 10s ONDEMAND_POD=$(kubectl get pods -n "$NAMESPACE" --selector=job-name="$ONDEMAND_JOB" -o json | jq -r .items[].metadata.name) if [[ -z "$ONDEMAND_POD" ]]; then echo "ERROR: Failed to obtain the ONDEMAND_POD name." diff --git a/test-requirements.txt b/test-requirements.txt index a3c95da2..5a53670c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,12 +7,12 @@ astroid==2.3.3 bandit==1.5.1 -flake8==3.6.0 -hacking==0.12.0 # Apache-2.0 +flake8==3.7.9 +hacking==3.1.0 # Apache-2.0 coverage==4.5.1 # Apache-2.0 pylint==2.4.4 -python-subunit==1.3.0 # Apache-2.0/BSD +python-subunit==1.4.0 # Apache-2.0/BSD oslotest==3.7.0 # Apache-2.0 stestr==3.1.0 # Apache-2.0 testtools==2.3.0 # MIT diff --git a/tools/deployment/000-install-packages.sh b/tools/deployment/000-install-packages.sh index 19efffd1..43c33ad4 100755 --- a/tools/deployment/000-install-packages.sh +++ b/tools/deployment/000-install-packages.sh @@ -10,3 +10,7 @@ git clone https://opendev.org/openstack/openstack-helm-infra.git git clone https://opendev.org/openstack/openstack-helm.git # Install Packages bash -c "./openstack-helm-infra/tools/deployment/common/000-install-packages.sh" + +sudo apt-get update +sudo apt-get install --no-install-recommends -y \ + lvm2 \ No newline at end of file diff --git a/tools/gate/playbooks/docker-image-build.yaml b/tools/gate/playbooks/docker-image-build.yaml index 5d7044a1..bc00ae2b 100644 --- a/tools/gate/playbooks/docker-image-build.yaml +++ b/tools/gate/playbooks/docker-image-build.yaml @@ -36,7 +36,7 @@ msg: "{{ tags | to_json }}" - name: Determine tags - shell: echo '{{ tags | to_json }}' | python {{ zuul.project.src_dir }}/tools/image_tags.py + shell: echo '{{ tags | to_json }}' | python3 {{ zuul.project.src_dir }}/tools/image_tags.py environment: BRANCH: "{{ zuul.branch | default('') }}" CHANGE: "{{ zuul.change | default('') }}" diff --git a/tools/gate/playbooks/roles/osh-run-script/defaults/main.yaml b/tools/gate/playbooks/roles/osh-run-script/defaults/main.yaml index 17499949..4b472bb8 100644 --- a/tools/gate/playbooks/roles/osh-run-script/defaults/main.yaml +++ b/tools/gate/playbooks/roles/osh-run-script/defaults/main.yaml @@ -11,7 +11,7 @@ # limitations under the License. osh_params: - openstack_release: newton + openstack_release: yoga container_distro_name: ubuntu - container_distro_version: bionic + container_distro_version: focal #feature_gates: diff --git a/tools/helm_tk.sh b/tools/helm_tk.sh index b1536383..0c238f16 100755 --- a/tools/helm_tk.sh +++ b/tools/helm_tk.sh @@ -22,7 +22,7 @@ HELM=${1} HELM_PIDFILE=${2} SERVE_DIR=$(mktemp -d) -HTK_STABLE_COMMIT=${HTK_COMMIT:-"5c4056ad341afcc577e63902b6ddbfb222d757e1"} +HTK_STABLE_COMMIT=${HTK_COMMIT:-"fa8916f5bcc8cbf064a387569e2630b7bbf0b49b"} ${HELM} init --client-only --skip-refresh --stable-repo-url "https://charts.helm.sh/stable" diff --git a/tox.ini b/tox.ini index 3e165e5f..d6e71a48 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.4 -envlist = dev,pep8,py36,bandit,docs,list-tests +envlist = dev,pep8,py38,bandit,docs,list-tests skipsdist = true [testenv:dev] @@ -40,7 +40,7 @@ commands = bandit -r {toxinidir} [testenv:docs] -whitelist_externals = rm +allowlist_externals = rm deps = -r{toxinidir}/docs/requirements.txt commands = @@ -54,3 +54,15 @@ commands = yapf -rd {toxinidir} {toxinidir}/tests flake8 {toxinidir} bandit -r {toxinidir} + +[flake8] +# [H106] Don't put vim configuration in source files. +# [H203] Use assertIs(Not)None to check for None. +# [H204] Use assert(Not)Equal to check for equality. +# [H205] Use assert(Greater|Less)(Equal) for comparison. +# [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls +# [H904] Delay string interpolations at logging calls. +enable-extensions = H106,H203,H204,H205,H210 +# [E731] Do not assign a lambda expression, use a def. This reduces readability in some cases. +ignore = E126,E731,F405,H102,H301,H306,H401,H404,H405,H904,W503,W504 +exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes,doc,alembic/versions diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml index ebf09622..422c3140 100644 --- a/zuul.d/base.yaml +++ b/zuul.d/base.yaml @@ -67,7 +67,7 @@ timeout: 1800 post-timeout: 1800 run: tools/gate/playbooks/docker-image-build.yaml - nodeset: airship-porthole-single-node + nodeset: airship-porthole-focal-single-node vars: publish: false tags: @@ -83,7 +83,7 @@ Lints files for trailing whitespace run: tools/gate/playbooks/zuul-linter.yaml timeout: 300 - nodeset: airship-porthole-single-node + nodeset: airship-porthole-focal-single-node - job: