def main() -> None: repo = mzbuild.Repository(Path(".")) workspace = cargo.Workspace(repo.root) buildkite_tag = os.environ["BUILDKITE_TAG"] print(f"--- Publishing Debian package") if buildkite_tag: version = workspace.crates["materialized"].version if version.prerelease is None: publish_deb("materialized", str(version)) else: print(f"Detected prerelease version ({version}); skipping...") else: publish_deb("materialized-unstable", deb.unstable_version(workspace)) print(f"--- Tagging Docker images") if buildkite_tag: tag_docker(repo, buildkite_tag) tag_docker_latest_maybe(repo, buildkite_tag) else: tag_docker(repo, f'unstable-{git.rev_parse("HEAD")}') tag_docker(repo, "unstable") print("--- Uploading binary tarball") mz_path = Path("materialized") ci_util.acquire_materialized(repo, mz_path) deploy_util.deploy_tarball("x86_64-unknown-linux-gnu", mz_path)
def __init__(self, root: Path, arch: Arch, release_mode: bool, coverage: bool): self.root = root self.arch = arch self.release_mode = release_mode self.coverage = coverage self.cargo_workspace = cargo.Workspace(root)
def main() -> None: repo = mzbuild.Repository(Path(".")) workspace = cargo.Workspace(repo.root) print(f"--- Publishing Debian package") if os.environ["BUILDKITE_TAG"]: version = workspace.crates["materialized"].version if version.prerelease is None: publish_deb("materialized", str(version)) else: print(f"Detected prerelease version ({version}); skipping...") else: publish_deb("materialized-unstable", deb.unstable_version(workspace)) print(f"--- Tagging Docker images") if os.environ["BUILDKITE_TAG"]: tag_docker(repo, os.environ["BUILDKITE_TAG"]) # TODO(benesch): figure out how to push a latest tag. We want to be # careful to not overwrite a tag for a newer release if we are building # a historical release (e.g., don't overwrite v1.1.0 with v1.0.1). else: tag_docker(repo, f'unstable-{git.rev_parse("HEAD")}') tag_docker(repo, "unstable") print("--- Uploading binary tarball") mz_path = Path("materialized") ci_util.acquire_materialized(repo, mz_path) deploy_util.deploy_tarball("x86_64-unknown-linux-gnu", mz_path)
def main() -> None: repo = mzbuild.Repository(Path(".")) workspace = cargo.Workspace(repo.root) # Acquire all the mzbuild images in the repository, while pushing any # images that we build to Docker Hub, where they will be accessible to # other build agents. print("--- Acquiring mzbuild images") deps = repo.resolve_dependencies(image for image in repo if image.publish) deps.acquire() for d in deps: if not d.pushed(): d.push() print("--- Staging Debian package") if os.environ["BUILDKITE_BRANCH"] == "main": stage_deb(repo, "materialized-unstable", deb.unstable_version(workspace)) elif os.environ["BUILDKITE_TAG"]: version = workspace.crates["materialized"].version assert ( f"v{version}" == os.environ["BUILDKITE_TAG"] ), f'materialized version {version} does not match tag {os.environ["BUILDKITE_TAG"]}' stage_deb(repo, "materialized", str(version)) elif os.environ["BUILDKITE_BRANCH"] == "master": raise errors.MzError( f"Tried to build branch master {git.rev_parse('HEAD')}") else: print("Not on main branch or tag; skipping")
def main() -> None: repo = mzbuild.Repository(Path(".")) workspace = cargo.Workspace(repo.root) # Build and push any images that are not already available on Docker Hub, # so they are accessible to other build agents. print("--- Acquiring mzbuild images") deps = repo.resolve_dependencies(image for image in repo if image.publish) deps.ensure() annotate_buildkite_with_tags(repo.rd.arch, deps) print("--- Staging Debian package") if os.environ["BUILDKITE_BRANCH"] == "main": stage_deb(repo, "materialized-unstable", deb.unstable_version(workspace)) elif os.environ["BUILDKITE_TAG"]: version = workspace.crates["materialized"].version assert ( f"v{version}" == os.environ["BUILDKITE_TAG"] ), f'materialized version {version} does not match tag {os.environ["BUILDKITE_TAG"]}' stage_deb(repo, "materialized", str(version)) else: print("Not on main branch or tag; skipping")
def main() -> None: repo = mzbuild.Repository(Path(".")) workspace = cargo.Workspace(repo.root) buildkite_tag = os.environ["BUILDKITE_TAG"] print(f"--- Publishing Debian package") if buildkite_tag: version = workspace.crates["materialized"].version if version.prerelease is None: publish_deb("materialized", str(version)) else: print(f"Detected prerelease version ({version}); skipping...") else: publish_deb("materialized-unstable", deb.unstable_version(workspace)) print(f"--- Tagging Docker images") deps = repo.resolve_dependencies(image for image in repo if image.publish) deps.acquire() if buildkite_tag: # On tag builds, always tag the images as such. deps.push_tagged(buildkite_tag) # Also tag the images as `latest` if this is the latest version. version = semver.VersionInfo.parse(buildkite_tag.lstrip("v")) latest_version = next(t for t in git.get_version_tags() if t.prerelease is None) if version == latest_version: deps.push_tagged("latest") else: deps.push_tagged("unstable") print("--- Uploading binary tarball") mz_path = Path("materialized") ci_util.acquire_materialized(repo, mz_path) deploy_util.deploy_tarball("x86_64-unknown-linux-gnu", mz_path)
def __init__(self, root: Path): self.root = root self.cargo_workspace = cargo.Workspace(root)
def __init__(self, root: Path, release_mode: bool): self.root = root self.release_mode = release_mode self.cargo_workspace = cargo.Workspace(root)
def environmentd_rust_version() -> str: rust_version = cargo.Workspace(ROOT).crates["mz-environmentd"].rust_version assert ( rust_version is not None ), "environmentd crate missing rust version configuration" return rust_version