Skip to content

Commit

Permalink
chore: Add create log artifacts when e2e test fails
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Paschenko <[email protected]>
  • Loading branch information
Steamvis committed Jan 17, 2025
1 parent 7b38556 commit 4cf1d59
Show file tree
Hide file tree
Showing 11 changed files with 2,205 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/ci_templates/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,42 @@ check_e2e_labels:
INITIAL_IMAGE_TAG: ${{ steps.setup.outputs.initial-image-tag }}
{!{- tmpl.Exec "e2e_run_template" (slice .provider "run-test" (coll.Has $ctx "manualRun") ) | strings.Indent 6 }!}

################################################### Collect logs when e2e failed ###########################
{!{- if coll.Has $ctx "manualRun" }!}
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: {!{ $ctx.providerName }!}
LAYOUT: {!{ $ctx.layout }!}
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: {!{ index (ds "actions") "actions/upload-artifact" }!}
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
{!{- end }!}
################################################### Collect logs when e2e failed ###########################

{!{- if coll.Has $ctx "manualRun" }!}
- name: Read connection string
if: ${{ failure() || cancelled() }}
Expand Down
238 changes: 238 additions & 0 deletions .github/workflows/e2e-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,40 @@ jobs:
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>

################################################### Collect logs when e2e failed ###########################
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: AWS
LAYOUT: WithoutNAT
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: actions/[email protected]
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
################################################### Collect logs when e2e failed ###########################
- name: Read connection string
if: ${{ failure() || cancelled() }}
id: check_stay_failed_cluster
Expand Down Expand Up @@ -1024,6 +1058,40 @@ jobs:
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>

################################################### Collect logs when e2e failed ###########################
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: AWS
LAYOUT: WithoutNAT
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: actions/[email protected]
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
################################################### Collect logs when e2e failed ###########################
- name: Read connection string
if: ${{ failure() || cancelled() }}
id: check_stay_failed_cluster
Expand Down Expand Up @@ -1519,6 +1587,40 @@ jobs:
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>

################################################### Collect logs when e2e failed ###########################
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: AWS
LAYOUT: WithoutNAT
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: actions/[email protected]
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
################################################### Collect logs when e2e failed ###########################
- name: Read connection string
if: ${{ failure() || cancelled() }}
id: check_stay_failed_cluster
Expand Down Expand Up @@ -2014,6 +2116,40 @@ jobs:
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>

################################################### Collect logs when e2e failed ###########################
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: AWS
LAYOUT: WithoutNAT
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: actions/[email protected]
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
################################################### Collect logs when e2e failed ###########################
- name: Read connection string
if: ${{ failure() || cancelled() }}
id: check_stay_failed_cluster
Expand Down Expand Up @@ -2509,6 +2645,40 @@ jobs:
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>

################################################### Collect logs when e2e failed ###########################
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: AWS
LAYOUT: WithoutNAT
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: actions/[email protected]
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
################################################### Collect logs when e2e failed ###########################
- name: Read connection string
if: ${{ failure() || cancelled() }}
id: check_stay_failed_cluster
Expand Down Expand Up @@ -3004,6 +3174,40 @@ jobs:
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>

################################################### Collect logs when e2e failed ###########################
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: AWS
LAYOUT: WithoutNAT
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: actions/[email protected]
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
################################################### Collect logs when e2e failed ###########################
- name: Read connection string
if: ${{ failure() || cancelled() }}
id: check_stay_failed_cluster
Expand Down Expand Up @@ -3499,6 +3703,40 @@ jobs:
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>

################################################### Collect logs when e2e failed ###########################
- name: "Create log artifacts archive"
id: create_e2e_tests_logs
if: always()
env:
PROVIDER: AWS
LAYOUT: WithoutNAT
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY }}
SSH_CONNECT_STR_FILE: ${{ steps.e2e_test_run.outputs.ssh_connection_str_file }}
run: |
ssh_private_key_path="/tmp/sshkey"
rm -f "$ssh_private_key_path"
base64 -d <<< "$LAYOUT_SSH_KEY" > "$ssh_private_key_path"
chmod 0600 "$ssh_private_key_path"
eval $(ssh-agent)
ssh-add $ssh_private_key_path
ssh $(cat ${{ env.SSH_CONNECT_STR_FILE }}) -t 'sudo su - -c "kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse \
-- deckhouse-controller collect-debug-info \
> /tmp/deckhouse-debug.tar.gz"'
scp $(cat ${{ env.SSH_CONNECT_STR_FILE }}):/tmp/deckhouse-debug.tar-gz /tmp/deckhouse-debug.tar-gz
- name: "Upload log artifacts archive"
id: upload_e2e_tests_logs
if: failure() || cancelled()
uses: actions/[email protected]
with:
name: deckhouse-debug
path: /tmp/deckhouse-debug.tar-gz
retention-days: 7
compression-level: 9
################################################### Collect logs when e2e failed ###########################
- name: Read connection string
if: ${{ failure() || cancelled() }}
id: check_stay_failed_cluster
Expand Down
Loading

0 comments on commit 4cf1d59

Please sign in to comment.