Skip to content

Commit e1bf271

Browse files
Update ci-main.yaml
1 parent 2a10e2a commit e1bf271

File tree

1 file changed

+19
-50
lines changed

1 file changed

+19
-50
lines changed

.github/workflows/ci-main.yaml

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -284,19 +284,19 @@ jobs:
284284
test-name-cache:
285285
strategy:
286286
matrix:
287-
deployment_type: ["docker", "podman"]
288287
SC4S_IPV6_ENABLE: ["yes","no"]
289288
runs-on: ubuntu-latest
290-
continue-on-error: true
291289
needs:
292290
- meta
293291
- build_action
294-
292+
# runs all of the steps inside the specified container rather than on the VM host.
293+
# Because of this the network configuration changes from host based network to a container network.
294+
container:
295+
image: python:3.9-buster
295296
services:
296297
splunk:
297298
image: splunk/splunk:${{ fromJson(needs.meta.outputs.matrix_supportedSplunk)[0].version }}
298299
ports:
299-
- 8000:8000
300300
- 8088:8088
301301
- 8089:8089
302302
env:
@@ -305,55 +305,24 @@ jobs:
305305
SPLUNK_START_ARGS: --accept-license
306306
SPLUNK_APPS_URL: https://github.com/splunk/splunk-configurations-base-indexes/releases/download/v1.0.0/splunk_configurations_base_indexes-1.0.0.tar.gz
307307

308+
sc4s:
309+
image: ${{ needs.meta.outputs.container_base }}
310+
ports:
311+
- 514:514
312+
env:
313+
SC4S_DEST_SPLUNK_HEC_DEFAULT_URL: https://splunk:8088
314+
SC4S_DEST_SPLUNK_HEC_DEFAULT_TOKEN: 70b6ae71-76b3-4c38-9597-0c5b37ad9630
315+
SC4S_DEST_SPLUNK_HEC_DEFAULT_TLS_VERIFY: "no"
316+
SC4S_USE_NAME_CACHE: "yes"
317+
SC4S_CLEAR_NAME_CACHE: "yes"
318+
SC4S_IPV6_ENABLE: "${{ matrix.SC4S_IPV6_ENABLE }}"
319+
308320
steps:
309321
- name: Checkout
310322
uses: actions/checkout@v4
311323
with:
312324
submodules: false
313325
persist-credentials: false
314-
- name: Install Ansible and other dependencies as python package
315-
run: |
316-
pip install ansible~=6.1.0 --no-cache-dir \
317-
&& pip install pywinrm>=0.4.2 --no-cache-dir \
318-
&& pip install ansible-lint>=6.0.0 --no-cache-dir \
319-
&& pip install docker
320-
- name: Configure Ansible Environment Variables
321-
env:
322-
ANSIBLE_CONFIG: ansible.cfg
323-
ANSIBLE_HOST_KEY_CHECKING: False
324-
run: |
325-
echo "ANSIBLE_CONFIG is set to: $ANSIBLE_CONFIG"
326-
echo "ANSIBLE_HOST_KEY_CHECKING is set to: $ANSIBLE_HOST_KEY_CHECKING"
327-
sudo systemctl set-environment SC4S_IMAGE=${{ needs.meta.outputs.container_base }}
328-
- name: Update inventory file
329-
run: |
330-
cat << EOF > ansible/inventory/inventory.yaml
331-
---
332-
all:
333-
hosts:
334-
children:
335-
node:
336-
hosts:
337-
node_1:
338-
ansible_host: 127.0.0.1
339-
ansible_connection: local
340-
ansible_user: root
341-
- name: Update env_file
342-
run: |
343-
echo "Updating ansible/inventory/inventory.yaml"
344-
cat << EOF > ansible/resources/env_file
345-
SC4S_DEST_SPLUNK_HEC_DEFAULT_URL=https://127.0.0.1:8088
346-
SC4S_DEST_SPLUNK_HEC_DEFAULT_TOKEN=70b6ae71-76b3-4c38-9597-0c5b37ad9630
347-
SC4S_DEST_SPLUNK_HEC_DEFAULT_TLS_VERIFY=no
348-
SC4S_USE_NAME_CACHE=yes
349-
SC4S_CLEAR_NAME_CACHE=yes
350-
SC4S_IPV6_ENABLE=${{ matrix.SC4S_IPV6_ENABLE }}
351-
- name: Update current SC4S image in unit file
352-
run: |
353-
sed -i 's|Environment="SC4S_IMAGE=ghcr.io/splunk/splunk-connect-for-syslog/container3:latest"|Environment="SC4S_IMAGE=${{ needs.meta.outputs.container_base }}"|' ansible/resources/${{ matrix.deployment_type }}_sc4s.service
354-
- name: Run Ansible Playbook
355-
run: |
356-
ansible-playbook --connection=local -i ansible/inventory/inventory.yaml ansible/playbooks/${{ matrix.deployment_type }}.yml
357326
- name: Run tests
358327
run: |
359328
pip3 install poetry
@@ -362,15 +331,15 @@ jobs:
362331
poetry run pytest -v --tb=long \
363332
--splunk_type=external \
364333
--splunk_hec_token=70b6ae71-76b3-4c38-9597-0c5b37ad9630 \
365-
--splunk_host=127.0.0.1 \
366-
--sc4s_host=127.0.0.1 \
334+
--splunk_host=splunk \
335+
--sc4s_host=sc4s \
367336
--junitxml=test-results/test.xml \
368337
-n 1 \
369338
-m 'name_cache'
370339
- name: artifact-test-results
371340
uses: actions/upload-artifact@v4
372341
with:
373-
name: test-name-cache-results_${{ matrix.deployment_type }}_IPv6_${{ matrix.SC4S_IPV6_ENABLE }}.xml
342+
name: test-name-cache-results_IPv6_${{ matrix.SC4S_IPV6_ENABLE }}.xml
374343
path: test-results/test.xml
375344
if: ${{ !cancelled() }}
376345

0 commit comments

Comments
 (0)