Add swarm-cookied-model-generator to JJB PROD-36999

Change-Id: I099066c4a4bfe7f43ee30df6898360d5d8bcb9c0
diff --git a/jobs/templates/swarm-cookied-model-generator.yml b/jobs/templates/swarm-cookied-model-generator.yml
new file mode 100644
index 0000000..79695b4
--- /dev/null
+++ b/jobs/templates/swarm-cookied-model-generator.yml
@@ -0,0 +1,171 @@
+- job-template:
+    project-type: freestyle
+    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
+    concurrent: true
+    disabled: false
+    name: swarm-cookied-model-generator
+    parameters:
+      - string:
+          default: ''
+          description: 'This name will be used:
+            - to find the template file tcp_tests/templates/cookied-model-generator/salt_$LAB_CONTEXT_NAME.yaml
+            - to set the salt model cluster name'
+          name: LAB_CONTEXT_NAME
+          trim: 'false'
+      - string:
+          default: ''
+          description: 'Cluster name wich will be used for model creation
+Default: LAB_CONFIG_NAME'
+          name: CLUSTER_NAME
+          trim: 'false'
+      - string:
+          default: ''
+          description: 'Domain name wich will be used for model creation
+Default: LAB_CONFIG_NAME.local'
+          name: DOMAIN_NAME
+          trim: 'false'
+      - string:
+          default: 'proposed'
+          description: ''
+          name: REPOSITORY_SUITE
+          trim: 'false'
+      - string:
+          default: 'proposed'
+          description: ''
+          name: SALT_MODELS_SYSTEM_COMMIT
+          trim: 'false'
+      - string:
+          default: 'proposed'
+          description: ''
+          name: COOKIECUTTER_TEMPLATE_COMMIT
+          trim: 'false'
+      - string:
+          default: ''
+          description: ''
+          name: JENKINS_PIPELINE_BRANCH
+          trim: 'false'
+      - string:
+          default: ''
+          description: ''
+          name: SALT_MODELS_SYSTEM_REF_CHANGE
+          trim: 'false'
+      - string:
+          default: 'sre-team-infra'
+          description: ''
+          name: NODE_NAME
+          trim: 'false'
+      - string:
+          default: ''
+          description: ''
+          name: TCP_QA_REFS
+      - string:
+          default: ''
+          description: 'environment-templates repository ref change'
+          name: ENVIRONMENT_TEMPLATE_REF_CHANGE
+          trim: 'false'
+      - string:
+          default: false
+          description: cookiecutter-templates repository ref change
+          name: COOKIECUTTER_REF_CHANGE
+      - bool:
+          default: true
+          description: ''
+          name: ERASE_EXISTING_ENVIRONMENT
+      - bool:
+          default: true
+          description: ''
+          name: SHUTDOWN_ENV_ON_TEARDOWN
+      - bool:
+          default: true
+          description: ''
+          name: ERASE_ENVIRONMENT_AFTER_BUILD
+      - string:
+          default: '192.168.10.0/24'
+          description: 'Management (admin/PXE) network. For now /24 only.'
+          name: IPV4_NET_ADMIN
+          trim: 'false'
+      - string:
+          default: '172.16.10.0/24'
+          description: 'Control (internal cluster communications) network. For now /24 only.'
+          name: IPV4_NET_CONTROL
+          trim: 'false'
+      - string:
+          default: '10.1.0.0/24'
+          description: 'OpenStack tenant (transport for user-defined internal networks for instances) network. For now /24 only.'
+          name: IPV4_NET_TENANT
+          trim: 'false'
+      - string:
+          default: '10.16.0.0/24'
+          description: 'OpenStack external network (for incoming connections with floating IPs). For now /24 only.'
+          name: IPV4_NET_EXTERNAL
+          trim: 'false'
+      - string:
+          default: '/home/jenkins/images/cfg01-day01.qcow2'
+          description: 'Image used for the model generation and validation'
+          name: IMAGE_PATH_CFG01_DAY01
+          trim: 'false'
+      - string:
+          default: ''
+          description: ''
+          name: UPDATE_REPO_CUSTOM_TAG
+          trim: 'false'
+      - string:
+          default: ''
+          description: ''
+          name: UPDATE_VERSION
+          trim: 'false'
+      - string:
+          default: ''
+          description: ''
+          name: DEPLOY_NETWORK_NETMASK
+          trim: 'false'
+    logrotate:
+      daysToKeep: 365
+    scm:
+      - git:
+          branches:
+            - FETCH_HEAD
+          refspec: '${{TCP_QA_REFS}}'
+          url: https://gerrit.mcp.mirantis.com/mcp/tcp-qa
+    wrappers:
+      - inject:
+          properties-content: |-
+              VENV_PATH=/home/jenkins/fuel-devops30
+              ENV_NAME=swarm_model_$BUILD_NUMBER
+              LAB_CONFIG_NAME=cookied-model-generator
+
+              SALT_STEPS_PATH=templates/$LAB_CONFIG_NAME/salt_$LAB_CONTEXT_NAME.yaml
+
+              TEST_GROUP=test_generate_model
+              #STORAGE_POOL_NAME=second_pool
+              PYTHONIOENCODING=UTF-8
+              MAKE_SNAPSHOT_STAGES=false
+              DEVOPS_LOCK_FILE=/run/lock/devops_lock
+      - credentials-binding:
+          - ssh-user-private-key:
+              credential-id: f4fb9dd6-ba63-4085-82f7-3fa601334d95
+              key-file-variable: COOKIECUTTER_TEMPLATES_REPOSITORY_KEY_PATH
+    builders:
+      - shell: "chmod +x jobs/pipelines/cookied-model-generator.sh"
+      - shell: "./jobs/pipelines/cookied-model-generator.sh"
+    publishers:
+      - archive:
+          artifacts: 'tcp_tests/*.log,tcp_tests/*.tar.gz,tcp_tests/*.xml'
+          allow-empty: false
+      - post-tasks:
+        - run-if-job-successful: false
+          matches:
+            # Small hack to start post-tasks every time after build
+            - log-text: test session starts
+            - operator: OR
+          script: " . $VENV_PATH/bin/activate;
+          if [ $SHUTDOWN_ENV_ON_TEARDOWN = 'true' ]; then
+          dos.py destroy $ENV_NAME || true;
+          fi;
+          
+          if [ $ERASE_ENVIRONMENT_AFTER_BUILD = 'true' ]; then
+              dos.py erase $ENV_NAME || true;
+          fi;"