Fine-tuning #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: bbm-deploy | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- ".github/workflows/bbm_deploy.yml" | |
- "autogen/**" | |
- "buildbot.tac" | |
- "common_factories.py" | |
- "constants.py" | |
- "docker-compose/**" | |
- "dockerfiles/**" | |
- "locks.py" | |
- "master-**" | |
- "master.cfg" | |
- "os_info.yaml" | |
- "script_templates/**" | |
- "utils.py" | |
- "validate_master_cfg.sh" | |
pull_request: | |
paths: | |
- ".github/workflows/bbm_deploy.yml" | |
- "autogen/**" | |
- "buildbot.tac" | |
- "common_factories.py" | |
- "constants.py" | |
- "docker-compose/**" | |
- "dockerfiles/**" | |
- "locks.py" | |
- "master-**" | |
- "master.cfg" | |
- "os_info.yaml" | |
- "script_templates/**" | |
- "utils.py" | |
- "validate_master_cfg.sh" | |
jobs: | |
check: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check master.cfg files | |
run: ./validate_master_cfg.sh | |
- name: Check get_ssh_cnx_num.py | |
run: | | |
cd master-libvirt | |
python get_ssh_cnx_num.py | |
deploy: | |
runs-on: ubuntu-22.04 | |
needs: check | |
if: > | |
github.ref == 'refs/heads/dev' && | |
github.repository == 'MariaDB/buildbot' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: prepare | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_ed25519 | |
install -m 600 -D /dev/null ~/.ssh/known_hosts | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" >~/.ssh/id_ed25519 | |
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >~/.ssh/known_hosts | |
- name: shutdown stack | |
run: | | |
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.USER }}@${{ secrets.SERVER_IP }} "if [[ -f /srv/dev/docker-compose/docker-compose.yaml ]]; then docker-compose -f /srv/dev/docker-compose/docker-compose.yaml down; fi" | |
- name: deploy | |
run: | | |
# temporary fix of jade templating | |
sed -i 's#https://ci.mariadb.org#https://ci.dev.mariadb.org#g' master-web/templates/home.jade | |
rsync -a --progress --delete --exclude-from=rsync.exclude -e "ssh -p ${{ secrets.SERVER_PORT }}" ./ ${{ secrets.USER }}@${{ secrets.SERVER_IP }}:/srv/dev/ | |
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.USER }}@${{ secrets.SERVER_IP }} "cd /srv/dev/docker-compose/ && ./generate-config.py --env=dev" | |
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.USER }}@${{ secrets.SERVER_IP }} "cd /srv/dev/ && ./define_masters.py" | |
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.USER }}@${{ secrets.SERVER_IP }} "cd /srv/dev/docker-compose/ && ln -sf .. buildbot" | |
- name: start stack | |
run: | | |
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.USER }}@${{ secrets.SERVER_IP }} "cd /srv/dev/docker-compose && docker-compose pull && docker-compose --env-file .env.dev up -d" | |
- name: clean | |
run: | | |
rm ~/.ssh/id_ed25519 |