diff options
| author | Dan Engelbrecht <[email protected]> | 2025-08-11 12:58:27 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-08-11 12:58:27 +0200 |
| commit | eeac0654ab8f9e3438f2331916261a0440286fbd (patch) | |
| tree | 56bd48ef8dedf91eeb25a7c26471742ab189874c /src/zenhttp/httpclientauth.cpp | |
| parent | Merge pull request #434 from ue-foundation/zs/put-overwrite-policy (diff) | |
| download | zen-eeac0654ab8f9e3438f2331916261a0440286fbd.tar.xz zen-eeac0654ab8f9e3438f2331916261a0440286fbd.zip | |
list build part content (#462)
- Feature: Added `zen build ls` option to list the content of a build part(s)
- Build source is specified using one of the following options
- `--cloud-url` cloud artifact URL to build
- `--host` or `--override-host`, `--namespace`, `--bucket` and `--buildid`
- `--filestorage`, `--namespace`, `--bucket` and `--buildid`
- `--build-part-name` to specify a particular build part(s) in the build
- `--wildcard` windows style wildcard (using * and ?) to match file paths to include
- `--exclude-wildcard` windows style wildcard (using * and ?) to match file paths to exclude. Applied after --wildcard include filter
- Improvement: Added `--quiet` option to zen `builds` commands to suppress non-essential output
Diffstat (limited to 'src/zenhttp/httpclientauth.cpp')
| -rw-r--r-- | src/zenhttp/httpclientauth.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/zenhttp/httpclientauth.cpp b/src/zenhttp/httpclientauth.cpp index 39efe1d0c..62e1b77bc 100644 --- a/src/zenhttp/httpclientauth.cpp +++ b/src/zenhttp/httpclientauth.cpp @@ -89,14 +89,25 @@ namespace zen { namespace httpclientauth { static HttpClientAccessToken GetOidcTokenFromExe(const std::filesystem::path& OidcExecutablePath, std::string_view CloudHost, - bool Unattended) + bool Unattended, + bool Quiet) { Stopwatch Timer; CreateProcOptions ProcOptions; + if (Quiet) + { + ProcOptions.StdoutFile = std::filesystem::temp_directory_path() / fmt::format(".zen-auth-output-{}", Oid::NewOid()); + } const std::filesystem::path AuthTokenPath(std::filesystem::temp_directory_path() / fmt::format(".zen-auth-{}", Oid::NewOid())); - auto _ = MakeGuard([AuthTokenPath]() { RemoveFile(AuthTokenPath); }); + auto _ = MakeGuard([AuthTokenPath, &ProcOptions]() { + RemoveFile(AuthTokenPath); + if (!ProcOptions.StdoutFile.empty()) + { + RemoveFile(ProcOptions.StdoutFile); + } + }); const std::string ProcArgs = fmt::format("{} --AuthConfigUrl {} --OutFile {} --Unattended={}", OidcExecutablePath, @@ -164,13 +175,15 @@ namespace zen { namespace httpclientauth { } std::optional<std::function<HttpClientAccessToken()>> CreateFromOidcTokenExecutable(const std::filesystem::path& OidcExecutablePath, - std::string_view CloudHost) + std::string_view CloudHost, + bool Quiet) { - HttpClientAccessToken InitialToken = GetOidcTokenFromExe(OidcExecutablePath, CloudHost, false); + HttpClientAccessToken InitialToken = GetOidcTokenFromExe(OidcExecutablePath, CloudHost, /* Unattended */ false, Quiet); if (InitialToken.IsValid()) { return [OidcExecutablePath = std::filesystem::path(OidcExecutablePath), CloudHost = std::string(CloudHost), + Quiet, InitialToken]() mutable { if (InitialToken.IsValid()) { @@ -178,7 +191,7 @@ namespace zen { namespace httpclientauth { InitialToken = {}; return Result; } - return GetOidcTokenFromExe(OidcExecutablePath, CloudHost, true); + return GetOidcTokenFromExe(OidcExecutablePath, CloudHost, /* Unattended */ true, Quiet); }; } return {}; |