From 90c61d4dfc7c7d70b80b911ca4d8b84c6132f60d Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Sun, 8 Oct 2023 13:51:19 +0200 Subject: [PATCH] Workflow dependency --- .github/workflows/bbm_build_container.yml | 9 ++- .github/workflows/bbm_check_conf.yml | 42 ------------- .../workflows/{deploy.yml => bbm_deploy.yml} | 60 ++++++++++++------- ...containers.yml => bbw_build_container.yml} | 6 +- docker-compose/.env | 2 +- master-protected-branches/master.cfg | 4 +- 6 files changed, 48 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/bbm_check_conf.yml rename .github/workflows/{deploy.yml => bbm_deploy.yml} (63%) rename .github/workflows/{bb_containers.yml => bbw_build_container.yml} (98%) diff --git a/.github/workflows/bbm_build_container.yml b/.github/workflows/bbm_build_container.yml index 587bdee9..c782282d 100644 --- a/.github/workflows/bbm_build_container.yml +++ b/.github/workflows/bbm_build_container.yml @@ -1,6 +1,5 @@ --- -name: bbm build container - +name: bbm-build-container on: push: @@ -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 diff --git a/.github/workflows/bbm_check_conf.yml b/.github/workflows/bbm_check_conf.yml deleted file mode 100644 index 5f609c40..00000000 --- a/.github/workflows/bbm_check_conf.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: bbm-check-conf - -on: - push: - paths: - - ".github/workflows/bbm_check_conf.yml" - - ".github/workflows/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_check_conf.yml" - - ".github/workflows/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: - runs-on: ubuntu-latest - name: check - - steps: - - uses: actions/checkout@v2 - - name: Check master.cfg files - run: ./validate_master_cfg.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/bbm_deploy.yml similarity index 63% rename from .github/workflows/deploy.yml rename to .github/workflows/bbm_deploy.yml index 52a4568b..6e1872eb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/bbm_deploy.yml @@ -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 diff --git a/.github/workflows/bb_containers.yml b/.github/workflows/bbw_build_container.yml similarity index 98% rename from .github/workflows/bb_containers.yml rename to .github/workflows/bbw_build_container.yml index 0526a458..33c09724 100644 --- a/.github/workflows/bb_containers.yml +++ b/.github/workflows/bbw_build_container.yml @@ -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: diff --git a/docker-compose/.env b/docker-compose/.env index 664253ed..24e04198 100644 --- a/docker-compose/.env +++ b/docker-compose/.env @@ -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" diff --git a/master-protected-branches/master.cfg b/master-protected-branches/master.cfg index 3cb90a4c..b2c3233f 100644 --- a/master-protected-branches/master.cfg +++ b/master-protected-branches/master.cfg @@ -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 })) @@ -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 }))