diff --git a/.env.local b/.env.local new file mode 100644 index 0000000..0cdf0de --- /dev/null +++ b/.env.local @@ -0,0 +1,4 @@ +SERVICE_USER_POSTGRESQL=buildbot +SERVICE_PASSWORD_POSTGRESQL=changeme! +GITEA_URL=https://projects.blender.org +BUILDBOT_WEB_URL=http://localhost:8010/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8a2abc6..86e252f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,3 @@ -# Hidden files .venv -.env.production .env.staging - -# Python -__pycache__ -*.py[cod] -Pipfile -Pipfile.lock - -# Editors -*~ -*.swp -*.swo -*# -TAGS -tags - -# Thumbnails -Thumbs.db -ehthumbs.db -Desktop.ini -.DS_Store - -# Local patches and logs -*.patch -*.diff -*.log \ No newline at end of file +.env.production \ No newline at end of file diff --git a/buildbot/config/conf/__init__.py b/Dockerfile similarity index 100% rename from buildbot/config/conf/__init__.py rename to Dockerfile diff --git a/buildbot/master.cfg b/buildbot/master.cfg deleted file mode 100644 index 028e381..0000000 --- a/buildbot/master.cfg +++ /dev/null @@ -1,15 +0,0 @@ -# -*- python -*- -# ex: set filetype=python: -import importlib -import os -import sys - -# Add the "config" directory to the Python path -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "config")) - -# Import the setup module from the "config" directory -import setup -importlib.reload(setup) - -# Use the setup module as intended -BuildmasterConfig = setup.setup() diff --git a/buildbot/config/conf/local/__init__.py b/config/conf/__init__.py similarity index 100% rename from buildbot/config/conf/local/__init__.py rename to config/conf/__init__.py diff --git a/buildbot/config/conf/auth.py b/config/conf/auth.py similarity index 100% rename from buildbot/config/conf/auth.py rename to config/conf/auth.py diff --git a/buildbot/config/conf/branches.py b/config/conf/branches.py similarity index 100% rename from buildbot/config/conf/branches.py rename to config/conf/branches.py diff --git a/buildbot/config/gitea/__init__.py b/config/conf/local/__init__.py similarity index 100% rename from buildbot/config/gitea/__init__.py rename to config/conf/local/__init__.py diff --git a/buildbot/config/conf/local/auth.py b/config/conf/local/auth.py similarity index 100% rename from buildbot/config/conf/local/auth.py rename to config/conf/local/auth.py diff --git a/buildbot/config/conf/local/machines.py b/config/conf/local/machines.py similarity index 95% rename from buildbot/config/conf/local/machines.py rename to config/conf/local/machines.py index e2d9938..fb430e7 100644 --- a/buildbot/config/conf/local/machines.py +++ b/config/conf/local/machines.py @@ -27,5 +27,5 @@ def get_worker_password(worker_name: str) -> str: return "localhost" -def get_worker_names(environment: str): +def get_worker_names(ENVIRONMENT: str): return _worker_names diff --git a/buildbot/config/conf/local/worker.py b/config/conf/local/worker.py similarity index 100% rename from buildbot/config/conf/local/worker.py rename to config/conf/local/worker.py diff --git a/buildbot/config/conf/machines.py b/config/conf/machines.py similarity index 100% rename from buildbot/config/conf/machines.py rename to config/conf/machines.py diff --git a/buildbot/config/conf/worker.py b/config/conf/worker.py similarity index 100% rename from buildbot/config/conf/worker.py rename to config/conf/worker.py diff --git a/buildbot/config/gitea/LICENSE b/config/gitea/LICENSE similarity index 100% rename from buildbot/config/gitea/LICENSE rename to config/gitea/LICENSE diff --git a/buildbot/config/gitea/README.md b/config/gitea/README.md similarity index 100% rename from buildbot/config/gitea/README.md rename to config/gitea/README.md diff --git a/buildbot/config/worker/__init__.py b/config/gitea/__init__.py similarity index 100% rename from buildbot/config/worker/__init__.py rename to config/gitea/__init__.py diff --git a/buildbot/config/gitea/blender.py b/config/gitea/blender.py similarity index 100% rename from buildbot/config/gitea/blender.py rename to config/gitea/blender.py diff --git a/buildbot/config/gitea/reporter.py b/config/gitea/reporter.py similarity index 100% rename from buildbot/config/gitea/reporter.py rename to config/gitea/reporter.py diff --git a/config/master.cfg b/config/master.cfg new file mode 100644 index 0000000..b1e1d40 --- /dev/null +++ b/config/master.cfg @@ -0,0 +1,8 @@ +# -*- python -*- +# ex: set filetype=python: +import importlib +import os +import sys +import setup +importlib.reload(setup) +BuildmasterConfig = setup.setup() diff --git a/buildbot/config/pipeline/__init__.py b/config/pipeline/__init__.py similarity index 100% rename from buildbot/config/pipeline/__init__.py rename to config/pipeline/__init__.py diff --git a/buildbot/config/pipeline/code.py b/config/pipeline/code.py similarity index 100% rename from buildbot/config/pipeline/code.py rename to config/pipeline/code.py diff --git a/buildbot/config/pipeline/code_benchmark.py b/config/pipeline/code_benchmark.py similarity index 100% rename from buildbot/config/pipeline/code_benchmark.py rename to config/pipeline/code_benchmark.py diff --git a/buildbot/config/pipeline/code_bpy_deploy.py b/config/pipeline/code_bpy_deploy.py similarity index 100% rename from buildbot/config/pipeline/code_bpy_deploy.py rename to config/pipeline/code_bpy_deploy.py diff --git a/buildbot/config/pipeline/code_deploy.py b/config/pipeline/code_deploy.py similarity index 100% rename from buildbot/config/pipeline/code_deploy.py rename to config/pipeline/code_deploy.py diff --git a/buildbot/config/pipeline/code_store.py b/config/pipeline/code_store.py similarity index 100% rename from buildbot/config/pipeline/code_store.py rename to config/pipeline/code_store.py diff --git a/buildbot/config/pipeline/common.py b/config/pipeline/common.py similarity index 100% rename from buildbot/config/pipeline/common.py rename to config/pipeline/common.py diff --git a/buildbot/config/pipeline/doc_api.py b/config/pipeline/doc_api.py similarity index 100% rename from buildbot/config/pipeline/doc_api.py rename to config/pipeline/doc_api.py diff --git a/buildbot/config/pipeline/doc_developer.py b/config/pipeline/doc_developer.py similarity index 100% rename from buildbot/config/pipeline/doc_developer.py rename to config/pipeline/doc_developer.py diff --git a/buildbot/config/pipeline/doc_manual.py b/config/pipeline/doc_manual.py similarity index 100% rename from buildbot/config/pipeline/doc_manual.py rename to config/pipeline/doc_manual.py diff --git a/buildbot/config/pipeline/doc_studio.py b/config/pipeline/doc_studio.py similarity index 100% rename from buildbot/config/pipeline/doc_studio.py rename to config/pipeline/doc_studio.py diff --git a/buildbot/config/setup.py b/config/setup.py similarity index 90% rename from buildbot/config/setup.py rename to config/setup.py index f1ee021..abf0730 100644 --- a/buildbot/config/setup.py +++ b/config/setup.py @@ -31,7 +31,7 @@ importlib.reload(conf.worker) importlib.reload(gitea.blender) importlib.reload(pipeline) -environment = os.environ.get("BUILDBOT_environment", default="LOCAL") +ENVIRONMENT = os.environ.get("ENVIRONMENT", default="LOCAL") def setup() -> Dict[str, Any]: @@ -43,7 +43,7 @@ def setup() -> Dict[str, Any]: # Workers print("*** Creating platform workers") - platform_worker_names = conf.machines.fetch_platform_worker_names(environment) + platform_worker_names = conf.machines.fetch_platform_worker_names(ENVIRONMENT) workers: List[buildbot.plugins.worker.Worker] = [] configured_worker_names = set() for worker_names in platform_worker_names.values(): @@ -55,7 +55,7 @@ def setup() -> Dict[str, Any]: workers += [ buildbot.plugins.worker.Worker( worker_name, - conf.machines.get_worker_password(environment, worker_name), + conf.machines.get_worker_password(ENVIRONMENT, worker_name), max_builds=1, keepalive_interval=3600, ) @@ -69,7 +69,7 @@ def setup() -> Dict[str, Any]: c["workers"] = workers # Builders and Schedulers - builders, schedulers = pipeline.populate(environment) + builders, schedulers = pipeline.populate(ENVIRONMENT) c["builders"] = builders c["schedulers"] = schedulers @@ -79,7 +79,7 @@ def setup() -> Dict[str, Any]: # status of each build will be pushed to these targets. buildbot/reporters/*.py # has a variety to choose from, like IRC bots. - gitea_status_service = gitea.blender.setup_service(environment) + gitea_status_service = gitea.blender.setup_service(ENVIRONMENT) if gitea_status_service: c["services"] = [gitea_status_service] else: @@ -90,7 +90,7 @@ def setup() -> Dict[str, Any]: # the 'title' string will appear at the top of this buildbot installation's # home pages (linked to the 'titleURL'). - c["title"] = f"Blender Buildbot - {environment}" + c["title"] = f"Blender Buildbot - {ENVIRONMENT}" c["titleURL"] = "https://projects.blender.org" # the 'buildbotURL' string should point to the location where the buildbot's @@ -113,10 +113,10 @@ def setup() -> Dict[str, Any]: c["buildbotNetUsageData"] = None # Authentication - c["www"]["auth"] = conf.auth.fetch_authentication(environment) + c["www"]["auth"] = conf.auth.fetch_authentication(ENVIRONMENT) # Authorization - c["www"]["authz"] = conf.auth.fetch_authorization(environment) + c["www"]["authz"] = conf.auth.fetch_authorization(ENVIRONMENT) # Disable UI - does not work c["www"]["plugins"] = { diff --git a/config/worker/__init__.py b/config/worker/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/buildbot/config/worker/archive.py b/config/worker/archive.py similarity index 100% rename from buildbot/config/worker/archive.py rename to config/worker/archive.py diff --git a/buildbot/config/worker/blender/__init__.py b/config/worker/blender/__init__.py similarity index 100% rename from buildbot/config/worker/blender/__init__.py rename to config/worker/blender/__init__.py diff --git a/buildbot/config/worker/blender/benchmark.py b/config/worker/blender/benchmark.py similarity index 100% rename from buildbot/config/worker/blender/benchmark.py rename to config/worker/blender/benchmark.py diff --git a/buildbot/config/worker/blender/blender.applescript b/config/worker/blender/blender.applescript similarity index 100% rename from buildbot/config/worker/blender/blender.applescript rename to config/worker/blender/blender.applescript diff --git a/buildbot/config/worker/blender/bundle_dmg.py b/config/worker/blender/bundle_dmg.py similarity index 100% rename from buildbot/config/worker/blender/bundle_dmg.py rename to config/worker/blender/bundle_dmg.py diff --git a/buildbot/config/worker/blender/compile.py b/config/worker/blender/compile.py similarity index 100% rename from buildbot/config/worker/blender/compile.py rename to config/worker/blender/compile.py diff --git a/buildbot/config/worker/blender/cpack_post.cmake b/config/worker/blender/cpack_post.cmake similarity index 100% rename from buildbot/config/worker/blender/cpack_post.cmake rename to config/worker/blender/cpack_post.cmake diff --git a/buildbot/config/worker/blender/cpack_post.py b/config/worker/blender/cpack_post.py similarity index 100% rename from buildbot/config/worker/blender/cpack_post.py rename to config/worker/blender/cpack_post.py diff --git a/buildbot/config/worker/blender/lint.py b/config/worker/blender/lint.py similarity index 100% rename from buildbot/config/worker/blender/lint.py rename to config/worker/blender/lint.py diff --git a/buildbot/config/worker/blender/msix_package.py b/config/worker/blender/msix_package.py similarity index 100% rename from buildbot/config/worker/blender/msix_package.py rename to config/worker/blender/msix_package.py diff --git a/buildbot/config/worker/blender/pack.py b/config/worker/blender/pack.py similarity index 100% rename from buildbot/config/worker/blender/pack.py rename to config/worker/blender/pack.py diff --git a/buildbot/config/worker/blender/sign.py b/config/worker/blender/sign.py similarity index 100% rename from buildbot/config/worker/blender/sign.py rename to config/worker/blender/sign.py diff --git a/buildbot/config/worker/blender/test.py b/config/worker/blender/test.py similarity index 100% rename from buildbot/config/worker/blender/test.py rename to config/worker/blender/test.py diff --git a/buildbot/config/worker/blender/update.py b/config/worker/blender/update.py similarity index 100% rename from buildbot/config/worker/blender/update.py rename to config/worker/blender/update.py diff --git a/buildbot/config/worker/blender/version.py b/config/worker/blender/version.py similarity index 100% rename from buildbot/config/worker/blender/version.py rename to config/worker/blender/version.py diff --git a/buildbot/config/worker/code.py b/config/worker/code.py similarity index 100% rename from buildbot/config/worker/code.py rename to config/worker/code.py diff --git a/buildbot/config/worker/code_benchmark.py b/config/worker/code_benchmark.py similarity index 100% rename from buildbot/config/worker/code_benchmark.py rename to config/worker/code_benchmark.py diff --git a/buildbot/config/worker/code_bpy_deploy.py b/config/worker/code_bpy_deploy.py similarity index 100% rename from buildbot/config/worker/code_bpy_deploy.py rename to config/worker/code_bpy_deploy.py diff --git a/buildbot/config/worker/code_deploy.py b/config/worker/code_deploy.py similarity index 100% rename from buildbot/config/worker/code_deploy.py rename to config/worker/code_deploy.py diff --git a/buildbot/config/worker/code_store.py b/config/worker/code_store.py similarity index 100% rename from buildbot/config/worker/code_store.py rename to config/worker/code_store.py diff --git a/buildbot/config/worker/configure.py b/config/worker/configure.py similarity index 100% rename from buildbot/config/worker/configure.py rename to config/worker/configure.py diff --git a/buildbot/config/worker/deploy/__init__.py b/config/worker/deploy/__init__.py similarity index 100% rename from buildbot/config/worker/deploy/__init__.py rename to config/worker/deploy/__init__.py diff --git a/buildbot/config/worker/deploy/artifacts.py b/config/worker/deploy/artifacts.py similarity index 100% rename from buildbot/config/worker/deploy/artifacts.py rename to config/worker/deploy/artifacts.py diff --git a/buildbot/config/worker/deploy/monitor.py b/config/worker/deploy/monitor.py similarity index 100% rename from buildbot/config/worker/deploy/monitor.py rename to config/worker/deploy/monitor.py diff --git a/buildbot/config/worker/deploy/pypi.py b/config/worker/deploy/pypi.py similarity index 100% rename from buildbot/config/worker/deploy/pypi.py rename to config/worker/deploy/pypi.py diff --git a/buildbot/config/worker/deploy/snap.py b/config/worker/deploy/snap.py similarity index 100% rename from buildbot/config/worker/deploy/snap.py rename to config/worker/deploy/snap.py diff --git a/buildbot/config/worker/deploy/source.py b/config/worker/deploy/source.py similarity index 100% rename from buildbot/config/worker/deploy/source.py rename to config/worker/deploy/source.py diff --git a/buildbot/config/worker/deploy/steam.py b/config/worker/deploy/steam.py similarity index 100% rename from buildbot/config/worker/deploy/steam.py rename to config/worker/deploy/steam.py diff --git a/buildbot/config/worker/deploy/windows.py b/config/worker/deploy/windows.py similarity index 100% rename from buildbot/config/worker/deploy/windows.py rename to config/worker/deploy/windows.py diff --git a/buildbot/config/worker/doc_api.py b/config/worker/doc_api.py similarity index 100% rename from buildbot/config/worker/doc_api.py rename to config/worker/doc_api.py diff --git a/buildbot/config/worker/doc_developer.py b/config/worker/doc_developer.py similarity index 100% rename from buildbot/config/worker/doc_developer.py rename to config/worker/doc_developer.py diff --git a/buildbot/config/worker/doc_manual.py b/config/worker/doc_manual.py similarity index 100% rename from buildbot/config/worker/doc_manual.py rename to config/worker/doc_manual.py diff --git a/buildbot/config/worker/doc_studio.py b/config/worker/doc_studio.py similarity index 100% rename from buildbot/config/worker/doc_studio.py rename to config/worker/doc_studio.py diff --git a/buildbot/config/worker/utils.py b/config/worker/utils.py similarity index 100% rename from buildbot/config/worker/utils.py rename to config/worker/utils.py diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 0000000..103aa33 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,24 @@ +services: + buildbot-master: + env_file: .env.local + volumes: + - ./config:/buildbot/config + + buildbot-worker: + image: 'buildbot/buildbot-worker:${BUILDBOT_IMAGE_TAG:-v4.1.0}' + restart: unless-stopped + environment: + - 'BUILDMASTER=${BUILDMASTER:-buildbot-master}' + - 'BUILDMASTER_PORT=${BUILDBOT_WORKER_PORT:-9989}' + - 'WORKERNAME=${WORKERNAME:-example-worker}' + - 'WORKERPASS=${WORKERPASS:-pass}' + - 'WORKER_ENVIRONMENT_BLACKLIST=${WORKER_ENVIRONMENT_BLACKLIST:-DOCKER_BUILDBOT* BUILDBOT_ENV_* BUILDBOT_1* WORKER_ENVIRONMENT_BLACKLIST}' + healthcheck: + test: + - CMD + - curl + - '-f' + - 'http://$${BUILDMASTER}:$${BUILDMASTER_PORT}' + interval: 5s + timeout: 20s + retries: 10 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 19a7868..190b123 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,16 @@ services: buildbot-master: image: 'buildbot/buildbot-master:${BUILDBOT_IMAGE_TAG:-v4.1.0}' - hostname: buildbot-master restart: unless-stopped - ports: - - 8010:8010 environment: + - 'HOSTNAME=${MASTER_HOSTNAME:-buildbot-master-1}' - 'BUILDBOT_CONFIG_DIR=${BUILDBOT_CONFIG_DIR:-config}' - - 'BUILDBOT_ENVIRONMENT=${BUILDBOT_ENVIRONMENT:-LOCAL}' + - 'BUILDBOT_CONFIG_URL=${BUILDBOT_CONFIG_URL:-https://git.braak.pro/api/packages/bartvdbraak/generic/builder.braak.pro/main/config.tar.gz}' - 'BUILDBOT_WORKER_PORT=${BUILDBOT_WORKER_PORT:-9989}' - 'BUILDBOT_WEB_URL=${BUILDBOT_WEB_URL:-http://localhost:8010/}' - 'BUILDBOT_WEB_PORT=${BUILDBOT_WEB_PORT:-tcp:port=8010}' - - 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme123}' - - 'POSTGRES_USER=${POSTGRES_USER:-buildbot}' + - 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}' + - 'POSTGRES_USER=${SERVICE_USER_POSTGRESQL}' - 'POSTGRES_DB=${POSTGRES_DB:-buildbot}' - 'BUILDBOT_DB_URL=postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@postgresql/{POSTGRES_DB}' healthcheck: @@ -27,11 +25,6 @@ services: depends_on: postgresql: condition: service_healthy - volumes: - - ./buildbot/config:/buildbot/config - - ./buildbot/master.cfg:/buildbot/master.cfg - networks: - buildbot: null postgresql: image: 'postgres:${POSTGRES_IMAGE_TAG:-16-alpine}' restart: unless-stopped @@ -45,33 +38,8 @@ services: volumes: - 'buildbot-db:/var/lib/postgresql/data' environment: - - 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme123}' - - 'POSTGRES_USER=${POSTGRES_USER:-buildbot}' + - 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}' + - 'POSTGRES_USER=${SERVICE_USER_POSTGRESQL}' - 'POSTGRES_DB=${POSTGRES_DB:-buildbot}' - networks: - buildbot: null - buildbot-worker: - image: 'buildbot/buildbot-worker:${BUILDBOT_IMAGE_TAG:-v4.1.0}' - restart: unless-stopped - environment: - - 'BUILDMASTER=${BUILDMASTER:-buildbot-master}' - - 'BUILDMASTER_PORT=${BUILDBOT_WORKER_PORT:-9989}' - - 'BUILDBOT_ENVIRONMENT=${BUILDBOT_ENVIRONMENT:-LOCAL}' - - 'WORKERNAME=${WORKERNAME:-localhost}' - - 'WORKERPASS=${WORKERPASS:-localhost}' - - 'WORKER_ENVIRONMENT_BLACKLIST=${WORKER_ENVIRONMENT_BLACKLIST:-DOCKER_BUILDBOT* BUILDBOT_ENV_* BUILDBOT_1* WORKER_ENVIRONMENT_BLACKLIST}' - healthcheck: - test: - - CMD - - curl - - '-f' - - 'http://$${BUILDMASTER}:$${BUILDMASTER_PORT}' - interval: 5s - timeout: 20s - retries: 10 - networks: - buildbot: null volumes: - buildbot-db: {} -networks: - buildbot: {} \ No newline at end of file + buildbot-db: {} \ No newline at end of file