mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 08:53:07 -06:00
Merged in DCD-933-copy-jira-config (pull request #81)
DCD-933: Add functionality to copy jira-config.properties if present. Approved-by: Ben Partridge <bpartridge@atlassian.com>
This commit is contained in:
@@ -76,6 +76,14 @@ to find them:
|
|||||||
|
|
||||||
repo:dc-deployments-automation repo:dc-deployments-automation path:*/defaults/main.yml atl
|
repo:dc-deployments-automation repo:dc-deployments-automation path:*/defaults/main.yml atl
|
||||||
|
|
||||||
|
### Custom files
|
||||||
|
|
||||||
|
* `jira-config.properties`: If this file exists in the shared home (default:
|
||||||
|
`/media/atl/jira/shared/`) then it will be copied to the Jira local home
|
||||||
|
directory (default: `/var/atlassian/application-data/jira/`). Note that this
|
||||||
|
only happens on node creation; if you create or update the shared file it will
|
||||||
|
need to be copied manually.
|
||||||
|
|
||||||
# Development and testing
|
# Development and testing
|
||||||
|
|
||||||
See [Development](DEVELOPMENT.md) for details on setting up a development
|
See [Development](DEVELOPMENT.md) for details on setting up a development
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ pipelines:
|
|||||||
- step:
|
- step:
|
||||||
name: Pre Parallelization stage
|
name: Pre Parallelization stage
|
||||||
script:
|
script:
|
||||||
- echo "Running tests in 34 batches"
|
- echo "Running tests in 35 batches"
|
||||||
- step:
|
- step:
|
||||||
name: Check if number of batches match actual number of scenarios
|
name: Check if number of batches match actual number of scenarios
|
||||||
script:
|
script:
|
||||||
@@ -303,4 +303,12 @@ pipelines:
|
|||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 34
|
- ./bin/run-tests-in-batches --batch 34
|
||||||
|
|
||||||
|
- step:
|
||||||
|
name: Molecule Test Batch - 35
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
script:
|
||||||
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
|
- ./bin/run-tests-in-batches --batch 35
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,11 @@ def test_cluster_file(host):
|
|||||||
assert f.contains('jira.shared.home = /media/atl/jira/shared')
|
assert f.contains('jira.shared.home = /media/atl/jira/shared')
|
||||||
|
|
||||||
|
|
||||||
|
def test_jira_config_prop(host):
|
||||||
|
f = host.file('/var/atlassian/application-data/jira/jira-config.properties')
|
||||||
|
assert not f.exists
|
||||||
|
|
||||||
|
|
||||||
def test_server_file(host):
|
def test_server_file(host):
|
||||||
f = host.file('/opt/atlassian/jira-software/current/conf/server.xml')
|
f = host.file('/opt/atlassian/jira-software/current/conf/server.xml')
|
||||||
assert f.exists
|
assert f.exists
|
||||||
|
|||||||
14
roles/jira_config/molecule/jira_config_props/Dockerfile.j2
Normal file
14
roles/jira_config/molecule/jira_config_props/Dockerfile.j2
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Molecule managed
|
||||||
|
|
||||||
|
{% if item.registry is defined %}
|
||||||
|
FROM {{ item.registry.url }}/{{ item.image }}
|
||||||
|
{% else %}
|
||||||
|
FROM {{ item.image }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||||
|
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
|
||||||
|
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||||
|
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
|
||||||
|
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
|
||||||
|
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
|
||||||
36
roles/jira_config/molecule/jira_config_props/molecule.yml
Normal file
36
roles/jira_config/molecule/jira_config_props/molecule.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
lint:
|
||||||
|
name: yamllint
|
||||||
|
platforms:
|
||||||
|
- name: amazon_linux2
|
||||||
|
image: amazonlinux:2
|
||||||
|
groups:
|
||||||
|
- aws_node_local
|
||||||
|
ulimits:
|
||||||
|
- nofile:262144:262144
|
||||||
|
- name: ubuntu_lts
|
||||||
|
image: ubuntu:bionic
|
||||||
|
groups:
|
||||||
|
- aws_node_local
|
||||||
|
ulimits:
|
||||||
|
- nofile:262144:262144
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
options:
|
||||||
|
skip-tags: runtime_pkg
|
||||||
|
lint:
|
||||||
|
name: ansible-lint
|
||||||
|
options:
|
||||||
|
x: ["701"]
|
||||||
|
inventory:
|
||||||
|
links:
|
||||||
|
group_vars: ../../../../group_vars/
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
||||||
|
lint:
|
||||||
|
name: flake8
|
||||||
|
enabled: false
|
||||||
44
roles/jira_config/molecule/jira_config_props/playbook.yml
Normal file
44
roles/jira_config/molecule/jira_config_props/playbook.yml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
vars:
|
||||||
|
atl_product_family: "jira"
|
||||||
|
atl_product_edition: "jira-software"
|
||||||
|
atl_product_user: "jira"
|
||||||
|
atl_product_version: "7.13.2"
|
||||||
|
|
||||||
|
# dbconfig.xml variables
|
||||||
|
atl_jdbc_user: 'atljira'
|
||||||
|
atl_jdbc_password: 'molecule_password'
|
||||||
|
atl_jvm_heap: 'PLACEHOLDER'
|
||||||
|
atl_jvm_opts: 'PLACEHOLDER'
|
||||||
|
atl_cluster_node_id: 'FAKEID'
|
||||||
|
atl_db_poolminsize: 1111
|
||||||
|
atl_db_poolmaxsize: 1111
|
||||||
|
atl_db_minidle: 1111
|
||||||
|
atl_db_maxidle: 1111
|
||||||
|
atl_db_maxwaitmillis: 1111
|
||||||
|
atl_db_minevictableidletimemillis: 1111
|
||||||
|
atl_db_timebetweenevictionrunsmillis: 1111
|
||||||
|
atl_db_removeabandoned: 'false'
|
||||||
|
atl_db_removeabandonedtimeout: 1111
|
||||||
|
atl_db_testwhileidle: 'false'
|
||||||
|
atl_db_testonborrow: 'true'
|
||||||
|
atl_db_engine: 'rds_postgres'
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Create shared home
|
||||||
|
file:
|
||||||
|
path: '/media/atl/jira/shared/'
|
||||||
|
state: directory
|
||||||
|
- name: Create jira-config.properties to check copy
|
||||||
|
copy:
|
||||||
|
dest: '/media/atl/jira/shared/jira-config.properties'
|
||||||
|
content: "jira.projectkey.warning = testwarning"
|
||||||
|
force: false # For idempotency check
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: linux_common
|
||||||
|
- role: product_common
|
||||||
|
- role: product_install
|
||||||
|
- role: jira_config
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
import testinfra.utils.ansible_runner
|
||||||
|
|
||||||
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||||
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
|
def test_dbconfig_file(host):
|
||||||
|
f = host.file('/var/atlassian/application-data/jira/dbconfig.xml')
|
||||||
|
assert f.exists
|
||||||
|
assert f.user == 'jira'
|
||||||
|
assert f.contains("<database-type>postgres72</database-type>")
|
||||||
|
assert f.contains("<driver-class>org.postgresql.Driver</driver-class>")
|
||||||
|
assert f.contains("<username>atljira</username>")
|
||||||
|
assert f.contains("<password>molecule_password</password>")
|
||||||
|
|
||||||
|
assert f.contains("<pool-min-size>1111</pool-min-size>")
|
||||||
|
assert f.contains("<pool-max-size>1111</pool-max-size>")
|
||||||
|
assert f.contains("<pool-min-idle>1111</pool-min-idle>")
|
||||||
|
assert f.contains("<pool-max-idle>1111</pool-max-idle>")
|
||||||
|
|
||||||
|
assert f.contains("<pool-max-wait>1111</pool-max-wait>")
|
||||||
|
assert f.contains("<min-evictable-idle-time-millis>1111</min-evictable-idle-time-millis>")
|
||||||
|
assert f.contains("<pool-remove-abandoned>false</pool-remove-abandoned>")
|
||||||
|
assert f.contains("<time-between-eviction-runs-millis>1111</time-between-eviction-runs-millis>")
|
||||||
|
assert f.contains("<min-evictable-idle-time-millis>1111</min-evictable-idle-time-millis>")
|
||||||
|
assert f.contains("<pool-remove-abandoned>false</pool-remove-abandoned>")
|
||||||
|
assert f.contains("<pool-remove-abandoned-timeout>1111</pool-remove-abandoned-timeout>")
|
||||||
|
assert f.contains("<pool-test-while-idle>false</pool-test-while-idle>")
|
||||||
|
assert f.contains("<pool-test-on-borrow>true</pool-test-on-borrow>")
|
||||||
|
|
||||||
|
|
||||||
|
def test_setenv_file(host):
|
||||||
|
f = host.file('/opt/atlassian/jira-software/current/bin/setenv.sh')
|
||||||
|
assert f.exists
|
||||||
|
assert f.contains('^JVM_MINIMUM_MEMORY="PLACEHOLDER"')
|
||||||
|
assert f.contains('^JVM_MAXIMUM_MEMORY="PLACEHOLDER"')
|
||||||
|
assert f.contains('^JIRA_HOME="/var/atlassian/application-data/jira"')
|
||||||
|
assert f.contains('^export CATALINA_OPTS="')
|
||||||
|
assert f.contains('^JVM_SUPPORT_RECOMMENDED_ARGS="PLACEHOLDER"')
|
||||||
|
|
||||||
|
|
||||||
|
def test_cluster_file(host):
|
||||||
|
f = host.file('/var/atlassian/application-data/jira/cluster.properties')
|
||||||
|
assert f.exists
|
||||||
|
assert f.contains('jira.node.id = FAKEID')
|
||||||
|
assert f.contains('jira.shared.home = /media/atl/jira/shared')
|
||||||
|
|
||||||
|
|
||||||
|
def test_jira_config_prop(host):
|
||||||
|
f = host.file('/var/atlassian/application-data/jira/jira-config.properties')
|
||||||
|
assert f.exists
|
||||||
|
assert f.contains('jira.projectkey.warning = testwarning')
|
||||||
|
|
||||||
|
|
||||||
|
def test_server_file(host):
|
||||||
|
f = host.file('/opt/atlassian/jira-software/current/conf/server.xml')
|
||||||
|
assert f.exists
|
||||||
|
assert f.contains('Connector port="8080"')
|
||||||
|
assert f.contains('Server port="8005"')
|
||||||
|
assert f.contains('<Context path=""')
|
||||||
|
assert f.contains('maxThreads="200"')
|
||||||
|
assert f.contains('minSpareThreads="10"')
|
||||||
|
assert f.contains('connectionTimeout="20000"')
|
||||||
|
assert f.contains('enableLookups="false"')
|
||||||
|
assert f.contains('protocol="HTTP/1.1"')
|
||||||
|
assert f.contains('redirectPort=""')
|
||||||
|
assert f.contains('acceptCount="10"')
|
||||||
|
assert f.contains('secure="false"')
|
||||||
|
assert f.contains('scheme="http"')
|
||||||
|
assert not f.contains('proxyName=')
|
||||||
|
assert not f.contains('proxyPort=')
|
||||||
|
|
||||||
|
|
||||||
|
def test_install_permissions(host):
|
||||||
|
assert host.file('/opt/atlassian/jira-software/current/conf/server.xml').user == 'root'
|
||||||
|
assert host.file('/opt/atlassian/jira-software/current/atlassian-jira/WEB-INF/web.xml').user == 'root'
|
||||||
|
|
||||||
|
assert host.file('/opt/atlassian/jira-software/current/logs/').user == 'jira'
|
||||||
|
assert host.file('/opt/atlassian/jira-software/current/work/').user == 'jira'
|
||||||
|
assert host.file('/opt/atlassian/jira-software/current/temp/').user == 'jira'
|
||||||
@@ -18,6 +18,18 @@
|
|||||||
src: server.xml.j2
|
src: server.xml.j2
|
||||||
dest: "{{ atl_product_installation_versioned }}/conf/server.xml"
|
dest: "{{ atl_product_installation_versioned }}/conf/server.xml"
|
||||||
|
|
||||||
|
- name: Check for a jira-config.properties in the shared home
|
||||||
|
stat:
|
||||||
|
path: "{{ atl_product_home_shared }}/jira-config.properties"
|
||||||
|
register: jira_config_properties
|
||||||
|
|
||||||
|
- name: Copy jira-config.properties if exists
|
||||||
|
copy:
|
||||||
|
remote_src: true
|
||||||
|
src: "{{ atl_product_home_shared }}/jira-config.properties"
|
||||||
|
dest: "{{ atl_product_home }}/jira-config.properties"
|
||||||
|
when: jira_config_properties.stat.exists
|
||||||
|
|
||||||
- name: Override JVM memory settings.
|
- name: Override JVM memory settings.
|
||||||
# Ugly but necessary as the product installs this file so we need to make the change here.
|
# Ugly but necessary as the product installs this file so we need to make the change here.
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
|||||||
Reference in New Issue
Block a user