Files
dsk-iac/ansible/01_old/roles/datadog.datadog/.circleci/config.yml
2023-12-19 13:36:16 +09:00

300 lines
9.2 KiB
YAML

---
version: 2.1
commands:
dry_run:
parameters:
version:
type: string
python:
type: string
steps:
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/install_agent_<<parameters.version>>.yaml" -e 'ansible_python_interpreter=/usr/bin/<<parameters.python>>' --check
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/downgrade_to_5.yaml" -e 'ansible_python_interpreter=/usr/bin/<<parameters.python>>' --check
install_agent_5:
parameters:
python:
type: string
steps:
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/install_agent_5.yaml" -e 'ansible_python_interpreter=/usr/bin/<<parameters.python>>'
- run: dd-agent info || true
- run: ps aux | grep -v grep | grep datadog-agent
install_agent:
parameters:
version:
type: string
python:
type: string
jinja2_native:
type: string
default: "false"
inventory:
type: string
default: "ci.ini"
steps:
- run: ANSIBLE_JINJA2_NATIVE="<<parameters.jinja2_native>>" ansible-playbook -i ./ci_test/inventory/<<parameters.inventory>> "./ci_test/install_agent_<<parameters.version>>.yaml" -e 'ansible_python_interpreter=/usr/bin/<<parameters.python>>'
- run: datadog-agent version
test_install_no_manage_config:
parameters:
version:
type: string
python:
type: string
steps:
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/install_agent_<<parameters.version>>.yaml" -e '{"ansible_python_interpreter":"/usr/bin/<<parameters.python>>","datadog_manage_config":false}'
- run: bash -c '[ -f /etc/datadog-agent/datadog.yaml.example ] || [ -f /etc/dd-agent/datadog.conf.example ]'
- run: bash -c '[ ! -f /etc/datadog-agent/datadog.yaml ] && [ ! -f /etc/datadog-agent/system-probe.yaml ] && [ ! -f /etc/datadog-agent/security-agent.yaml ] && [ ! -f /etc/dd-agent/datadog.conf ]'
downgrade_agent_5_32:
parameters:
python:
type: string
steps:
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/downgrade_to_5.yaml" -e 'ansible_python_interpreter=/usr/bin/<<parameters.python>>'
- run: dd-agent info || true
- run: ps aux | grep -v grep | grep datadog-agent
test_agent_install_downgrade:
parameters:
version:
type: string
python:
type: string
steps:
- checkout
- dry_run:
version: "<<parameters.version>>"
python: "<<parameters.python>>"
- install_agent_5:
python: "<<parameters.python>>"
- when:
condition:
not:
equal: [<<parameters.version>>, "5"]
steps:
- install_agent:
version: "<<parameters.version>>"
python: "<<parameters.python>>"
- downgrade_agent_5_32:
python: "<<parameters.python>>"
test_agent_install:
parameters:
version:
type: string
python:
type: string
jinja2_native:
type: string
default: "false"
steps:
- checkout
- install_agent:
version: "<<parameters.version>>"
python: "<<parameters.python>>"
jinja2_native: "<<parameters.jinja2_native>>"
test_agent_install_macos:
parameters:
version:
type: string
python:
type: string
jinja2_native:
type: string
default: "false"
steps:
- checkout
- install_agent:
version: "<<parameters.version>>"
python: "<<parameters.python>>"
jinja2_native: "<<parameters.jinja2_native>>"
inventory: "ci_macos.ini"
jobs:
ansible_lint:
docker:
- image: datadog/docker-library:ansible_debian_2_10
steps:
- checkout
# TODO: upgrade ansible-lint to latest (will require updating the image for this task)
- run: pip install ansible-lint==5.4.0
- run: ansible-lint -v .
test_install_downgrade:
parameters:
ansible_version:
type: string
agent_version:
type: string
os:
type: string
python:
type: string
docker:
- image: datadog/docker-library:ansible_<<parameters.os>>_<<parameters.ansible_version>>
steps:
- checkout
- test_agent_install_downgrade:
version: "<<parameters.agent_version>>"
python: "<<parameters.python>>"
test_install:
parameters:
ansible_version:
type: string
agent_version:
type: string
os:
type: string
python:
type: string
jinja2_native:
type: string
default: "false"
docker:
- image: datadog/docker-library:ansible_<<parameters.os>>_<<parameters.ansible_version>>
steps:
- checkout
- test_agent_install:
version: "<<parameters.agent_version>>"
python: "<<parameters.python>>"
jinja2_native: "<<parameters.jinja2_native>>"
test_install_no_manage_config:
parameters:
ansible_version:
type: string
agent_version:
type: string
os:
type: string
python:
type: string
docker:
- image: datadog/docker-library:ansible_<<parameters.os>>_<<parameters.ansible_version>>
steps:
- checkout
- test_install_no_manage_config:
version: "<<parameters.agent_version>>"
python: "<<parameters.python>>"
test_install_macos:
parameters:
ansible_version:
type: string
agent_version:
type: string
python:
type: string
jinja2_native:
type: string
default: "false"
macos:
xcode: 13.3.0
steps:
- checkout
- run:
name: Install Python3
command: brew install python3
- run:
name: Install Ansible
command: pip3 install ansible~=<<parameters.ansible_version>>
- test_agent_install_macos:
version: "<<parameters.agent_version>>"
python: "<<parameters.python>>"
jinja2_native: "<<parameters.jinja2_native>>"
workflows:
version: 2
test_datadog_role:
# Note: Ansible 5.* requires Python >= 3.8, which for now we only have on Debian.
# Whenever newer major versions of RHEL and SUSE get released, they should have
# a new enough Python, so we will test on them as well
jobs:
- ansible_lint
- test_install_downgrade:
matrix:
parameters:
ansible_version: ["2_6", "2_7", "2_8"]
agent_version: ["5", "6", "7"]
os: ["debian"]
python: ["python2", "python3"]
# Newer debian images only have Pythpn 3 installed
- test_install_downgrade:
matrix:
parameters:
ansible_version: ["2_9", "2_10", "3_4", "4_10", "5_3"]
agent_version: ["5", "6", "7"]
os: ["debian"]
python: ["python3"]
# Newer debian images only have Pythpn 3 installed
- test_install_no_manage_config:
matrix:
parameters:
ansible_version: ["2_10", "3_4", "4_10"]
agent_version: ["5", "7"]
os: ["debian"]
python: ["python3"]
# centos = CentOS 7. CentOS <= 7 + Python3 is not supported,
# as the yum module is Python2-only.
- test_install_downgrade:
matrix:
parameters:
ansible_version: ["2_6", "2_7", "2_8", "2_9", "2_10", "3_4", "4_10"]
agent_version: ["5", "6", "7"]
os: ["centos"]
python: ["python2"]
# We want to check that the dnf path works with CentOS 8
# Newer CentOS images only have Pythpn 3 installed
- test_install:
matrix:
parameters:
ansible_version: ["2_8", "2_9", "2_10", "3_4", "4_10"]
agent_version: ["6", "7"]
jinja2_native: ["true", "false"]
os: ["rocky8"]
python: ["python3"]
# Newer suse images only have Python 3 installed
- test_install:
matrix:
parameters:
ansible_version: ["2_8", "2_9", "2_10", "3_4", "4_10"]
agent_version: ["6", "7"]
os: ["suse"]
python: ["python3"]
# Amazon Linux 2 has yum only by default => we only use Python 3 with Ansible >= 4.10
# because of the respawn_module functionality added to the yum module in
# https://github.com/ansible/ansible/commit/4c5ce5a1a9e79a845aff4978cfeb72a0d4ecf7d6
- test_install:
matrix:
parameters:
ansible_version: ["2_8", "2_9", "2_10", "3_4", "4_10"]
agent_version: ["6", "7"]
os: ["amazonlinux2"]
python: ["python2"]
- test_install:
matrix:
parameters:
ansible_version: ["4_10"]
agent_version: ["6", "7"]
os: ["amazonlinux2"]
python: ["python3"]
- test_install_macos:
matrix:
parameters:
ansible_version: ["2.8", "2.9", "2.10", "3.4", "4.10"]
agent_version: ["6_macos", "7_macos"]
python: ["python3"]