mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-05-03 23:24:49 -04:00

Calling this Phase 1. I've switch the build machine philosophy from using a dedicated Digital Ocean droplet per arch to using one large build machine and the +package-linux Earthly target which results in .deb and .rpm packages for both amd64 and arm64/aarch64. The script to create and delete the build machine has been migrated to Python. I feel like the error handling is better and the delete function now does its thing by using the specific ID of the running build machine vs the name. Using the name would, in rare circumstances, fail when more than one machine of the same name existed causing duplicates to be created, all very expensive and creating larger than normal Digital Ocean costs. Lastly, moving the .deb and .rpm packages from the build machine to the build orchestrator for creating and signing the repositories now uses the Gitlab CICD artifact system verses SCP. This switch will allow us to include the packages in the release records and maybe streamline the Python and Crates distribution jobs in a later phase of this project. Changes are made in the Dry Run section off the CICD config for testing, which will start in a few minutes and probably result in a bunch of failed pipelines and tweaking because there's just no way I got all of this right on the first try.
37 lines
1.7 KiB
Python
37 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
import os
|
|
import sys
|
|
import argparse
|
|
import asyncio
|
|
from dotenv import load_dotenv
|
|
from utils.build_machine_control import create_build_machine, delete_build_machine
|
|
from utils.test_credentials import test_api_credentials
|
|
from utils.repos_builder import build_deb_repo, build_rpm_repo
|
|
|
|
if __name__ == "__main__":
|
|
# Load environment variables from the .env file.
|
|
load_dotenv()
|
|
token = os.getenv("DO_API_TOKEN")
|
|
if not token:
|
|
print("Error: DO_API_TOKEN environment variable not found. Please set it in the .env file.", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
# Set up command-line argument parsing.
|
|
parser = argparse.ArgumentParser(description="Veilid compiling and releasing utility")
|
|
parser.add_argument("--create-build-machine", action="store_true", help="Create a build machine")
|
|
parser.add_argument("--delete-build-machine", action="store_true", help="Delete the created build machine")
|
|
parser.add_argument("--build-deb-repo", action="store_true", help="Creates and signs .deb repository")
|
|
parser.add_argument("--build-rpm-repo", action="store_true", help="Creates and signs .rpm repository")
|
|
parser.add_argument("--test-api-credentials", action="store_true", help="Test DigitalOcean API credentials")
|
|
args = parser.parse_args()
|
|
|
|
if args.create_build_machine:
|
|
asyncio.run(create_build_machine(token))
|
|
elif args.delete_build_machine:
|
|
asyncio.run(delete_build_machine(token))
|
|
elif args.build_deb_repo:
|
|
asyncio.run(build_deb_repo())
|
|
elif args.build_rpm_repo:
|
|
asyncio.run(build_rpm_repo())
|
|
elif args.test_api_credentials:
|
|
asyncio.run(test_api_credentials(token))
|