PROD-36999 Fix and to JJB the generate-report job
Change-Id: Ibe0bdbaa7d06354195b2ef30a416d590ccd2ad2a
diff --git a/jobs/pipelines/generate-report.sh b/jobs/pipelines/generate-report.sh
new file mode 100644
index 0000000..68fefbb
--- /dev/null
+++ b/jobs/pipelines/generate-report.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+. ${CUSTOM_REPO_VENV_PATH}/bin/activate
+
+set -x
+set -e
+
+if [ -z "${DATE}" ]; then
+ d=$(date +%Y-%m-%d)
+ export DATE_REPORT="$(date +%Y-%m-%d)"
+else
+ export DATE_REPORT=${DATE}
+fi
+
+export TESTRAIL_URL="https://mirantis.testrail.com"
+#export TESTRAIL_USER_EMAIL="drivetrain-eng@mirantis.com"
+#export TESTRAIL_USER_KEY=""
+export TESTRAIL_PROJECT='Mirantis Cloud Platform'
+#export JIRA_USER="mcp-qa-bot@mirantis.com"
+#echo $JIRA_PWD
+######### Run Report Generator ##########
+
+for day in $DATE_REPORT; do
+
+if [ -z "${PLAN_NAME}" ]; then
+ export TESTRAIL_PLAN="[2019.2.0-update]System-${REPOSITORY_SUITE}-"${day}
+else
+ export TESTRAIL_PLAN=${PLAN_NAME}
+ echo ${PLAN_NAME}
+fi
+
+. ${VENV_PATH}/bin/activate
+
+python tcp_tests/report.py create-report \
+ --testrail-host "$TESTRAIL_URL" \
+ --testrail-user "$TESTRAIL_USER_EMAIL" \
+ --testrail-user-key "$TESTRAIL_USER_KEY" \
+ --testrail-plan $TESTRAIL_PLAN \
+ --testrail-project "$TESTRAIL_PROJECT" \
+ --out-type html \
+ --push-to-testrail \
+ --sort-by fails \
+ --jira-host https://mirantis.jira.com/ \
+ --jira-user $JIRA_USER \
+ --jira-password $JIRA_PWD > ${day}_system_bug_report_$(date +%Y%m%d%H%M%S).html && ret=0 || ret=1
+
+echo "Report for ${TESTRAIL_PLAN} finished with ${ret}"
+
+#export TESTRAIL_PLAN="[MCP1.1]BVT-"${day}
+
+#python tcp-qa/tcp_tests/report.py create-report \
+# --testrail-host "$TESTRAIL_URL" \
+# --testrail-user "$TESTRAIL_USER_EMAIL" \
+# --testrail-user-key "$TESTRAIL_USER_KEY" \
+# --testrail-plan $TESTRAIL_PLAN \
+# --testrail-project "$TESTRAIL_PROJECT" \
+# --out-type html \
+# --push-to-testrail \
+# --sort-by fails \
+# --jira-host https://mirantis.jira.com/ \
+# --jira-user $JIRA_USER \
+# --jira-password $JIRA_PWD > ${day}_bvt_bug_report_$(date +%Y%m%d%H%M%S).html && ret=0 || ret=1
+
+#echo "Report for ${TESTRAIL_PLAN} finished with ${ret}"
+
+done
\ No newline at end of file
diff --git a/jobs/project.yaml b/jobs/project.yaml
index d98278f..600ca3d 100644
--- a/jobs/project.yaml
+++ b/jobs/project.yaml
@@ -49,7 +49,7 @@
- swarm-deploy-platform
- swarm-cookied-model-generator
- swarm-run-pytest
- # - generate-report - can't moved to JJB, a lot of parameters is not supported like Inject environment variables
+ - generate-report
# - mark-reports - can't moved to JJB, a lot of parameters is not supported like Inject environment variables
# - diff_params_reclass_system - can't moved to JJB, unsupported parameters
# - diff_params_reclass_system - can't moved to JJB, unsupported parameters
diff --git a/jobs/templates/generate-report.yml b/jobs/templates/generate-report.yml
new file mode 100644
index 0000000..ea78ca0
--- /dev/null
+++ b/jobs/templates/generate-report.yml
@@ -0,0 +1,66 @@
+- job-template:
+ project-type: freestyle
+ description: "{job-description}
+ Define DATE to define a specific Test Plan with name like [2019.2.0-update]System-$REPOSITORY_SUITE-$DATE
+ or define PLAN_NAME if you know it"
+ concurrent: true
+ disabled: false
+ name: generate-report
+ logrotate:
+ daysToKeep: 365
+ parameters:
+ - string:
+ default: ''
+ description: YYYY-MM-DD
+ name: DATE
+ trim: 'false'
+ - string:
+ default: '2019.2.0'
+ description:
+ name: REPOSITORY_SUITE
+ trim: 'false'
+ - string:
+ default: ''
+ description:
+ name: PLAN_NAME
+ trim: 'false'
+ - string:
+ default: ''
+ description: ''
+ name: TCP_QA_REFS
+ trim: 'true'
+ triggers:
+ - timed: H 9-22/2 * * *
+ scm:
+ - git:
+ branches:
+ - FETCH_HEAD
+ refspec: '${{TCP_QA_REFS}}'
+ url: https://gerrit.mcp.mirantis.com/mcp/tcp-qa
+ wrappers:
+ - inject:
+ properties-content: |-
+ CUSTOM_REPO_VENV_PATH=/home/jenkins/venv_testrail_reporter
+ VENV_PATH=/home/jenkins/testrail_report
+ - credentials-binding:
+ - username-password-separated:
+ credential-id: testrail_system_tests
+ username: TESTRAIL_USER_EMAIL
+ password: TESTRAIL_USER_KEY
+ - username-password-separated:
+ credential-id: jira-user
+ username: JIRA_USER
+ password: JIRA_PWD
+ builders:
+ - shell: "chmod +x jobs/pipelines/generate-report.sh"
+ - shell: "./jobs/pipelines/generate-report.sh"
+ publishers:
+ - archive:
+ artifacts: '**/*_bug_report_*.html'
+ allow-empty: false
+ - workspace-cleanup:
+ include:
+ - '*.html'
+
+
+
diff --git a/jobs/templates/swarm-cookied-model-generator.yml b/jobs/templates/swarm-cookied-model-generator.yml
index 79695b4..76864dc 100644
--- a/jobs/templates/swarm-cookied-model-generator.yml
+++ b/jobs/templates/swarm-cookied-model-generator.yml
@@ -1,9 +1,8 @@
- job-template:
project-type: freestyle
- description: -|
- {job-description}
+ description: "{job-description}
WARNING! models are pushed to the same LAB_CONTEXT_NAME repositories under the specified tags!
- Fuel-devops environment is erased after the build by default
+ Fuel-devops environment is erased after the build by default"
concurrent: true
disabled: false
name: swarm-cookied-model-generator