// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "../zen.h" #include #include #include namespace zen { class BuildsCommand : public CacheStoreCommand { public: static constexpr char Name[] = "builds"; static constexpr char Description[] = "Manage builds - list, upload, download, diff"; BuildsCommand(); ~BuildsCommand(); virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override; virtual cxxopts::Options& Options() override { return m_Options; } private: cxxopts::Options m_Options{Name, Description}; std::filesystem::path m_SystemRootDir; bool m_PlainProgress = false; bool m_LogProgress = false; bool m_Verbose = false; bool m_BoostWorkerThreads = false; bool m_UseSparseFiles = true; bool m_Quiet = false; std::filesystem::path m_ZenFolderPath; // cloud builds std::string m_OverrideHost; std::string m_Host; std::string m_Url; bool m_AssumeHttp2 = false; bool m_AllowRedirect = false; std::string m_Namespace; std::string m_Bucket; // file storage std::filesystem::path m_StoragePath; bool m_WriteMetadataAsJson = false; // cache std::string m_ZenCacheHost; bool m_PrimeCacheOnly = false; std::string m_BuildId; bool m_CreateBuild = false; std::filesystem::path m_BuildMetadataPath; std::string m_BuildMetadata; std::string m_BuildPartName; // Defaults to name of leaf folder in m_Path std::string m_BuildPartId; // Defaults to a generated id when creating part, looked up when downloading using m_BuildPartName bool m_Clean = false; uint8_t m_BlockReuseMinPercentLimit = 85; bool m_AllowMultiparts = true; bool m_AllowPartialBlockRequests = true; std::string m_ManifestPath; // Not a std::filesystem::path since it can be relative to m_Path // Direct access token (may expire) std::string m_AccessToken; std::string m_AccessTokenEnv; std::filesystem::path m_AccessTokenPath; // Auth manager token encryption std::string m_EncryptionKey; // 256 bit AES encryption key std::string m_EncryptionIV; // 128 bit AES initialization vector // OpenId acccess token std::string m_OpenIdProviderName; std::string m_OpenIdProviderUrl; std::string m_OpenIdClientId; std::string m_OpenIdRefreshToken; // OAuth acccess token std::string m_OAuthUrl; std::string m_OAuthClientId; std::string m_OAuthClientSecret; std::string m_OidcTokenAuthExecutablePath; std::string m_Verb; // list, upload, download cxxopts::Options m_ListNamespacesOptions{"list-namespaces", "List available build namespaces"}; bool m_ListNamespacesRecursive = false; cxxopts::Options m_ListOptions{"list", "List available builds"}; std::filesystem::path m_ListQueryPath; std::filesystem::path m_ListResultPath; std::filesystem::path m_Path; cxxopts::Options m_UploadOptions{"upload", "Upload a folder"}; uint64_t m_FindBlockMaxCount = 10000; bool m_PostUploadVerify = false; cxxopts::Options m_DownloadOptions{"download", "Download a folder"}; std::vector m_BuildPartNames; std::vector m_BuildPartIds; bool m_PostDownloadVerify = false; bool m_EnableScavenging = true; cxxopts::Options m_LsOptions{"ls", "List the content of uploaded build"}; std::string m_IncludeWildcard; std::string m_ExcludeWildcard; cxxopts::Options m_DiffOptions{"diff", "Compare two local folders"}; std::filesystem::path m_DiffPath; bool m_OnlyChunked = false; cxxopts::Options m_FetchBlobOptions{"fetch-blob", "Fetch a blob from remote store"}; std::string m_BlobHash; cxxopts::Options m_PauseOptions{"pause", "Pause an ongoing zen builds process"}; cxxopts::Options m_ResumeOptions{"resume", "Resume a paused zen builds process"}; cxxopts::Options m_AbortOptions{"abort", "Abort an ongoing zen builds process"}; int m_ZenProcessId = -1; cxxopts::Options m_ValidateBuildPartOptions{"validate-part", "Fetch a build part and validate all referenced attachments"}; cxxopts::Options m_TestOptions{"test", "Test upload and download with verify"}; cxxopts::Options m_MultiTestDownloadOptions{"multi-test-download", "Test multiple sequenced downloads with verify"}; std::vector m_BuildIds; cxxopts::Options* m_SubCommands[13] = {&m_ListNamespacesOptions, &m_ListOptions, &m_UploadOptions, &m_DownloadOptions, &m_PauseOptions, &m_ResumeOptions, &m_AbortOptions, &m_DiffOptions, &m_LsOptions, &m_FetchBlobOptions, &m_ValidateBuildPartOptions, &m_TestOptions, &m_MultiTestDownloadOptions}; }; } // namespace zen