Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix installation when a version is pinned and the installer is enabled #609

Merged
merged 8 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ jobs:
parameters:
ansible_version:
type: string

machine:
image: ubuntu-2204:2023.10.1 # includes docker and docker-compose

Expand Down Expand Up @@ -341,6 +341,22 @@ jobs:
exit 1;
fi'

test_installer_over_pinned:
docker:
- image: datadog/docker-library:ansible_centos_2_10
steps:
- checkout
# datadog-installer will bailout if there's no systemctl binary, and won't attempt to
# create the systemd folder to store its units
# Since we're running the tests in a docker container without systemd, we can "help" it
# proceed by pretending systemd is there
- run: printf "#!/bin/bash\n\nexit 0" > /usr/bin/systemctl && chmod +x /usr/bin/systemctl
- run: mkdir -p /etc/systemd/system/
- run: DD_API_KEY=woof DD_SITE="datadoghq.com" DD_INSTALL_ONLY=true DD_AGENT_MINOR_VERSION=53 bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"
- run: >
ansible-playbook -v -i ./ci_test/inventory/ci.ini "./ci_test/install_installer_over_pinned.yaml"


workflows:
version: 2
test_datadog_role:
Expand Down Expand Up @@ -453,3 +469,6 @@ workflows:
matrix:
parameters:
ansible_version: ["2_10", "3_4", "4_10"]

- test_installer_over_pinned

12 changes: 12 additions & 0 deletions ci_test/install_installer_over_pinned.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

- hosts: all
roles:
- { role: '/root/project/'}
vars:
datadog_api_key: "11111111111111111111111111111111"
datadog_enabled: false
datadog_skip_running_check: true
datadog_agent_version: 7.53.0
datadog_apm_instrumentation_enabled: host
datadog_apm_instrumentation_libraries: [ "java" ]
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

- name: Debian Install Tasks
include_tasks: pkg-debian.yml
when: ansible_facts.os_family == "Debian" and not agent_datadog_skip_install
when: ansible_facts.os_family == "Debian"

- name: Include tasks to remove old GPG keys
include_tasks: _remove_rpm_keys.yml
Expand All @@ -50,11 +50,11 @@
# For Rocky it is some 4.X and >= 5.0
- name: RedHat Install Tasks
include_tasks: pkg-redhat.yml
when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"] and not agent_datadog_skip_install
when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"]

- name: Suse Install Tasks
include_tasks: pkg-suse.yml
when: ansible_facts.os_family == "Suse" and not agent_datadog_skip_install
when: ansible_facts.os_family == "Suse"

# Note we don't check agent_datadog_skip_install variable value for windows here,
# because some tasks in pkg-windows.yml are carried out regardless of its value.
Expand Down
2 changes: 1 addition & 1 deletion tasks/pkg-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@
apt:
name: datadog-signing-keys
state: latest # noqa package-latest
# we don't use update_cache: yes, as that was just done by the install-pinned/install-latest
# we don't use update_cache: yes, as that was just done by the "Ensure Datadog repository is up-to-date" task above
register: agent_datadog_signing_keys_install
when: not ansible_check_mode