Skip to content

Commit 664d98a

Browse files
authored
[TO-245] Handle Juju Crashdump Artifact in Spread (#491)
* Create crashdump on errors * Deliberately break integration task * Sanitize artifact paths * Run path sanitization on failure * Move charmcraft log upload to charm job * Revert deliberately breaking integration test
1 parent 1a08241 commit 664d98a

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

.github/workflows/charm_integration_test.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ jobs:
7676
name: ${{ matrix.charm }}-charm
7777
path: "${{ matrix.charm }}/charm/*.charm"
7878

79+
- name: Upload charmcraft logs
80+
if: failure()
81+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
82+
with:
83+
name: charmcraft-logs-spread-integration
84+
path: /home/ubuntu/.local/state/charmcraft/log/*
85+
7986
integration-test:
8087
name: Spread Integration Test
8188
runs-on: ubuntu-24.04
@@ -111,21 +118,25 @@ jobs:
111118
- name: Install spread
112119
run: |
113120
go install github.com/snapcore/spread/cmd/spread@latest
114-
121+
115122
- name: Run integration tests
116123
run: |
117124
spread -v -artifacts=./artifacts localhost
118125
119-
- name: Upload charmcraft logs
126+
- name: Sanitize Artifacts Paths
120127
if: failure()
121-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
122-
with:
123-
name: charmcraft-logs-spread-integration
124-
path: /home/ubuntu/.local/state/charmcraft/log/*
128+
run: |
129+
# When using spread -artifacts=<path/to/artifacts>,
130+
# artifacts are generated with paths in the form <backend>:<system>:<suite>/task/artifact
131+
# The upload-artifact action does not allow ':' in paths, so we need to sanitize them
132+
for ARTIFACT_PATH in $(ls -1 ./artifacts/); do
133+
SANITIZED_PATH=$(echo "${ARTIFACT_PATH}" | tr ':' '-')
134+
mv "artifacts/${ARTIFACT_PATH}" "artifacts/${SANITIZED_PATH}"
135+
done
125136
126137
- name: Upload spread artifacts
127138
if: failure()
128139
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
129140
with:
130141
name: spread-artifacts
131-
path: ./artifacts
142+
path: ./artifacts/

spread.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ exclude:
119119
- .venv
120120

121121
environment:
122+
CI: "$(HOST: echo $CI)"
122123
CONCIERGE_JUJU_CHANNEL: 3.6/stable
123124

124125
prepare: |

spread/integration/task.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ execute: |
2222
--resource frontend-image="${frontend_oci_image}"
2323
juju relate backend frontend
2424
25-
juju wait-for application backend --timeout=5m
26-
juju show-status-log backend/0
25+
if ! juju wait-for application backend --timeout=5m; then
26+
microk8s config > kube-config
27+
pipx run --spec git+https://github.com/canonical/juju-k8s-crashdump.git juju-k8s-crashdump \
28+
./kube-config concierge-microk8s -o juju-k8s-crashdump.tar.gz
29+
exit 1
30+
fi
2731
28-
juju wait-for application frontend --timeout=5m
29-
juju show-status-log frontend/0
32+
if ! juju wait-for application frontend --timeout=5m; then
33+
microk8s config > kube-config
34+
pipx run --spec git+https://github.com/canonical/juju-k8s-crashdump.git juju-k8s-crashdump \
35+
./kube-config concierge-microk8s -o juju-k8s-crashdump.tar.gz
36+
exit 1
37+
fi
3038
3139
juju run backend/leader add-user launchpad-email=solutions-qa@lists.canonical.com
3240
@@ -38,11 +46,8 @@ execute: |
3846
"PGPASSWORD=$PGPASSWORD PGHOST=$PGHOST PGUSER=$PGUSER PGDATABASE=$PGDATABASE psql -c \"select launchpad_handle from app_user where email='solutions-qa@lists.canonical.com'\"" \
3947
| grep oil-ci-bot
4048
41-
microk8s config > kube-config
42-
pipx run --spec git+https://github.com/canonical/juju-k8s-crashdump.git juju-k8s-crashdump ./kube-config concierge-microk8s -o integration-juju-k8s-crashdump.tar.gz
43-
4449
artifacts:
45-
- integration-juju-k8s-crashdump.tar.gz
50+
- juju-k8s-crashdump.tar.gz
4651

4752
restore: |
4853
if [[ -z "${CI:-}" ]]; then

0 commit comments

Comments
 (0)