diff --git a/.travis.yml b/.travis.yml index 3224956..47d2177 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,21 +10,21 @@ install: - pipenv sync env: jobs: - - DOCKER_IMAGE_BASE=idealista/jdk:8u252-stretch-openjdk-headless TOMCAT_VERSION=9.0.43 - - DOCKER_IMAGE_BASE=idealista/jdk:8u252-stretch-openjdk-headless TOMCAT_VERSION=8.5.63 - - DOCKER_IMAGE_BASE=idealista/jdk:8u252-stretch-openjdk-headless TOMCAT_VERSION=7.0.108 - - DOCKER_IMAGE_BASE=idealista/jdk:11.0.12-buster-openjdk-headless TOMCAT_VERSION=9.0.43 - - DOCKER_IMAGE_BASE=idealista/jdk:11.0.12-buster-openjdk-headless TOMCAT_VERSION=8.5.63 - - DOCKER_IMAGE_BASE=idealista/jdk:11.0.12-buster-openjdk-headless TOMCAT_VERSION=7.0.108 - - DOCKER_IMAGE_BASE=idealista/jdk:11.0.6-stretch-openjdk-headless TOMCAT_VERSION=9.0.43 - - DOCKER_IMAGE_BASE=idealista/jdk:11.0.6-stretch-openjdk-headless TOMCAT_VERSION=8.5.63 - - DOCKER_IMAGE_BASE=idealista/jdk:11.0.6-stretch-openjdk-headless TOMCAT_VERSION=7.0.108 - - DOCKER_IMAGE_BASE=idealista/jdk:8u265-focal-openjdk-headless TOMCAT_VERSION=9.0.43 - - DOCKER_IMAGE_BASE=idealista/jdk:8u265-focal-openjdk-headless TOMCAT_VERSION=8.5.63 - - DOCKER_IMAGE_BASE=idealista/jdk:8u265-focal-openjdk-headless TOMCAT_VERSION=7.0.108 - - DOCKER_IMAGE_BASE=idealista/jdk:14.0.1-focal-openjdk-headless TOMCAT_VERSION=9.0.43 - - DOCKER_IMAGE_BASE=idealista/jdk:14.0.1-focal-openjdk-headless TOMCAT_VERSION=8.5.63 - - DOCKER_IMAGE_BASE=idealista/jdk:14.0.1-focal-openjdk-headless TOMCAT_VERSION=7.0.108 + - DOCKER_IMAGE_BASE=idealista/jdk:8u382-bullseye-temurin-jdk TOMCAT_VERSION=9.0.43 + - DOCKER_IMAGE_BASE=idealista/jdk:8u382-bullseye-temurin-jdk TOMCAT_VERSION=8.5.63 + - DOCKER_IMAGE_BASE=idealista/jdk:8u382-bullseye-temurin-jdk TOMCAT_VERSION=7.0.108 + - DOCKER_IMAGE_BASE=idealista/jdk:11.0.20-buster-temurin-jdk TOMCAT_VERSION=9.0.43 + - DOCKER_IMAGE_BASE=idealista/jdk:11.0.20-buster-temurin-jdk TOMCAT_VERSION=8.5.63 + - DOCKER_IMAGE_BASE=idealista/jdk:11.0.20-buster-temurin-jdk TOMCAT_VERSION=7.0.108 + - DOCKER_IMAGE_BASE=idealista/jdk:11.0.20-bullseye-temurin-jdk TOMCAT_VERSION=9.0.43 + - DOCKER_IMAGE_BASE=idealista/jdk:11.0.20-bullseye-temurin-jdk TOMCAT_VERSION=8.5.63 + - DOCKER_IMAGE_BASE=idealista/jdk:11.0.20-bullseye-temurin-jdk TOMCAT_VERSION=7.0.108 + - DOCKER_IMAGE_BASE=idealista/jdk:8u382-focal-temurin-jdk TOMCAT_VERSION=9.0.43 + - DOCKER_IMAGE_BASE=idealista/jdk:8u382-focal-temurin-jdk TOMCAT_VERSION=8.5.63 + - DOCKER_IMAGE_BASE=idealista/jdk:8u382-focal-temurin-jdk TOMCAT_VERSION=7.0.108 + - DOCKER_IMAGE_BASE=idealista/jdk:17.0.8-focal-temurin-jdk TOMCAT_VERSION=9.0.43 + - DOCKER_IMAGE_BASE=idealista/jdk:17.0.8-focal-temurin-jdk TOMCAT_VERSION=8.5.63 + - DOCKER_IMAGE_BASE=idealista/jdk:17.0.8-focal-temurin-jdk TOMCAT_VERSION=7.0.108 script: - pipenv run molecule test diff --git a/.yamllint b/.yamllint index 85d2e86..8827676 100644 --- a/.yamllint +++ b/.yamllint @@ -1,11 +1,7 @@ --- - +# Based on ansible-lint config extends: default -ignore: | - *.travis.yml - test_*.yml - rules: braces: max-spaces-inside: 1 @@ -13,7 +9,25 @@ rules: brackets: max-spaces-inside: 1 level: error + colons: + max-spaces-after: -1 + level: error + commas: + max-spaces-after: -1 + level: error + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + max: 3 + level: error + hyphens: + level: error + indentation: disable + key-duplicates: enable line-length: disable - # NOTE(retr0h): Templates no longer fail this lint rule. - # Uncomment if running old Molecule templates. - # truthy: disable + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: disable + truthy: disable diff --git a/CHANGELOG.md b/CHANGELOG.md index 94ea890..735728b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch ## [Unreleased](https://github.com/idealista/tomcat_role/tree/develop) +## [1.10.4](https://github.com/idealista/tomcat_role/tree/1.10.4) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.10.3...1.10.4) +### Fixed +- *[#117](https://github.com/idealista/tomcat_role/issues/117) Agent jar installation not working correctly* @sorobon + ## [1.10.3](https://github.com/idealista/tomcat_role/tree/1.10.3) [Full Changelog](https://github.com/idealista/tomcat_role/compare/1.10.2...1.10.3) ### Added diff --git a/Pipfile b/Pipfile index 4a0380b..4b838fd 100644 --- a/Pipfile +++ b/Pipfile @@ -14,4 +14,4 @@ lxml = "==4.6.2" ansible-lint = "==4.2.0" [requires] -python_version = "3" +python_version = "3" \ No newline at end of file diff --git a/Pipfile.lock b/Pipfile.lock index 6300e9a..1756dea 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -577,4 +577,4 @@ } }, "develop": {} -} +} \ No newline at end of file diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index 0786dfc..511de9d 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -1,15 +1,29 @@ # Molecule managed {% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} +FROM --platform=linux/amd64 {{ item.registry.url }}/{{ item.image }} {% else %} -FROM {{ item.image }} +FROM --platform=linux/amd64 {{ item.image }} {% endif %} -# install minimal packages for debian slim images -RUN apt-get update && \ - DEBIAN_FRONTEND="noninteractive" apt-get install -y -q python3 sudo bash ca-certificates iproute2 systemd systemd-sysv && \ - apt-get clean +{% if 'stretch' in item.image %} +RUN echo "deb http://archive.debian.org/debian/ stretch contrib main non-free" > /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch contrib main non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian/ stretch-backports main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch-backports main contrib non-free" >> /etc/apt/sources.list && \ + rm /etc/apt/sources.list.d/ftp* && \ + apt-get update +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python3 sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python36 sudo python3-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && 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 update -y && 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; fi STOPSIGNAL SIGRTMIN+3 RUN systemctl set-default multi-user.target diff --git a/molecule/default/group_vars/tomcat/main.yml b/molecule/default/group_vars/tomcat/main.yml index cb6589a..0a239bc 100644 --- a/molecule/default/group_vars/tomcat/main.yml +++ b/molecule/default/group_vars/tomcat/main.yml @@ -22,6 +22,16 @@ tomcat_agents_config: catalina_opts: - '-javaagent:{{ tomcat_install_path }}/datadog/dd-java-agent-0.73.0.jar -Ddd.profiling.enabled=true -Ddd.logs.injection=true -Ddd.service=sample -Ddd.env=molecule' configuration_files: [] + - name: "otel" + version: "1.30.0" + download_url: "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.30.0/opentelemetry-javaagent.jar" + catalina_opts: + - '-javaagent:{{ tomcat_install_path }}/otel/opentelemetry-javaagent.jar -Dotel.javaagent.configuration-file={{ tomcat_install_path }}/otel/otel.properties' + configuration_files: + - "otel.properties" + params: { + service_name: "application_sample_name" + } tomcat_logs_path: /var/log/tomcat diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0c19e92..32d78f8 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -12,7 +12,7 @@ platforms: - name: tomcat groups: - tomcat - image: ${DOCKER_IMAGE_BASE:-idealista/jdk:8u252-stretch-openjdk-headless} + image: ${DOCKER_IMAGE_BASE:-idealista/jdk:8u382-bullseye-temurin-jdk} privileged: false command: '/lib/systemd/systemd' capabilities: diff --git a/molecule/default/templates/tomcat/agents/otel/otel.properties.j2 b/molecule/default/templates/tomcat/agents/otel/otel.properties.j2 new file mode 100644 index 0000000..8b79254 --- /dev/null +++ b/molecule/default/templates/tomcat/agents/otel/otel.properties.j2 @@ -0,0 +1,4 @@ + +{{ ansible_managed }} + +otel.service.name={{ item.params.service_name }} \ No newline at end of file diff --git a/tasks/agent.yml b/tasks/agent.yml index 6337205..fb6b7a5 100644 --- a/tasks/agent.yml +++ b/tasks/agent.yml @@ -94,7 +94,7 @@ dest: "{{ tomcat_install_path }}/{{ item.name }}/{{ item.file }}" owner: "{{ tomcat_user }}" group: "{{ tomcat_group }}" - when: agent_downloaded.changed + when: tomcat_agent_configuration is defined notify: restart tomcat with_items: - '{{ tomcat_agent_configuration }}' diff --git a/test-requirements.txt b/test-requirements.txt index ad78a9f..95fe8a5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,4 +3,4 @@ molecule==3.0.4 docker==4.2.2 jmespath==0.9.4 lxml==4.6.2 -ansible-lint==4.2.0 +ansible-lint==4.2.0 \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml index 0afdbd6..8024b9e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -10,4 +10,4 @@ tomcat_supported_agents_extensions: - '.tar.bz2' - '.tar.xz' -tomcat_show_server_info_on_error_page: false \ No newline at end of file +tomcat_show_server_info_on_error_page: false