Merge "Add swarm-cookied-model-generator to JJB PROD-36999"
diff --git a/jobs/pipelines/gate-tcp-qa.groovy b/jobs/pipelines/gate-tcp-qa.groovy
new file mode 100644
index 0000000..9f62e8f
--- /dev/null
+++ b/jobs/pipelines/gate-tcp-qa.groovy
@@ -0,0 +1,41 @@
+node('sre-team-infra') {
+ timestamps() {
+ ansiColor('xterm') {
+ tmp_jenkins_config = '/dev/shm/sre-jenkins-job-builder.ini'
+ stage('Checkout') {
+ checkout scm
+ }
+ stage('Codenarc') {
+ try {
+ sh '''#!/bin/bash -ex
+ docker run --rm \
+ -t --user "\$(id -u):\$(id -g)" \
+ -w \$PWD -v ${WORKSPACE}:/shared \
+ docker-prod-local.docker.mirantis.net/infra/codenarc:latest \
+ -rulesetfiles="rulesets/basic.xml" \
+ -maxPriority1Violations=0 \
+ -maxPriority2Violations=0 \
+ -maxPriority3Violations=0 \
+ -report=console \
+ -report=html:/shared/report.html 2>&1 \
+ | tee report.log
+ if [ "${PIPESTATUS[0]}" != '0' ]; then
+ exit 1
+ fi
+ '''
+ }
+ finally {
+ archiveArtifacts \
+ artifacts: "**/report.html",
+ allowEmptyArchive: false
+ }
+ }
+ stage ("Test python with pep8"){
+ sh """
+ set -e
+ tox
+ """
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/jobs/project.yaml b/jobs/project.yaml
index 60bd0b0..d98278f 100644
--- a/jobs/project.yaml
+++ b/jobs/project.yaml
@@ -57,6 +57,7 @@
- self-deploy-virtualenvs
- cleanup-jenkins-agents
- tcp-qa-ci
+ - tcp-qa-gerrit
# - testrail-reporter-ci - can't moved to JJB, unsupported parameters
# - testrail-reporter-gerrit-mcp-ci - can't moved to JJB, unsupported parameters
- release-artifact-checker
diff --git a/jobs/templates/tcp-qa-gerrit.yml b/jobs/templates/tcp-qa-gerrit.yml
new file mode 100644
index 0000000..6432cdb
--- /dev/null
+++ b/jobs/templates/tcp-qa-gerrit.yml
@@ -0,0 +1,39 @@
+- job-template:
+ project-type: pipeline
+ description: '{job-description}'
+ concurrent: true
+ disabled: false
+ name: tcp-qa-gerrit
+ parameters:
+ - string:
+ default: ''
+ description: |-
+ Example: refs/changes/89/411189/36
+ (for now - only one reference allowed)
+ name: GERRIT_REFSPEC
+ trim: 'false'
+ triggers:
+ - gerrit:
+ server-name: 'mcp-ci-gerrit'
+ projects:
+ - project-compare-type: PLAIN
+ project-pattern: mcp/tcp-qa
+ branches:
+ - branch-pattern: 'master'
+ - comment-added-contains-event:
+ comment-contains-value: '(recheck|reverify|retest)'
+ pipeline-scm:
+ lightweight-checkout: false
+ scm:
+ - git:
+ branches:
+ - FETCH_HEAD
+ refspec: ${{GERRIT_REFSPEC}}
+ url: https://gerrit.mcp.mirantis.com/mcp/tcp-qa
+ script-path: jobs/pipelines/gate-tcp-qa.groovy
+ logrotate:
+ daysToKeep: 30
+ publishers:
+ - archive:
+ artifacts: 'build/report.html'
+ allow-empty: 'true'
\ No newline at end of file
diff --git a/jobs/view.yaml b/jobs/view.yaml
index 307c4c6..32ed948 100644
--- a/jobs/view.yaml
+++ b/jobs/view.yaml
@@ -156,6 +156,7 @@
- diff_params_reclass_system
- environment-template-ci
- tcp-qa-ci
+ - tcp-qa-gerrit
- test_cleanup
- testrail-reporter-ci
- testrail-reporter-gerrit-mcp-ci
diff --git a/tcp_tests/helpers/containers.py b/tcp_tests/helpers/containers.py
index 7d1306a..f7f78af 100644
--- a/tcp_tests/helpers/containers.py
+++ b/tcp_tests/helpers/containers.py
@@ -148,7 +148,7 @@
"failed: {1}.").format(self.image_name, result)
result = self.remote.execute(check_alias_cmd)
assert result['exit_code'] == 0, \
- ("Alias creation for running {} from container "
+ ("Alias creation for running {0} from container "
"failed: {1}.").format(self.image_name, result)
def setup(self):
diff --git a/tcp_tests/helpers/env_config.py b/tcp_tests/helpers/env_config.py
index b811030..ef07866 100644
--- a/tcp_tests/helpers/env_config.py
+++ b/tcp_tests/helpers/env_config.py
@@ -223,7 +223,7 @@
elif i_count > 0 and not isinstance(data[key], list):
raise TypeError(
("Key '{0}' by '{1}' keypath expected as list "
- "but '{3}' obj found").format(
+ "but '{2}' obj found").format(
key, keypath(walked_paths), type(data[key]).__name__
)
)
diff --git a/tcp_tests/managers/jenkins/client.py b/tcp_tests/managers/jenkins/client.py
index eb67074..20b070e 100644
--- a/tcp_tests/managers/jenkins/client.py
+++ b/tcp_tests/managers/jenkins/client.py
@@ -278,7 +278,7 @@
req = send_request(
'GET',
self.__client._build_url(PROGRESSIVE_CONSOLE_OUTPUT, locals()))
- return(self.__client.jenkins_request(req))
+ return (self.__client.jenkins_request(req))
@retry(max_count=12)
def get_workflow(self, name, build_id, enode=None, mode='describe'):
diff --git a/tcp_tests/managers/k8smanager.py b/tcp_tests/managers/k8smanager.py
index 5f5f4e8..c3922db 100644
--- a/tcp_tests/managers/k8smanager.py
+++ b/tcp_tests/managers/k8smanager.py
@@ -69,7 +69,7 @@
"expected one!").format(k8s_hosts)
k8s_host = k8s_hosts.pop()
assert k8s_host in k8s_proxy_ip, (
- "Kubernetes API host:{0} not found in proxies:{} "
+ "Kubernetes API host:{0} not found in proxies:{1} "
"on k8s master nodes. K8s proxies are expected on "
"nodes with K8s master").format(k8s_host, k8s_proxy_ip)
return k8s_host
diff --git a/tcp_tests/managers/openstack_manager.py b/tcp_tests/managers/openstack_manager.py
index b0232ca..07810ba 100644
--- a/tcp_tests/managers/openstack_manager.py
+++ b/tcp_tests/managers/openstack_manager.py
@@ -138,8 +138,8 @@
"-e SOURCE_FILE=keystonercv3 "
"-v /root/:/home/rally "
"-v /var/log/:/home/rally/rally_reports/ "
- "-v /etc/ssl/certs/:/etc/ssl/certs/ {2} >> image.output"
- .format(conf_name, pattern, registry))
+ "-v /etc/ssl/certs/:/etc/ssl/certs/ {1} >> image.output"
+ .format(conf_name, registry))
LOG.info("Running tempest testing on node {0} using the following "
"command:\n{1}".format(target_name, cmd))
diff --git a/tcp_tests/managers/rallymanager.py b/tcp_tests/managers/rallymanager.py
index 589e1ee..959ade0 100644
--- a/tcp_tests/managers/rallymanager.py
+++ b/tcp_tests/managers/rallymanager.py
@@ -255,7 +255,7 @@
report_prefix,
datetime.datetime.now().strftime('%Y%m%d_%H%M%S'))
else:
- report_filename = 'report_{1}'.format(
+ report_filename = 'report_{}'.format(
datetime.datetime.now().strftime('%Y%m%d_%H%M%S'))
docker_file_prefix = '/home/rally/.rally/' + report_filename
diff --git a/tcp_tests/managers/reclass_manager.py b/tcp_tests/managers/reclass_manager.py
index c7ec298..9b8a824 100644
--- a/tcp_tests/managers/reclass_manager.py
+++ b/tcp_tests/managers/reclass_manager.py
@@ -135,7 +135,6 @@
"{reclass_tools} get-key classes \
/srv/salt/reclass/classes/{path}".format(
reclass_tools=self.reclass_tools_cmd,
- value=value,
path=short_path
)):
LOG.warning("Class {} already exists in {}".format(
@@ -230,7 +229,6 @@
self.ssh.check_call(
"cat {yaml} > \
/srv/salt/reclass/classes/{path}".format(
- reclass_tools=self.reclass_tools_cmd,
yaml=tmp_file,
path=short_path
))
diff --git a/tcp_tests/tests/system/test_backup_restore.py b/tcp_tests/tests/system/test_backup_restore.py
index 47aff19..8608cfd 100644
--- a/tcp_tests/tests/system/test_backup_restore.py
+++ b/tcp_tests/tests/system/test_backup_restore.py
@@ -212,7 +212,7 @@
result = salt_actions.local(
sm, "pkg.info_installed", postgresql_pkg)['return'][0]
installed_ver = result[sm][postgresql_pkg].get('version')
- if not(installed_ver and postgresql_pkg_ver in installed_ver):
+ if not (installed_ver and postgresql_pkg_ver in installed_ver):
pkg = "{pkg},{pkg}-{ver}".format(
pkg=postgresql_pkg, ver=postgresql_pkg_ver)
salt_actions.local(sm, "pkg.install", pkg)
diff --git a/tcp_tests/tests/system/test_mcp_update.py b/tcp_tests/tests/system/test_mcp_update.py
index fba6cb6..c01c80f 100644
--- a/tcp_tests/tests/system/test_mcp_update.py
+++ b/tcp_tests/tests/system/test_mcp_update.py
@@ -297,7 +297,7 @@
job_name = 'pre-upgrade-verify'
job_parameters = {}
- if(dt.check_job_exists_on_jenkins(job_name)):
+ if (dt.check_job_exists_on_jenkins(job_name)):
LOG.info("Pre-upgrade verify job exists on Jenkins!")
job_result, job_description = dt.start_job_on_jenkins(
job_name=job_name,
diff --git a/tcp_tests/tests/system/test_offline.py b/tcp_tests/tests/system/test_offline.py
index 34c729a..0b0d6a5 100644
--- a/tcp_tests/tests/system/test_offline.py
+++ b/tcp_tests/tests/system/test_offline.py
@@ -73,9 +73,12 @@
end=admin_net[253],
net=admin_net))
underlay.check_call(node_name=cfg_node, verbose=verbose,
- cmd="maas mirantis vlan update "
- "$(maas mirantis subnets read | jq '.[] | select(.name==\"{net}\") | .vlan.fabric_id') " # noqa
- "0 dhcp_on=True primary_rack='cfg01'".format(net=admin_net))
+ cmd="maas mirantis vlan update "
+ "$(maas mirantis subnets read | jq '.[] | "
+ "select(.name==\"{net}\") | .vlan.fabric_id') " # noqa
+ "0 dhcp_on=True "
+ "primary_rack='cfg01'".format(
+ net=admin_net))
underlay.check_call(
node_name=cfg_node, verbose=verbose,