-
Notifications
You must be signed in to change notification settings - Fork 166
[chore][ansible] Update linux tests to use locally built artifact #6284
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
base: main
Are you sure you want to change the base?
Changes from 28 commits
abc9629
db9ee90
5629283
bd45395
4798a3f
4915914
f9f964a
b4fbab0
e052bbd
55b7f63
2886914
eb55e35
4cdfb47
9f8c649
b6969fb
9e05524
155c47d
1f8c9f8
f03dc7a
3bc254b
43286af
abc41a2
74ecbf6
e35abfe
42278b8
1880baa
e3c3ae7
7654ea1
a784707
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the version check as the local artifact version would need to be parsed from filenames and then set as ansible variables to compare. This seems more complicated than it's worth, but I can the required logic and check if anyone feels strongly. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Everything under
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# no default config provided, make sure to set --base-config molecule argument instead |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added build steps in this workflow are copied from the linux_package_test workflow.