-
-
Notifications
You must be signed in to change notification settings - Fork 88
219 lines (176 loc) · 7.07 KB
/
Copy pathsaltbox.yml
File metadata and controls
219 lines (176 loc) · 7.07 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: CI
on:
push:
branches:
- master
paths-ignore:
- '*.md'
- '.gitignore'
- 'roles/backup/**'
- 'roles/backup2/**'
- 'roles/restore/**'
- 'roles/settings/**'
- 'roles/nvidia/**'
- 'roles/plex_extra_tasks/**'
- 'roles/plex_auth_token/**'
- 'roles/plex_db/**'
- 'roles/arr_db/**'
- 'roles/diag/**'
pull_request:
paths-ignore:
- '*.md'
- '.gitignore'
- 'roles/backup/**'
- 'roles/backup2/**'
- 'roles/restore/**'
- 'roles/settings/**'
- 'roles/nvidia/**'
- 'roles/plex_extra_tasks/**'
- 'roles/plex_auth_token/**'
- 'roles/plex_db/**'
- 'roles/arr_db/**'
- 'roles/diag/**'
workflow_dispatch:
jobs:
python-environment:
name: 'Python environment-${{ matrix.os }}'
runs-on: ubuntu-${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['22.04', '24.04', '26.04']
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-saltbox-uv
- name: Install source-build prerequisites
run: sudo apt-get update && sudo apt-get install -y build-essential libffi-dev
- name: Validate locked Python environment
run: .github/scripts/check-python-environment.sh
ansible-lint:
if: github.event_name == 'pull_request' || !(github.event_name == 'push' && github.actor == 'renovate[bot]')
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-saltbox-uv
- name: Install packages
run: |
uv python install --managed-python --no-bin "$(< .python-version)"
uv venv --python "$(< .python-version)" --managed-python --no-project .venv
uv pip sync --python .venv/bin/python --require-hashes requirements/requirements-saltbox.txt
venv_bin=$(readlink -f .venv/bin)
echo "$venv_bin" >> "$GITHUB_PATH"
- name: Run ansible linter
working-directory: ${{ github.workspace }}
run: ansible-lint
- id: set-matrix
run: |
matrix=$(.venv/bin/python .github/scripts/ci-role-matrix.py)
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
saltbox-lint:
if: github.event_name == 'pull_request' || !(github.event_name == 'push' && github.actor == 'renovate[bot]')
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.14'
- name: Test Saltbox facts persistence
run: python3 .github/scripts/test_saltbox_facts.py
- name: Run Saltbox Linter
run: python3 scripts/saltbox-linter.py .
install:
name: '${{ matrix.roles }}'
runs-on: ubuntu-24.04
needs: [ansible-lint, saltbox-lint, python-environment]
strategy:
matrix: ${{ fromJson(needs.ansible-lint.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v7
- name: Tune GitHub-hosted runner network
run: sudo ethtool -K eth0 tx off rx off
- name: Print pip dependencies
run: cat ./requirements/requirements-saltbox.txt
- name: Install sb binary
uses: jaxxstorm/action-install-gh-release@v3.0.0
with:
repo: saltyorg/sb-go
tag: latest
extension-matching: disable
platform: linux
arch: amd64
rename-to: sb
chmod: "0755"
- name: Check sb version
run: |
sudo mv /opt/hostedtoolcache/saltyorg/sb-go/latest/linux-amd64/sb /usr/local/bin/sb
/usr/local/bin/sb version
- name: Create Directories
run: sudo mkdir -p /srv/git
- name: Chown /srv/git
run: sudo chown -R runner:runner /srv/git
- name: Symlink cloned repository to /srv/git/saltbox
run: ln -s $GITHUB_WORKSPACE /srv/git/saltbox
- name: Install Dependencies
run: /usr/local/bin/sb gha && /srv/ansible/venv/bin/ansible --version
- name: Print installed pip packages
run: /usr/local/bin/uv pip freeze --python /srv/ansible/venv/bin/python
- name: Edit accounts.yml
run: sed -i 's/seed/runner/g' accounts.yml
- name: Run Tree on Saltbox repository
run: tree -a
- name: Syntax Check
run: sudo /srv/ansible/venv/bin/ansible-playbook saltbox.yml --syntax-check
- name: Create basic vars file
run: |
echo "continuous_integration: true" > vars.yml
echo "server_appdata_path: /opt2" >> vars.yml
sudo mkdir -p /opt2
- name: Add Docker Hub info to vars file
if: github.repository == 'saltyorg/Saltbox' && github.event.repository.fork == false
run: |
echo "dockerhub:" >> vars.yml
echo " token: ${{ secrets.DOCKERHUB_TOKEN }}" >> vars.yml
echo " user: ${{ secrets.DOCKERHUB_USERNAME }}" >> vars.yml
- name: Install Saltbox Preinstall
run: sudo /srv/ansible/venv/bin/ansible-playbook saltbox.yml --tags "preinstall" --skip-tags "settings" --extra-vars "@vars.yml"
- name: Install Saltbox Core
run: sudo /srv/ansible/venv/bin/ansible-playbook saltbox.yml --tags "core" --skip-tags "settings" --extra-vars "@vars.yml"
if: ${{ !(contains(matrix.roles, 'saltbox') || contains(matrix.roles, 'feederbox') || contains(matrix.roles, 'mediabox') || contains(matrix.roles, 'core')) }}
- name: Install ${{ matrix.roles }}
run: sudo /srv/ansible/venv/bin/ansible-playbook saltbox.yml --tags "${{ matrix.roles }}" --skip-tags "settings" --extra-vars "@vars.yml"
- name: Run Tree on app data folder
run: sudo tree -aug /opt2
- name: Inspect all Docker containers
run: |
echo "=== Inspecting all Docker containers ==="
# Get list of all containers (running and stopped)
ALL_CONTAINERS=$(docker ps -a -q)
if [ -z "$ALL_CONTAINERS" ]; then
echo "No containers found on this system"
exit 0
fi
echo "Found containers: $ALL_CONTAINERS"
echo ""
# Loop through each container and inspect it
for container_id in $ALL_CONTAINERS; do
echo "========================================="
echo "Inspecting container: $container_id"
echo "========================================="
# Get container name and status for better readability
CONTAINER_NAME=$(docker inspect --format='{{.Name}}' $container_id | sed 's/^\///')
CONTAINER_STATUS=$(docker inspect --format='{{.State.Status}}' $container_id)
echo "Container Name: $CONTAINER_NAME"
echo "Container Status: $CONTAINER_STATUS"
echo ""
echo "Full inspection details:"
echo "----------------------------------------"
# Print full inspection details
docker inspect $container_id
echo ""
echo "========================================="
echo ""
done
echo "=== Container inspection completed ==="