1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "../zen.h"
#include <zenhttp/auth/authmgr.h>
#include <zenhttp/httpclientauth.h>
#include <filesystem>
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<std::string> m_BuildPartNames;
std::vector<std::string> 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<std::string> 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
|