Skip to content

chore: synced file(s) with cds-snc/site-reliability-engineering #894

chore: synced file(s) with cds-snc/site-reliability-engineering

chore: synced file(s) with cds-snc/site-reliability-engineering #894

name: Test forward github action data to Sentinel
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
generate-data-from-another-action:
runs-on: ubuntu-latest
outputs:
file_name: ${{ steps.step1.outputs.file_name}}
output_data: ${{ steps.step2.outputs.input_data}}
log_type: ${{ steps.step3.outputs.log_type}}
steps:
- id: step1
run: echo "file_name=/app/src/tests/data/test_file.txt" >> $GITHUB_OUTPUT
- id: step2
run: echo "input_data=Sample output that is to be sent to Sentinel" >> $GITHUB_OUTPUT
- id: step3
run: echo "log_type=TestGithubAction_CL" >> $GITHUB_OUTPUT
send-data-to-sentinel:
runs-on: ubuntu-latest
needs: generate-data-from-another-action
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Test chained actions
id: selftest
uses: ./
with:
file_name: ${{ needs.generate-data-from-another-action.outputs.file_name }}
input_data: ${{ needs.generate-data-from-another-action.outputs.output_data }}
log_type: ${{ needs.generate-data-from-another-action.outputs.log_type}}
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
send-data-to-sentinel_json:
runs-on: ubuntu-latest
needs: [generate-data-from-another-action, send-data-to-sentinel]
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Test action sending .json file on 1 line
id: selftest_json
uses: ./
with:
file_name: "/app/src/tests/data/test_file.json"
log_type: ${{ needs.generate-data-from-another-action.outputs.log_type}}
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
send-data-to-sentinel_json_multiline:
runs-on: ubuntu-latest
needs: [generate-data-from-another-action, send-data-to-sentinel_json]
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Test action sending .json on multiple lines
id: selftest_json_multiline
uses: ./
with:
file_name: /app/src/tests/data/test_file_muline.json
log_type: ${{ needs.generate-data-from-another-action.outputs.log_type}}
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
send-data-to-sentinel_jsonl:
runs-on: ubuntu-latest
needs: [generate-data-from-another-action, send-data-to-sentinel_json_multiline]
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Test action sending .jsonl
id: selftest_jsonl
uses: ./
with:
file_name: "/app/src/tests/data/test_file.jsonl"
log_type: ${{ needs.generate-data-from-another-action.outputs.log_type}}
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}