diff options
| author | Dan Engelbrecht <[email protected]> | 2025-06-05 13:31:52 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-06-05 13:31:52 +0200 |
| commit | a705d9135fc6b10c22f64a0d1fb715e21b77076c (patch) | |
| tree | b0570bc4a65761d096d5fe3f13c1b494064d79b8 | |
| parent | Initialize sentry after command line parsing is done (#420) (diff) | |
| download | zen-a705d9135fc6b10c22f64a0d1fb715e21b77076c.tar.xz zen-a705d9135fc6b10c22f64a0d1fb715e21b77076c.zip | |
revert system temp dir for builds upload (#422)
* revert temp upload folder to be inside source directory to avoid filling up system disk
* use selected subcommand when displaying help for failed command line options in zen builds
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | src/zen/cmds/builds_cmd.cpp | 56 |
2 files changed, 29 insertions, 29 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 056ac03bb..284a7a5ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ - Improvement: Add global open file cache for written files increasing throughput during download by reducing overhead of open/close of file by 80% - Improvement: Multithreaded scavenge pass for zen builds download - Improvement: Optimized check for modified files when verifying state of scavenged paths +- Bugfix: Use selected subcommand when displaying help for failed command line options in zen builds - Bugfix: Zen CLI now initializes Sentry after command line options parsing, so that the options can be propetly taken into account during init +- Bugfix: Revert: `zen builds upload` now use the system temp directory for temporary files leaving the source folder untouched ## 5.6.9 - Bugfix: Remove long running exclusive namespace wide locks when dropping buckets or namespaces diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp index 1c1193a3f..b04575009 100644 --- a/src/zen/cmds/builds_cmd.cpp +++ b/src/zen/cmds/builds_cmd.cpp @@ -9834,15 +9834,15 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) { if (!m_Host.empty()) { - throw zen::OptionParseException(fmt::format("host is not compatible with the url option\n{}", m_Options.help())); + throw zen::OptionParseException(fmt::format("host is not compatible with the url option\n{}", SubOption->help())); } if (!m_Bucket.empty()) { - throw zen::OptionParseException(fmt::format("bucket is not compatible with the url option\n{}", m_Options.help())); + throw zen::OptionParseException(fmt::format("bucket is not compatible with the url option\n{}", SubOption->help())); } if (!m_BuildId.empty()) { - throw zen::OptionParseException(fmt::format("buildid is not compatible with the url option\n{}", m_Options.help())); + throw zen::OptionParseException(fmt::format("buildid is not compatible with the url option\n{}", SubOption->help())); } const std::string ArtifactURLRegExString = R"((.*?:\/\/.*?)\/api\/v2\/builds\/(.*?)\/(.*?)\/(.*))"; const std::regex ArtifactURLRegEx(ArtifactURLRegExString, std::regex::ECMAScript); @@ -9870,7 +9870,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } else { - throw zen::OptionParseException(fmt::format("url does not match the Cloud Artifact URL format\n{}", m_Options.help())); + throw zen::OptionParseException(fmt::format("url does not match the Cloud Artifact URL format\n{}", SubOption->help())); } } @@ -9879,20 +9879,20 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) if (!m_StoragePath.empty()) { throw zen::OptionParseException( - fmt::format("host/url/override-host is not compatible with the storage-path option\n{}", m_Options.help())); + fmt::format("host/url/override-host is not compatible with the storage-path option\n{}", SubOption->help())); } if (m_Namespace.empty()) { - throw zen::OptionParseException(fmt::format("namespace option is required for this storage option\n{}", m_Options.help())); + throw zen::OptionParseException(fmt::format("namespace option is required for this storage option\n{}", SubOption->help())); } if (RequireBucket && m_Bucket.empty()) { - throw zen::OptionParseException(fmt::format("bucket option is required for this storage option\n{}", m_Options.help())); + throw zen::OptionParseException(fmt::format("bucket option is required for this storage option\n{}", SubOption->help())); } } else if (m_StoragePath.empty()) { - throw zen::OptionParseException(fmt::format("At least one storage option is required\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("At least one storage option is required\n{}", SubOption->help())); } MakeSafeAbsolutePathÍnPlace(m_StoragePath); }; @@ -10262,7 +10262,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } else { - throw zen::OptionParseException(fmt::format("Storage option is missing\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Storage option is missing\n{}", SubOption->help())); } if (!m_ZenCacheHost.empty()) { @@ -10305,7 +10305,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) auto ParsePath = [&]() { if (m_Path.empty()) { - throw zen::OptionParseException(fmt::format("local-path is required\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("local-path is required\n{}", SubOption->help())); } MakeSafeAbsolutePathÍnPlace(m_Path); }; @@ -10313,7 +10313,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) auto ParseDiffPath = [&]() { if (m_DiffPath.empty()) { - throw zen::OptionParseException(fmt::format("compare-path is required\n{}", m_DownloadOptions.help())); + throw zen::OptionParseException(fmt::format("compare-path is required\n{}", SubOption->help())); } MakeSafeAbsolutePathÍnPlace(m_DiffPath); }; @@ -10322,13 +10322,13 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) m_BlobHash = RemoveQuotes(m_BlobHash); if (m_BlobHash.empty()) { - throw zen::OptionParseException(fmt::format("Blob hash string is missing\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Blob hash string is missing\n{}", SubOption->help())); } IoHash BlobHash; if (!IoHash::TryParse(m_BlobHash, BlobHash)) { - throw zen::OptionParseException(fmt::format("Blob hash string is invalid\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Blob hash string is invalid\n{}", SubOption->help())); } return BlobHash; @@ -10338,11 +10338,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) m_BuildId = RemoveQuotes(m_BuildId); if (m_BuildId.length() != Oid::StringLength) { - throw zen::OptionParseException(fmt::format("Invalid build id\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Invalid build id\n{}", SubOption->help())); } else if (Oid BuildId = Oid::FromHexString(m_BuildId); BuildId == Oid::Zero) { - throw zen::OptionParseException(fmt::format("Invalid build id\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Invalid build id\n{}", SubOption->help())); } else { @@ -10354,11 +10354,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) m_BuildPartId = RemoveQuotes(m_BuildPartId); if (m_BuildPartId.length() != Oid::StringLength) { - throw zen::OptionParseException(fmt::format("Invalid build part id\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Invalid build part id\n{}", SubOption->help())); } else if (Oid BuildPartId = Oid::FromHexString(m_BuildPartId); BuildPartId == Oid::Zero) { - throw zen::OptionParseException(fmt::format("Invalid build part id\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Invalid build part id\n{}", SubOption->help())); } else { @@ -10373,7 +10373,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildPartIds.push_back(Oid::TryFromHexString(RemoveQuotes(BuildPartId))); if (BuildPartIds.back() == Oid::Zero) { - throw zen::OptionParseException(fmt::format("build-part-id '{}' is invalid\n{}", BuildPartId, m_DownloadOptions.help())); + throw zen::OptionParseException(fmt::format("build-part-id '{}' is invalid\n{}", BuildPartId, SubOption->help())); } } return BuildPartIds; @@ -10386,8 +10386,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildPartNames.push_back(std::string(RemoveQuotes(BuildPartName))); if (BuildPartNames.back().empty()) { - throw zen::OptionParseException( - fmt::format("build-part-names '{}' is invalid\n{}", BuildPartName, m_DownloadOptions.help())); + throw zen::OptionParseException(fmt::format("build-part-names '{}' is invalid\n{}", BuildPartName, SubOption->help())); } } return BuildPartNames; @@ -10398,11 +10397,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) { if (m_BuildMetadataPath.empty() && m_BuildMetadata.empty()) { - throw zen::OptionParseException(fmt::format("Options for builds target are missing\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Options for builds target are missing\n{}", SubOption->help())); } if (!m_BuildMetadataPath.empty() && !m_BuildMetadata.empty()) { - throw zen::OptionParseException(fmt::format("Conflicting options for builds target\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("Conflicting options for builds target\n{}", SubOption->help())); } if (!m_BuildMetadataPath.empty()) @@ -10440,12 +10439,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) if (!m_BuildMetadataPath.empty()) { throw zen::OptionParseException( - fmt::format("metadata-path option is only valid if creating a build\n{}", m_UploadOptions.help())); + fmt::format("metadata-path option is only valid if creating a build\n{}", SubOption->help())); } if (!m_BuildMetadata.empty()) { - throw zen::OptionParseException( - fmt::format("metadata option is only valid if creating a build\n{}", m_UploadOptions.help())); + throw zen::OptionParseException(fmt::format("metadata option is only valid if creating a build\n{}", SubOption->help())); } } return {}; @@ -10637,7 +10635,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) CbObject MetaData = ParseBuildMetadata(); - const std::filesystem::path TempDir = UploadTempDirectory(m_Path); + const std::filesystem::path TempDir = ZenTempFolderPath(m_ZenFolderPath); m_ManifestPath = RemoveQuotes(m_ManifestPath); @@ -10702,7 +10700,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) if (m_PostDownloadVerify && m_PrimeCacheOnly) { throw zen::OptionParseException( - fmt::format("'cache-prime-only' option is not compatible with 'verify' option\n{}", m_DownloadOptions.help())); + fmt::format("'cache-prime-only' option is not compatible with 'verify' option\n{}", SubOption->help())); } if (m_Clean && m_PrimeCacheOnly) @@ -10814,7 +10812,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) if (!m_BuildPartName.empty() && !m_BuildPartId.empty()) { - throw zen::OptionParseException(fmt::format("build-part-id conflicts with build-part-name\n{}", m_DownloadOptions.help())); + throw zen::OptionParseException(fmt::format("build-part-id conflicts with build-part-name\n{}", SubOption->help())); } const Oid BuildPartId = m_BuildPartName.empty() ? Oid::Zero : ParseBuildPartId(); @@ -10853,7 +10851,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) Oid BuildId = Oid::FromHexString(RemoveQuotes(BuildIdString)); if (BuildId == Oid::Zero) { - throw zen::OptionParseException(fmt::format("invalid build id {}\n{}", BuildIdString, m_DownloadOptions.help())); + throw zen::OptionParseException(fmt::format("invalid build id {}\n{}", BuildIdString, SubOption->help())); } DownloadFolder(Storage, BuildId, |