forked from gnuoy/snap-openstack
-
Notifications
You must be signed in to change notification settings - Fork 16
160 lines (155 loc) · 6.59 KB
/
test-snap.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Test snap from the store
on:
workflow_dispatch:
inputs:
snap-channel:
description: Specify openstack snap channel
required: true
default: 2024.1/candidate
type: string
os-charm-channel:
description: Specify openstack charms channel
required: true
default: 2024.1/candidate
type: string
ovn-charm-channel:
description: Specify ovn charms channel
required: true
default: 24.03/candidate
type: string
microceph-charm-channel:
description: Specify microceph charms channel
required: true
default: reef/candidate
type: string
microceph-snap-channel:
description: Specify microceph snap channel
required: true
default: reef/candidate
type: string
rabbitmq-charm-channel:
description: Specify rabbitmq charms channel
required: true
default: 3.12/candidate
type: string
mysql-charm-channel:
description: Specify mysql charms channel
required: true
default: 8.0/candidate
type: string
mysql-router-charm-channel:
description: Specify mysql-router charms channel
required: true
default: 8.0/candidate
type: string
multi-mysql:
description: Specify if multi-mysql is enabled
required: true
default: single
type: choice
options:
- single
- multi
k8s-provider:
description: Select k8s provider
required: true
default: microk8s
type: choice
options:
- microk8s
- k8s
jobs:
functional-test:
name: Functional test
runs-on: [self-hosted, large, jammy, x64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: test
run: |
export COLUMNS=256
set +x
# 2023.x, 2024.1/beta does not support k8s provider
if [ ! ${{ inputs.snap-channel }} =~ "2024.1/edge" && ${{ inputs.k8s-provider }} == "k8s" ]; then echo "k8s provider not supported"; exit 1; fi
sudo snap install openstack --channel ${{ inputs.snap-channel }}
sudo snap set openstack k8s.provider=${{ inputs.k8s-provider }}
# New manifest is applicable from 2024.1/edge
# Change this condition once 2024.1/edge is released to beta
if [ ${{ inputs.snap-channel }} =~ "2024.1/edge" ];
then
cp .github/assets/testing/manifest.yml manifest.yml
else
cp .github/assets/testing/manifest_2023.x.yml manifest.yml
fi
sed -i 's|OS_CHARM|${{ inputs.os-charm-channel }}|' manifest.yml
sed -i 's|OVN_CHARM|${{ inputs.ovn-charm-channel }}|' manifest.yml
sed -i 's|MICROCEPH_CHARM|${{ inputs.microceph-charm-channel }}|' manifest.yml
sed -i 's|MICROCEPH_SNAP|${{ inputs.microceph-snap-channel }}|' manifest.yml
sed -i 's|RABBITMQ_CHARM|${{ inputs.rabbitmq-charm-channel }}|' manifest.yml
sed -i 's|MYSQL_CHARM|${{ inputs.mysql-charm-channel }}|' manifest.yml
sed -i 's|MYSQL_ROUTER_CHARM|${{ inputs.mysql-router-charm-channel }}|' manifest.yml
echo "Manifest used:"
cat manifest.yml
sunbeam prepare-node-script | bash -x
sg snap_daemon "sunbeam cluster bootstrap --manifest ./manifest.yml --accept-defaults --topology single --database ${{ inputs.multi-mysql }}"
sg snap_daemon "sunbeam cluster list"
# Note: Moving configure before enabling caas just to ensure caas images are not downloaded
# To download caas image, require ports to open on firewall to access fedora images.
sg snap_daemon "sunbeam configure -a"
sg snap_daemon "sunbeam launch"
sg snap_daemon "sunbeam enable orchestration"
sg snap_daemon "sunbeam enable loadbalancer"
sg snap_daemon "sunbeam enable dns --nameservers=testing.github."
sg snap_daemon "sunbeam enable telemetry"
sg snap_daemon "sunbeam enable observability"
sg snap_daemon "sunbeam enable vault"
sg snap_daemon "sunbeam enable secrets"
sg snap_daemon "sunbeam enable caas"
# disable images-sync, not in 2023.2
# sg snap_daemon "sunbeam enable images-sync"
# sg snap_daemon "sunbeam enable resource-optimization"
# sg snap_daemon "sunbeam enable validation"
# If smoke tests fails, logs should be collected via sunbeam command in "Collect logs"
# sg snap_daemon "sunbeam validation run smoke"
# sg snap_daemon "sunbeam validation run --output tempest_validation.log"
# sg snap_daemon "sunbeam disable resource-optimization"
# sg snap_daemon "sunbeam disable images-sync"
sg snap_daemon "sunbeam disable caas"
sg snap_daemon "sunbeam disable secrets"
sg snap_daemon "sunbeam disable vault"
# Commented disabling observability due to LP#1998282
# sg snap_daemon "sunbeam disable observability"
# sg snap_daemon "sunbeam disable telemetry"
sg snap_daemon "sunbeam disable dns"
sg snap_daemon "sunbeam disable loadbalancer"
sg snap_daemon "sunbeam disable orchestration"
# sg snap_daemon "sunbeam disable validation"
- name: Collect logs
if: always()
run: |
mkdir -p logs
if [ ${{ inputs.k8s-provider }} == "k8s" ]; then kubectl="k8s kubectl"; else kubectl="microk8s.kubectl"; fi
cp -rf $HOME/snap/openstack/common/logs/*.log logs/
models=$(juju models --format json | jq -r .models[].name)
for model in $models;
do
name=$(echo $model | cut -d/ -f2);
juju status -m $model -o logs/$name.yaml;
cat logs/$name.yaml;
juju debug-log -m $model --replay &> logs/$name-debug-log.txt || echo "Not able to get logs for model $model"
for pod in $(sudo $kubectl get pods -n $name -o=jsonpath='{.items[*].metadata.name}');
do
sudo $kubectl logs --ignore-errors -n $name --all-containers $pod &> logs/$pod.log || echo "Not able to get log for $pod"
done
done
# if test -f tempest_validation.log; then cp tempest_validation.log logs/; fi
- name: Upload logs
if: always()
uses: actions/upload-artifact@v3
with:
name: sunbeam_logs
path: logs
retention-days: 30
- name: Setup tmate session
if: ${{ failure() && runner.debug }}
uses: canonical/action-tmate@main