Skip to content

Commit

Permalink
Workflow dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fauust committed Oct 9, 2023
1 parent d69846d commit 90c61d4
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 75 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/bbm_build_container.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: bbm build container

name: bbm-build-container

on:
push:
Expand Down Expand Up @@ -32,11 +31,11 @@ jobs:
echo "REPO=bb-master" >>$GITHUB_ENV
- name: Build master image
run: |
podman build . --tag ${{ env.REPO }}:master
podman build . --tag ${{ env.REPO }}:master
- name: Build master-web image
run: |
podman build . --tag ${{ env.REPO }}:master-web \
--build-arg master_type=master-web
podman build . --tag ${{ env.REPO }}:master-web \
--build-arg master_type=master-web
- name: Push images to local registry
run: |
for img in master master-web; do
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/bbm_check_conf.yml

This file was deleted.

60 changes: 38 additions & 22 deletions .github/workflows/deploy.yml → .github/workflows/bbm_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,68 @@
---
name: deploy
name: bbm-deploy

on:
workflow_run:
workflows: ["bbm-check-conf", "pre-commit"]
types: [completed]
push:
paths:
- ".github/workflows/bbm_deploy.yml"
- "autogen/**"
- "builtbot.tac"
- "common_factories.py"
- "constants.py"
- "docker-compose/**"
- "locks.py"
- "master-**"
- "master.cfg"
- "utils.py"
- "validate_master_cfg.sh"
pull_request:
paths:
- ".github/workflows/bbm_deploy.yml"
- "autogen/**"
- "builtbot.tac"
- "common_factories.py"
- "constants.py"
- "docker-compose/**"
- "locks.py"
- "master-**"
- "master.cfg"
- "utils.py"
- "validate_master_cfg.sh"

jobs:
build:
check:
runs-on: ubuntu-latest
name: deploy
steps:
- uses: actions/checkout@v2
- name: Check master.cfg files
run: ./validate_master_cfg.sh

deploy:
runs-on: ubuntu-latest
needs: check
if: >
github.ref == 'refs/heads/dev' &&
github.repository == 'MariaDB/buildbot'
steps:
- uses: actions/checkout@v2
- name: prepare
if: >
github.ref == 'refs/heads/dev' &&
github.repository == 'MariaDB/buildbot'
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
if: >
github.ref == 'refs/heads/dev' &&
github.repository == 'MariaDB/buildbot'
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
if: >
github.ref == 'refs/heads/dev' &&
github.repository == 'MariaDB/buildbot'
run: |
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
if: >
github.ref == 'refs/heads/dev' &&
github.repository == 'MariaDB/buildbot'
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
if: >
always() &&
github.ref == 'refs/heads/dev' &&
github.repository == 'MariaDB/buildbot'
run: |
rm ~/.ssh/id_ed25519
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: bbw container build
name: bbw-build-container

on:
push:
paths:
- .github/workflows/bb_containers.yml
- .github/workflows/bbw_build_container.yml
- "ci_build_images/**"
pull_request:
paths:
- .github/workflows/bb_containers.yml
- .github/workflows/bbw_build_container.yml
- "ci_build_images/**"

jobs:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ TITLE="MariaDB CI"
TITLE_URL=https://github.com/MariaDB/server
BUILDMASTER_URL=https://buildbot.mariadb.org/
MQ_ROUTER_URL=ws://localhost:8085/ws
MASTER_PACKAGES_DIR="/mnt/autofs/master_dev_packages"
MASTER_PACKAGES_DIR="/mnt/autofs/master_packages"
4 changes: 2 additions & 2 deletions master-protected-branches/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ c['workers'].append(worker.DockerLatentWorker("hz-bbw1-docker-tarball-debian-10"
alwaysPull=True,
masterFQDN=FQDN,
hostconfig={ 'shm_size':'1G' },
volumes=['MASTER_PACKAGES/:/packages'],
volumes=MASTER_PACKAGES+'/:/packages',
max_builds=1,
build_wait_timeout=0,
properties={ 'jobs':4, 'save_packages':True }))
Expand All @@ -121,7 +121,7 @@ c['workers'].append(worker.DockerLatentWorker("hz-bbw4-docker-tarball-debian-10"
alwaysPull=True,
masterFQDN=FQDN,
hostconfig={ 'shm_size':'1G' },
volumes=['MASTER_PACKAGES/:/packages'],
volumes=MASTER_PACKAGES+'/:/packages',
max_builds=1,
build_wait_timeout=0,
properties={ 'jobs':4, 'save_packages':True }))
Expand Down

0 comments on commit 90c61d4

Please sign in to comment.