Skip to content

Add docker-compose/ test stacks and CI workflows for cs24/cs26 #1

Add docker-compose/ test stacks and CI workflows for cs24/cs26

Add docker-compose/ test stacks and CI workflows for cs24/cs26 #1

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Test cs24 (mariadb-cluster + cloudstack-management ubuntu24)
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
COMPOSE_FILE: docker-compose/docker-compose-cs24.yaml
COMPOSE_PROJECT_NAME: cs24
jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Start MariaDB Galera cluster
run: docker compose up -d db01 db02 db03 dbvip
- name: Wait for the MariaDB cluster to sync (3 nodes)
run: |
for node in db01 db02 db03; do
echo "waiting for $node to sync..."
for i in $(seq 1 60); do
status=$(docker compose exec -T "$node" mysql -uroot -pcloudstack -NB \
-e "show status where variable_name='wsrep_local_state_comment'" 2>/dev/null | awk '{print $2}')
[ "$status" = "Synced" ] && { echo "$node: Synced"; break; }
sleep 5
if [ "$i" = 60 ]; then echo "$node did not sync in time" >&2; exit 1; fi
done
done
- name: Start cloudstack-management container
run: docker compose up -d mgt01
- name: Wait for systemd to be up inside mgt01
run: |
for i in $(seq 1 30); do
state=$(docker compose exec -T mgt01 systemctl is-system-running 2>/dev/null || true)
echo "systemd state: $state"
case "$state" in running|degraded) exit 0;; esac
sleep 2
if [ "$i" = 30 ]; then echo "systemd did not come up in time" >&2; exit 1; fi
done
- name: Check cloudstack-management service status (pre-setup, expected inactive/failed)
run: docker compose exec -T mgt01 systemctl status cloudstack-management --no-pager || true
- name: Stop cloudstack-management/usage before database setup
run: docker compose exec -T mgt01 systemctl stop cloudstack-management cloudstack-usage
- name: Setup CloudStack database
run: |
docker compose exec -T mgt01 cloudstack-setup-databases cloud:cloud@dbvip:3306 \
--deploy-as=root:cloudstack -e file -m mgtkey -k dbkey -i mgt01
- name: Start cloudstack-management
run: docker compose exec -T mgt01 systemctl start cloudstack-management
- name: Check cloudstack-management service status
run: |
docker compose exec -T mgt01 systemctl status cloudstack-management --no-pager
docker compose exec -T mgt01 systemctl is-active cloudstack-management
- name: Wait until the management server is up (cmk list users)
run: |
docker compose exec -T mgt01 bash -c '
cmk set url http://localhost:8080/client/api
cmk set username admin
cmk set password password
'
for i in $(seq 1 180); do
if docker compose exec -T mgt01 cmk list users >/tmp/cmk-out.json 2>/tmp/cmk-err.log; then
echo "management server is up:"
cat /tmp/cmk-out.json
exit 0
fi
echo "not up yet (attempt $i)..."
cat /tmp/cmk-err.log || true
sleep 10
done
echo "management server did not come up in time" >&2
exit 1
- name: Show cloudstack-management logs on failure
if: failure()
run: |
docker compose exec -T mgt01 tail -n 200 /var/log/cloudstack/management/management-server.log || true
- name: Clean up
if: always()
run: docker compose down -v