Skip to content

Commit

Permalink
archive some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Nov 4, 2024
1 parent 2a77e2e commit 9d49f32
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ jobs:
ansible-playbook playbooks/deploy.yaml
- name: Run tests
run: ./run_tests
- name: Upload logs
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: logs
path: logs.tar.gz
retention-days: 5
8 changes: 8 additions & 0 deletions tests/zzz_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def test_collect_report(host):
host.run('mkdir -p logs')
for container, filename in [('foreman', '/var/log/foreman/production.log')]:
localfile = filename.replace('/', '_')
host.run(f'podman cp {container}:{filename} logs/{container}-{localfile}')
host.run('tar caf logs.tar.gz logs/')
with open('logs.tar.gz', 'wb') as logstar:
logstar.write(host.file('logs.tar.gz').content)

0 comments on commit 9d49f32

Please sign in to comment.