Skip to content

Commit

Permalink
patch(integration_test_charm.yaml): Capture tcpdump to debug GH artif…
Browse files Browse the repository at this point in the history
…acts issue (#229)

GitHub artifacts v4 has intermittent issues:

actions/upload-artifact#560 (comment)

actions/upload-artifact#569 (comment)
actions/download-artifact#338

Capture tcpdump as requested by GitHub Support
  • Loading branch information
carlcsaposs-canonical authored Aug 19, 2024
1 parent e058acc commit 82d1f78
Showing 1 changed file with 82 additions and 1 deletion.
83 changes: 82 additions & 1 deletion .github/workflows/integration_test_charm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
needs:
- collect-integration-tests
runs-on: ${{ matrix.groups.runner || fromJSON(needs.collect-integration-tests.outputs.default_runner) }}
timeout-minutes: 287 # Sum of steps `timeout-minutes` + 5
timeout-minutes: 308 # Sum of steps `timeout-minutes` + 5
steps:
- name: (Data Platform hosted) Write job name to file
# Data Platform hosted
Expand Down Expand Up @@ -420,12 +420,39 @@ jobs:
timeout-minutes: 3
if: ${{ inputs.libjuju-version-constraint }}
run: poetry add --lock --group integration juju@'${{ inputs.libjuju-version-constraint }}'
- name: (artifact debug) start tcpdump capture
timeout-minutes: 1
run: |
touch mycapturefile1.pcap
sudo sysctl net.ipv4.ip_local_port_range
sudo sysctl net.ipv4.tcp_fin_timeout
sudo sysctl net.ipv4.ip_local_port_range="15000 65000"
sudo sysctl net.ipv4.tcp_fin_timeout=120
sudo tcpdump -nn -i any -w mycapturefile1.cap port 443 &
- name: Download packed charm(s)
id: download-charms
timeout-minutes: 5
uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.artifact-prefix }}-*
merge-multiple: true
- name: (artifact debug) stop tcpdump capture
timeout-minutes: 1
if: ${{ !cancelled() }}
run: |
sudo pkill tcpdump
sudo sysctl net.ipv4.ip_local_port_range
sudo sysctl net.ipv4.tcp_fin_timeout
- name: (artifact debug) upload tcpdump capture
timeout-minutes: 5
if: ${{ failure() && steps.download-charms.outcome == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: mycapturefile1.cap
path: mycapturefile1.cap
- name: Select test stability level
timeout-minutes: 1
id: select-test-stability
Expand Down Expand Up @@ -461,14 +488,41 @@ jobs:
run: sg '${{ steps.parse-cloud.outputs.group }}' -c "tox run -e integration -- '${{ matrix.groups.path_to_test_file }}' --group='${{ matrix.groups.group_id }}' -m '${{ steps.select-test-stability.outputs.mark_expression }}' --model test ${{ steps.allure-option.outputs.option }}"
env:
SECRETS_FROM_GITHUB: ${{ secrets.integration-test }}
- name: (artifact debug) start tcpdump capture
timeout-minutes: 1
run: |
touch mycapturefile2.pcap
sudo sysctl net.ipv4.ip_local_port_range
sudo sysctl net.ipv4.tcp_fin_timeout
sudo sysctl net.ipv4.ip_local_port_range="15000 65000"
sudo sysctl net.ipv4.tcp_fin_timeout=120
sudo tcpdump -nn -i any -w mycapturefile2.cap port 443 &
- name: (beta) Upload Allure results
id: upload-allure
timeout-minutes: 3
if: ${{ (success() || (failure() && steps.tests.outcome == 'failure')) && inputs._beta_allure_report && github.event_name == 'schedule' && github.run_attempt == '1' }}
uses: actions/upload-artifact@v4
with:
name: allure-results-integration-test-charm-${{ inputs.cloud }}-juju-${{ inputs.juju-agent-version || steps.parse-versions.outputs.snap_channel_for_artifact }}-${{ inputs.architecture }}-${{ matrix.groups.artifact_group_id }}
path: allure-results/
if-no-files-found: error
- name: (artifact debug) stop tcpdump capture
timeout-minutes: 1
if: ${{ !cancelled() }}
run: |
sudo pkill tcpdump
sudo sysctl net.ipv4.ip_local_port_range
sudo sysctl net.ipv4.tcp_fin_timeout
- name: (artifact debug) upload tcpdump capture
timeout-minutes: 5
if: ${{ failure() && steps.upload-allure.outcome == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: mycapturefile2.cap
path: mycapturefile2.cap
- name: juju status
timeout-minutes: 1
if: ${{ success() || (failure() && steps.tests.outcome == 'failure') }}
Expand All @@ -481,14 +535,41 @@ jobs:
timeout-minutes: 3
if: ${{ success() || (failure() && steps.tests.outcome == 'failure') }}
run: tee-log-for-all-models --log-command 'jhack tail --printer raw --replay --no-watch' --log-file-name jhack-tail.txt
- name: (artifact debug) start tcpdump capture
timeout-minutes: 1
run: |
touch mycapturefile3.pcap
sudo sysctl net.ipv4.ip_local_port_range
sudo sysctl net.ipv4.tcp_fin_timeout
sudo sysctl net.ipv4.ip_local_port_range="15000 65000"
sudo sysctl net.ipv4.tcp_fin_timeout=120
sudo tcpdump -nn -i any -w mycapturefile3.cap port 443 &
- name: Upload logs
id: upload-logs
timeout-minutes: 5
if: ${{ success() || (failure() && steps.tests.outcome == 'failure') }}
uses: actions/upload-artifact@v4
with:
name: logs-integration-test-charm-${{ inputs.cloud }}-juju-${{ inputs.juju-agent-version || steps.parse-versions.outputs.snap_channel_for_artifact }}-${{ inputs.architecture }}-${{ matrix.groups.artifact_group_id }}
path: ~/logs/
if-no-files-found: error
- name: (artifact debug) stop tcpdump capture
timeout-minutes: 1
if: ${{ !cancelled() }}
run: |
sudo pkill tcpdump
sudo sysctl net.ipv4.ip_local_port_range
sudo sysctl net.ipv4.tcp_fin_timeout
- name: (artifact debug) upload tcpdump capture
timeout-minutes: 5
if: ${{ failure() && steps.upload-logs.outcome == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: mycapturefile3.cap
path: mycapturefile3.cap
- name: Disk usage
timeout-minutes: 1
if: ${{ success() || (failure() && steps.tests.outcome == 'failure') }}
Expand Down

0 comments on commit 82d1f78

Please sign in to comment.