diff --git a/.github/workflows/ansible.yml b/.github/workflows/ansible.yml index d0e6a68f8a..411ac79b54 100644 --- a/.github/workflows/ansible.yml +++ b/.github/workflows/ansible.yml @@ -28,15 +28,125 @@ concurrency: permissions: contents: write -defaults: - run: - working-directory: 'deployments/ansible' +env: + GO_VERSION: 1.23.8 jobs: + setup-environment: + runs-on: ubuntu-24.04 + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: '**/go.sum' + + - name: Installing dependency + run: | + make install-tools + + cross-compile: + runs-on: ubuntu-24.04 + needs: [ setup-environment ] + strategy: + matrix: + SYS_BINARIES: [ "binaries-linux_amd64", "binaries-linux_arm64", "binaries-linux_ppc64le" ] + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: '**/go.sum' + + - name: Build Collector + run: | + make ${{ matrix.SYS_BINARIES }} + + - name: Uploading binaries + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.SYS_BINARIES }} + path: | + ./bin/* + + agent-bundle-linux: + runs-on: ${{ fromJSON('["ubuntu-24.04", "otel-arm64"]')[matrix.ARCH == 'arm64'] }} + strategy: + matrix: + ARCH: [ "amd64", "arm64" ] + fail-fast: false + steps: + - uses: actions/checkout@v4 + + - uses: actions/cache@v4 + id: bundle-cache + with: + path: .cache/buildx/agent-bundle-${{ matrix.ARCH }} + key: agent-bundle-buildx-${{ matrix.ARCH }}-${{ hashFiles('packaging/bundle/**') }} + restore-keys: | + agent-bundle-buildx-${{ matrix.ARCH }}- + + - run: make -C packaging/bundle agent-bundle-linux ARCH=${{ matrix.ARCH }} + env: + BUNDLE_CACHE_HIT: "${{ steps.bundle-cache.outputs.cache-hit }}" + + - uses: actions/upload-artifact@v4 + with: + name: agent-bundle-linux-${{ matrix.ARCH }} + path: ./dist/agent-bundle_linux_${{ matrix.ARCH }}.tar.gz + + build-package: + runs-on: ubuntu-24.04 + needs: [ cross-compile, agent-bundle-linux ] + strategy: + matrix: + SYS_PACKAGE: [ "deb", "rpm", "tar" ] + ARCH: [ "amd64", "arm64" ] + fail-fast: false + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: '**/go.sum' + + - name: Downloading binaries-linux_${{ matrix.ARCH }} + uses: actions/download-artifact@v4 + with: + name: binaries-linux_${{ matrix.ARCH }} + path: ./bin + + - uses: actions/download-artifact@v4 + with: + name: agent-bundle-linux-${{ matrix.ARCH }} + path: ./dist + + - name: Build ${{ matrix.SYS_PACKAGE }} ${{ matrix.ARCH }} package + run: make ${{ matrix.SYS_PACKAGE }}-package SKIP_COMPILE=true SKIP_BUNDLE=true VERSION="" ARCH="${{ matrix.ARCH }}" + + - name: Uploading ${{ matrix.SYS_PACKAGE }} ${{ matrix.ARCH }} package artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.SYS_PACKAGE }}-${{ matrix.ARCH }}-package + path: ./dist/splunk-otel-collector* lint: name: Lint runs-on: ubuntu-24.04 + defaults: + run: + working-directory: 'deployments/ansible' steps: - name: Check out the codebase. uses: actions/checkout@v4 @@ -54,8 +164,11 @@ jobs: linux-test: name: Linux Test - needs: lint + needs: [lint, build-package] runs-on: ubuntu-24.04 + defaults: + run: + working-directory: 'deployments/ansible' strategy: fail-fast: false matrix: @@ -75,6 +188,10 @@ jobs: - name: Check out the codebase. uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + path: /tmp + - uses: DamianReeves/write-file-action@v1.3 with: path: "${{ github.workspace }}/requirements.txt" @@ -113,6 +230,9 @@ jobs: name: Windows Test needs: lint runs-on: ubuntu-24.04 + defaults: + run: + working-directory: 'deployments/ansible' timeout-minutes: 60 strategy: fail-fast: false @@ -127,6 +247,7 @@ jobs: - "2022" scenario: - default + - default_install_remote_version - custom_vars - with_instrumentation steps: @@ -198,6 +319,9 @@ jobs: name: Push Release Tag needs: lint runs-on: ubuntu-24.04 + defaults: + run: + working-directory: 'deployments/ansible' if: github.ref == 'refs/heads/main' steps: - name: Checkout diff --git a/deployments/ansible/molecule/custom_vars/converge.yml b/deployments/ansible/molecule/custom_vars/converge.yml index 5b795b6f20..37d3c57bb7 100644 --- a/deployments/ansible/molecule/custom_vars/converge.yml +++ b/deployments/ansible/molecule/custom_vars/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_ingest_url: https://fake-splunk-ingest.com splunk_api_url: https://fake-splunk-api.com diff --git a/deployments/ansible/molecule/custom_vars/verify.yml b/deployments/ansible/molecule/custom_vars/verify.yml index 2cee3523af..6f0ad87324 100644 --- a/deployments/ansible/molecule/custom_vars/verify.yml +++ b/deployments/ansible/molecule/custom_vars/verify.yml @@ -68,10 +68,6 @@ - name: Populate package facts ansible.builtin.package_facts: - - name: Assert specified version of splunk-otel-collector is installed - assert: - that: ansible_facts.packages['splunk-otel-collector'][0].version == '0.126.0' - - name: Assert custom service user is set ansible.builtin.lineinfile: line: User=custom-user diff --git a/deployments/ansible/molecule/default/converge.yml b/deployments/ansible/molecule/default/converge.yml index 9efab1d0b3..102a428895 100644 --- a/deployments/ansible/molecule/default/converge.yml +++ b/deployments/ansible/molecule/default/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm start_service: false diff --git a/deployments/ansible/molecule/default_install_remote_version/Dockerfile.j2 b/deployments/ansible/molecule/default_install_remote_version/Dockerfile.j2 new file mode 100644 index 0000000000..61aaf55929 --- /dev/null +++ b/deployments/ansible/molecule/default_install_remote_version/Dockerfile.j2 @@ -0,0 +1,55 @@ +{% if item.image not in ["opensuse12", "opensuse15", "centos9"] %} +FROM geerlingguy/docker-{{ item.image }}-ansible:latest +{% elif item.image == "centos9" %} +FROM quay.io/centos/centos:stream9 +ENV container docker +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial +RUN dnf install -y initscripts sudo systemd +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; +# Disable requiretty. +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers +CMD ["/usr/sbin/init"] +{% else %} +{% if item.image == "opensuse12" %} +FROM opensuse/leap:42 +RUN sed -i 's|download.opensuse.org|ftp5.gwdg.de/pub/opensuse/discontinued|' /etc/zypp/repos.d/*.repo +RUN zypper -n clean && zypper -n refresh +RUN zypper -n install -l ansible dbus-1 rpm-python sudo systemd-sysvinit +{% else %} +FROM opensuse/leap:15 +RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo +RUN zypper -n install -l ansible dbus-1 python3-rpm sudo systemd-sysvinit +{% endif %} + +ENV container docker + +RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /usr/lib/systemd/system/multi-user.target.wants/*;\ + rm -f /usr/lib/systemd/system/local-fs.target.wants/*; \ + rm -f /usr/lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /usr/lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /usr/lib/systemd/system/basic.target.wants/*; + +# Disable requiretty. +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +# Install Ansible inventory file. +RUN mkdir -p /etc/ansible +RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME [ "/sys/fs/cgroup" ] +CMD ["/sbin/init"] +{% endif %} + +# Workaround for Ansible Molecule bug causing sudo actions to fail. +# https://github.com/ansible/molecule/issues/4365 +# https://github.com/geerlingguy/docker-rockylinux9-ansible/issues/6#issuecomment-2805378491 +RUN chmod 0400 /etc/shadow diff --git a/deployments/ansible/molecule/default_install_remote_version/converge.yml b/deployments/ansible/molecule/default_install_remote_version/converge.yml new file mode 100644 index 0000000000..1705af55df --- /dev/null +++ b/deployments/ansible/molecule/default_install_remote_version/converge.yml @@ -0,0 +1,13 @@ +--- +- name: Converge scenario with the default configuration and remote version + hosts: all + become: yes + vars: + splunk_access_token: fake-token + splunk_realm: fake-realm + start_service: false + splunk_otel_collector_version: 0.126.0 + tasks: + - name: "Include signalfx.splunk_otel_collector.collector role" + include_role: + name: "signalfx.splunk_otel_collector.collector" diff --git a/deployments/ansible/molecule/default_install_remote_version/molecule.yml b/deployments/ansible/molecule/default_install_remote_version/molecule.yml new file mode 100644 index 0000000000..2333d7016e --- /dev/null +++ b/deployments/ansible/molecule/default_install_remote_version/molecule.yml @@ -0,0 +1 @@ +# no default config provided, make sure to set --base-config molecule argument instead diff --git a/deployments/ansible/molecule/default_install_remote_version/verify.yml b/deployments/ansible/molecule/default_install_remote_version/verify.yml new file mode 100644 index 0000000000..0108559e4e --- /dev/null +++ b/deployments/ansible/molecule/default_install_remote_version/verify.yml @@ -0,0 +1,51 @@ +--- +- name: Verify scenario with the default configuration + hosts: all + gather_facts: true + tasks: + + - name: Populate service facts + ansible.builtin.service_facts: + + - name: Assert splunk-otel-collector service is stopped + assert: + that: ansible_facts.services['splunk-otel-collector.service'].state == 'stopped' + + - name: Assert td-agent service is not installed + assert: + that: "'td-agent.service' not in ansible_facts.services" + + - name: Assert SPLUNK_ACCESS_TOKEN env var is set + ansible.builtin.lineinfile: + line: SPLUNK_ACCESS_TOKEN=fake-token + dest: /etc/otel/collector/splunk-otel-collector.conf + state: present + check_mode: yes + + - name: Assert SPLUNK_REALM env var is set + ansible.builtin.lineinfile: + line: SPLUNK_REALM=fake-realm + dest: /etc/otel/collector/splunk-otel-collector.conf + state: present + check_mode: yes + + - name: Assert SPLUNK_INGEST_URL env var is set + ansible.builtin.lineinfile: + line: SPLUNK_INGEST_URL=https://ingest.fake-realm.signalfx.com + dest: /etc/otel/collector/splunk-otel-collector.conf + state: present + check_mode: yes + + - name: Assert SPLUNK_API_URL env var is set + ansible.builtin.lineinfile: + line: SPLUNK_INGEST_URL=https://api.fake-realm.signalfx.com + dest: /etc/otel/collector/splunk-otel-collector.conf + state: present + check_mode: yes + + - name: Assert SPLUNK_HEC_URL env var is set + ansible.builtin.lineinfile: + line: SPLUNK_HEC_URL=https://ingest.fake-realm.signalfx.com/v1/log + dest: /etc/otel/collector/splunk-otel-collector.conf + state: present + check_mode: yes diff --git a/deployments/ansible/molecule/default_install_remote_version/windows-converge.yml b/deployments/ansible/molecule/default_install_remote_version/windows-converge.yml new file mode 100644 index 0000000000..b2d3732e1b --- /dev/null +++ b/deployments/ansible/molecule/default_install_remote_version/windows-converge.yml @@ -0,0 +1,12 @@ +--- +- name: Converge scenario with the default configuration on Windows + hosts: all + become: no + vars: + splunk_access_token: fake-token + splunk_realm: fake-realm + splunk_otel_collector_version: 0.126.0 + tasks: + - name: "Include signalfx.splunk_otel_collector.collector role" + include_role: + name: "signalfx.splunk_otel_collector.collector" diff --git a/deployments/ansible/molecule/default_install_remote_version/windows-prepare.yml b/deployments/ansible/molecule/default_install_remote_version/windows-prepare.yml new file mode 100644 index 0000000000..de3d83b031 --- /dev/null +++ b/deployments/ansible/molecule/default_install_remote_version/windows-prepare.yml @@ -0,0 +1,10 @@ +--- +- name: Prepare + hosts: all + gather_facts: false + become: no + tasks: + - name: Bypass prepare stage + debug: + msg: Bypassing the prepare stage since the client is a Windows box + changed_when: false diff --git a/deployments/ansible/molecule/default_install_remote_version/windows-verify.yml b/deployments/ansible/molecule/default_install_remote_version/windows-verify.yml new file mode 100644 index 0000000000..c83c50afb1 --- /dev/null +++ b/deployments/ansible/molecule/default_install_remote_version/windows-verify.yml @@ -0,0 +1,43 @@ +--- +- name: Verify scenario with the default configuration + hosts: all + gather_facts: true + become: no + vars: + collector_reg_values: + SPLUNK_CONFIG: '{{ ansible_env.ProgramData }}\Splunk\OpenTelemetry Collector\agent_config.yaml' + SPLUNK_ACCESS_TOKEN: fake-token + SPLUNK_REALM: fake-realm + SPLUNK_API_URL: https://api.fake-realm.signalfx.com + SPLUNK_HEC_TOKEN: fake-token + SPLUNK_HEC_URL: https://ingest.fake-realm.signalfx.com/v1/log + SPLUNK_INGEST_URL: https://ingest.fake-realm.signalfx.com + tasks: + - name: Check splunk-otel-collector service + ansible.windows.win_service: + name: splunk-otel-collector + state: started + check_mode: yes + register: service_status + + - name: Check fluentdwinsvc service + ansible.windows.win_service: + name: fluentdwinsvc + state: absent + check_mode: yes + register: service_status + + - name: Assert fluentdwinsvc service does not exist + assert: + that: not service_status.exists + + - name: Get splunk-otel-collector service env vars + ansible.windows.win_reg_stat: + path: HKLM:\SYSTEM\CurrentControlSet\Services\splunk-otel-collector + name: Environment + register: collector_env + + - name: Verify splunk-otel-collector service env vars + assert: + that: (item.key + '=' + (item.value | string)) in collector_env.value + loop: "{{ collector_reg_values | dict2items }}" diff --git a/deployments/ansible/molecule/with_instrumentation/converge.yml b/deployments/ansible/molecule/with_instrumentation/converge.yml index 7bc4efd75e..2199bf68c3 100644 --- a/deployments/ansible/molecule/with_instrumentation/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation/converge.yml @@ -3,10 +3,11 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true - splunk_otel_auto_instrumentation_version: 0.126.0 + splunk_otel_auto_instrumentation_version: latest splunk_otel_auto_instrumentation_resource_attributes: deployment.environment=test splunk_otel_auto_instrumentation_service_name: test splunk_otel_auto_instrumentation_generate_service_name: false diff --git a/deployments/ansible/molecule/with_instrumentation/verify.yml b/deployments/ansible/molecule/with_instrumentation/verify.yml index eb8248b312..4e0d1bce65 100644 --- a/deployments/ansible/molecule/with_instrumentation/verify.yml +++ b/deployments/ansible/molecule/with_instrumentation/verify.yml @@ -13,6 +13,9 @@ - name: Populate package facts ansible.builtin.package_facts: + - debug: + var: ansible_facts.packages['splunk-otel-auto-instrumentation'][0] + - name: Assert specified version of splunk-otel-auto-instrumentation is installed assert: that: ansible_facts.packages['splunk-otel-auto-instrumentation'][0].version == '0.126.0' diff --git a/deployments/ansible/molecule/with_instrumentation_preload_custom/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_custom/converge.yml index 809f5d733b..01c53e6885 100644 --- a/deployments/ansible/molecule/with_instrumentation_preload_custom/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_preload_custom/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_preload_default/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_default/converge.yml index c960ba956b..46244ce3b4 100644 --- a/deployments/ansible/molecule/with_instrumentation_preload_default/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_preload_default/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_preload_dotnet/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_dotnet/converge.yml index 41fd359f62..b7643fe56c 100644 --- a/deployments/ansible/molecule/with_instrumentation_preload_dotnet/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_preload_dotnet/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_preload_java/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_java/converge.yml index 53300fd583..07b35e8a7e 100644 --- a/deployments/ansible/molecule/with_instrumentation_preload_java/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_preload_java/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_preload_nodejs/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_nodejs/converge.yml index b5dd6182e7..56d9f1268c 100644 --- a/deployments/ansible/molecule/with_instrumentation_preload_nodejs/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_preload_nodejs/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_preload_without_npm/converge.yml b/deployments/ansible/molecule/with_instrumentation_preload_without_npm/converge.yml index 865e54a41c..6afb6aade4 100644 --- a/deployments/ansible/molecule/with_instrumentation_preload_without_npm/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_preload_without_npm/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_custom/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_custom/converge.yml index 90506e4f9c..8d318bb3ec 100644 --- a/deployments/ansible/molecule/with_instrumentation_systemd_custom/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_systemd_custom/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_default/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_default/converge.yml index 768800f016..4bd6a40928 100644 --- a/deployments/ansible/molecule/with_instrumentation_systemd_default/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_systemd_default/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_dotnet/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_dotnet/converge.yml index ff49eecc50..08f7624205 100644 --- a/deployments/ansible/molecule/with_instrumentation_systemd_dotnet/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_systemd_dotnet/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_java/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_java/converge.yml index 7ec86bb4ad..97a47dc3d3 100644 --- a/deployments/ansible/molecule/with_instrumentation_systemd_java/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_systemd_java/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_nodejs/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_nodejs/converge.yml index f43cc5ed65..d9da47c25a 100644 --- a/deployments/ansible/molecule/with_instrumentation_systemd_nodejs/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_systemd_nodejs/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/molecule/with_instrumentation_systemd_without_npm/converge.yml b/deployments/ansible/molecule/with_instrumentation_systemd_without_npm/converge.yml index 72a3142da2..ee584d6e9f 100644 --- a/deployments/ansible/molecule/with_instrumentation_systemd_without_npm/converge.yml +++ b/deployments/ansible/molecule/with_instrumentation_systemd_without_npm/converge.yml @@ -3,6 +3,7 @@ hosts: all become: yes vars: + local_artifact_testing_enabled: true splunk_access_token: fake-token splunk_realm: fake-realm install_splunk_otel_auto_instrumentation: true diff --git a/deployments/ansible/roles/collector/defaults/main.yml b/deployments/ansible/roles/collector/defaults/main.yml index 6a681b37a0..08613c3f33 100644 --- a/deployments/ansible/roles/collector/defaults/main.yml +++ b/deployments/ansible/roles/collector/defaults/main.yml @@ -101,3 +101,7 @@ splunk_dotnet_auto_instrumentation_enable_profiler: false splunk_dotnet_auto_instrumentation_enable_profiler_memory: false splunk_dotnet_auto_instrumentation_iisreset: true splunk_dotnet_auto_instrumentation_additional_options: {} + +# Variables to be used only for testing +# Used to test locally built artifacts instead of remotely downloaded version. Overrides splunk_otel_collector_version. +local_artifact_testing_enabled: false diff --git a/deployments/ansible/roles/collector/tasks/apt_install_otel_collector.yml b/deployments/ansible/roles/collector/tasks/apt_install_otel_collector.yml index 1c5225b0fc..9e2bd7e737 100644 --- a/deployments/ansible/roles/collector/tasks/apt_install_otel_collector.yml +++ b/deployments/ansible/roles/collector/tasks/apt_install_otel_collector.yml @@ -6,6 +6,7 @@ name: - apt-transport-https - gnupg + - xz-utils state: present update_cache: yes @@ -31,3 +32,19 @@ notify: - "restart splunk-otel-collector" - "restart td-agent" + when: not local_artifact_testing_enabled + +- name: Copy Splunk OpenTelemetry Collector DEB artifact to remote machine + ansible.builtin.copy: + src: /tmp/deb-{% if ansible_architecture == 'aarch64' %}arm64{% else %}amd64{% endif %}-package + dest: /etc/otel/ + register: archive_contents + when: local_artifact_testing_enabled + +- name: Install Splunk OpenTelemetry Collector via local DEB artifact + ansible.builtin.apt: + deb: "{{ archive_contents.dest }}" + notify: + - "restart splunk-otel-collector" + - "restart td-agent" + when: local_artifact_testing_enabled diff --git a/deployments/ansible/roles/collector/tasks/linux_auto_instrumentation.yml b/deployments/ansible/roles/collector/tasks/linux_auto_instrumentation.yml index 17e49d6208..dd67a41bef 100644 --- a/deployments/ansible/roles/collector/tasks/linux_auto_instrumentation.yml +++ b/deployments/ansible/roles/collector/tasks/linux_auto_instrumentation.yml @@ -33,7 +33,7 @@ and auto_instrumentation_version is version('0.87.0', '>=') }}" with_dotnet: "{{ 'dotnet' in (splunk_otel_auto_instrumentation_sdks | default([])) \ and auto_instrumentation_version is version('0.99.0', '>=') \ - and ansible_architecture in ('x86_64', 'amd64', 'arm64') }}" + and ansible_architecture in ('x86_64', 'amd64', 'aarch64') }}" - name: Check for npm shell: npm --version diff --git a/deployments/ansible/roles/collector/tasks/yum_install_otel_collector.yml b/deployments/ansible/roles/collector/tasks/yum_install_otel_collector.yml index c8b1afadc1..48fe4eaf97 100644 --- a/deployments/ansible/roles/collector/tasks/yum_install_otel_collector.yml +++ b/deployments/ansible/roles/collector/tasks/yum_install_otel_collector.yml @@ -27,3 +27,20 @@ notify: - "restart splunk-otel-collector" - "restart td-agent" + when: not local_artifact_testing_enabled + +- name: Copy Splunk OpenTelemetry Collector RPM artifact to remote machine + ansible.builtin.copy: + src: /tmp/rpm-{% if ansible_architecture == 'aarch64' %}arm64{% else %}amd64{% endif %}-package + dest: /etc/otel + register: archive_contents + when: local_artifact_testing_enabled + +- name: Install Splunk OpenTelemetry Collector via local RPM artifact + ansible.builtin.yum: + name: "{{ archive_contents.dest }}" + disable_gpg_check: true + notify: + - "restart splunk-otel-collector" + - "restart td-agent" + when: local_artifact_testing_enabled diff --git a/deployments/ansible/roles/collector/tasks/zypper_install_otel_collector.yml b/deployments/ansible/roles/collector/tasks/zypper_install_otel_collector.yml index 3ef91fc515..1a1c914579 100644 --- a/deployments/ansible/roles/collector/tasks/zypper_install_otel_collector.yml +++ b/deployments/ansible/roles/collector/tasks/zypper_install_otel_collector.yml @@ -28,3 +28,19 @@ update_cache: yes notify: - "restart splunk-otel-collector" + when: not local_artifact_testing_enabled + +- name: Copy Splunk OpenTelemetry Collector RPM artifact to remote machine + ansible.builtin.copy: + src: /tmp/rpm-{% if ansible_architecture == 'aarch64' %}arm64{% else %}amd64{% endif %}-package + dest: /etc/otel/ + register: archive_contents + when: local_artifact_testing_enabled + +- name: Install Splunk OpenTelemetry Collector via local RPM artifact + community.general.zypper: + name: "{{ archive_contents.dest }}" + disable_gpg_check: true + notify: + - "restart splunk-otel-collector" + when: local_artifact_testing_enabled