Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/data_types/chunking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pub use self::compression::ChunkCompression;
pub use self::dif::{AssembleDifsRequest, AssembleDifsResponse, ChunkedDifRequest};
pub use self::file_state::ChunkedFileState;
pub use self::hash_algorithm::ChunkHashAlgorithm;
pub use self::upload::{ChunkServerOptions, ChunkUploadCapability};
pub use self::upload::ChunkServerOptions;
30 changes: 0 additions & 30 deletions src/api/data_types/chunking/upload/capability.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/api/data_types/chunking/upload/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use super::*;

mod capability;
mod options;

pub use self::capability::ChunkUploadCapability;
pub use self::options::ChunkServerOptions;
11 changes: 1 addition & 10 deletions src/api/data_types/chunking/upload/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::num::NonZeroUsize;

use serde::Deserialize;

use super::{ChunkCompression, ChunkHashAlgorithm, ChunkUploadCapability};
use super::{ChunkCompression, ChunkHashAlgorithm};

/// Chunk upload options which are set by the Sentry server.
#[derive(Debug, Deserialize)]
Expand All @@ -23,13 +23,4 @@ pub struct ChunkServerOptions {
pub concurrency: u8,
#[serde(default)]
pub compression: Vec<ChunkCompression>,
#[serde(default)]
pub accept: Vec<ChunkUploadCapability>,
}

impl ChunkServerOptions {
/// Returns whether the given capability is accepted by the chunk upload endpoint.
pub fn supports(&self, capability: ChunkUploadCapability) -> bool {
self.accept.contains(&capability)
}
}
15 changes: 2 additions & 13 deletions src/commands/build/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ use symbolic::common::ByteView;
use zip::write::SimpleFileOptions;
use zip::{DateTime, ZipWriter};

use crate::api::{
Api, AuthenticatedApi, ChunkUploadCapability, ChunkedBuildRequest, ChunkedFileState, VcsInfo,
};
use crate::api::{Api, AuthenticatedApi, ChunkedBuildRequest, ChunkedFileState, VcsInfo};
use crate::config::Config;
use crate::utils::args::ArgExt as _;
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
Expand Down Expand Up @@ -42,6 +40,7 @@ pub fn make_command(command: Command) -> Command {
"The path to the build to upload. Supported files include Apk, and Aab.";
command
.about("Upload builds to a project.")
.long_about("Upload builds to a project.\n\nThis feature only works with Sentry SaaS.")
.org_arg()
.project_arg(false)
.arg(
Expand Down Expand Up @@ -599,23 +598,13 @@ fn upload_file(
release_notes: Option<&str>,
vcs_info: &VcsInfo<'_>,
) -> Result<String> {
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
update to the latest version of Sentry to use the build upload command.";

debug!(
"Uploading file to organization: {org}, project: {project}, build_configuration: {}, vcs_info: {vcs_info:?}",
build_configuration.unwrap_or("unknown"),
);

let chunk_upload_options = api.get_chunk_upload_options(org)?;

if !chunk_upload_options.supports(ChunkUploadCapability::PreprodArtifacts) {
bail!(
"The Sentry server lacks support for receiving files uploaded \
with this command. {SELF_HOSTED_ERROR_HINT}"
);
}

let progress_style =
ProgressStyle::default_spinner().template("{spinner} Preparing for upload...");
let pb = ProgressBar::new_spinner();
Expand Down
3 changes: 2 additions & 1 deletion src/commands/dart_symbol_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const GROUP_ABOUT: &str = "Manage Dart/Flutter symbol maps for Sentry.";
const UPLOAD_ABOUT: &str =
"Upload a Dart/Flutter symbol map (dartsymbolmap) for deobfuscating Dart exception types.";
const UPLOAD_LONG_ABOUT: &str =
"Upload a Dart/Flutter symbol map (dartsymbolmap) for deobfuscating Dart exception types.{n}{n}Examples:{n} sentry-cli dart-symbol-map upload --org my-org --project my-proj path/to/dartsymbolmap.json path/to/debug/file{n}{n}The mapping must be a JSON array of strings with an even number of entries (pairs).{n}The debug file must contain exactly one Debug ID.";
"Upload a Dart/Flutter symbol map (dartsymbolmap) for deobfuscating Dart exception types.{n}{n}Examples:{n} sentry-cli dart-symbol-map upload --org my-org --project my-proj path/to/dartsymbolmap.json path/to/debug/file{n}{n}The mapping must be a JSON array of strings with an even number of entries (pairs).{n}The debug file must contain exactly one Debug ID. {n}{n}\
This command is supported on Sentry SaaS and self-hosted versions ≥25.8.0.";

#[derive(Args)]
pub(super) struct DartSymbolMapArgs {
Expand Down
7 changes: 1 addition & 6 deletions src/commands/dart_symbol_map/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::Path;
use anyhow::{bail, Context as _, Result};
use clap::Args;

use crate::api::{Api, ChunkUploadCapability};
use crate::api::Api;
use crate::config::Config;
use crate::constants::{DEFAULT_MAX_DIF_SIZE, DEFAULT_MAX_WAIT};
use crate::utils::chunks::{upload_chunked_objects, Assemblable, ChunkOptions, Chunked};
Expand Down Expand Up @@ -134,11 +134,6 @@ pub(super) fn execute(args: DartSymbolMapUploadArgs) -> Result<()> {
.authenticated()?
.get_chunk_upload_options(org)?;

if !chunk_upload_options.supports(ChunkUploadCapability::DartSymbolMap) {
bail!(
"Server does not support uploading Dart symbol maps via chunked upload. Please update your Sentry server."
);
}

// Early file size check against server or default limits (same as debug files)
let effective_max_file_size = if chunk_upload_options.max_file_size > 0 {
Expand Down
8 changes: 1 addition & 7 deletions src/commands/upload_proguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use symbolic::common::ByteView;
use uuid::Uuid;

use crate::api::Api;
use crate::api::ChunkUploadCapability;
use crate::config::Config;
use crate::utils::android::dump_proguard_uuids_as_properties;
use crate::utils::args::ArgExt as _;
Expand Down Expand Up @@ -148,10 +147,5 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
let (org, project) = config.get_org_and_project(matches)?;

let chunk_upload_options = authenticated_api.get_chunk_upload_options(&org)?;

if chunk_upload_options.supports(ChunkUploadCapability::Proguard) {
proguard::chunk_upload(&mappings, chunk_upload_options, &org, &project)
} else {
Err(anyhow::anyhow!("Server does not support uploading ProGuard mappings via chunked upload. Please update your Sentry server."))
}
proguard::chunk_upload(&mappings, chunk_upload_options, &org, &project)
}
31 changes: 27 additions & 4 deletions tests/integration/_cases/build/build-upload-help-macos.trycmd
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a long_about apparently causes clap to completely reformat the help text

Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,86 @@ $ sentry-cli build upload --help
? success
Upload builds to a project.

Usage: sentry-cli[EXE] build upload [OPTIONS] <PATH>...
This feature only works with Sentry SaaS.

Usage: sentry-cli build upload [OPTIONS] <PATH>...

Arguments:
<PATH>... The path to the build to upload. Supported files include Apk, Aab, XCArchive, and IPA.
<PATH>...
The path to the build to upload. Supported files include Apk, Aab, XCArchive, and IPA.

Options:
-o, --org <ORG>
The organization ID or slug.

--header <KEY:VALUE>
Custom headers that should be attached to all requests
in key:value format.

-p, --project <PROJECT>
The project ID or slug.

--auth-token <AUTH_TOKEN>
Use the given Sentry auth token.

--head-sha <head_sha>
The VCS commit sha to use for the upload. If not provided, the current commit sha will be
used.

--base-sha <base_sha>
The VCS commit's base sha to use for the upload. If not provided, the merge-base of the
current and remote branch will be used.

--log-level <LOG_LEVEL>
Set the log output verbosity. [possible values: trace, debug, info, warn, error]

--quiet
Do not print any output while preserving correct exit code. This flag is currently
implemented only for selected subcommands. [aliases: --silent]
implemented only for selected subcommands.

[aliases: --silent]

--vcs-provider <vcs_provider>
The VCS provider to use for the upload. If not provided, the current provider will be
used.

--head-repo-name <head_repo_name>
The name of the git repository to use for the upload (e.g. organization/repository). If
not provided, the current repository will be used.

--base-repo-name <base_repo_name>
The name of the git repository to use for the upload (e.g. organization/repository). If
not provided, the current repository will be used.

--head-ref <head_ref>
The reference (branch) to use for the upload. If not provided, the current reference will
be used.

--base-ref <base_ref>
The base reference (branch) to use for the upload. If not provided, the merge-base with
the remote tracking branch will be used.

--pr-number <pr_number>
The pull request number to use for the upload. If not provided and running in a
pull_request-triggered GitHub Actions workflow, the PR number will be automatically
detected from GitHub Actions environment variables.

--build-configuration <build_configuration>
The build configuration to use for the upload. If not provided, the current version will
be used.

--release-notes <release_notes>
The release notes to use for the upload.

--force-git-metadata
Force collection and sending of git metadata (branch, commit, etc.). If neither this nor
--no-git-metadata is specified, git metadata is automatically collected when running in
most CI environments.

--no-git-metadata
Disable collection and sending of git metadata.

-h, --help
Print help
Print help (see a summary with '-h')

```
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,86 @@
$ sentry-cli build upload --help
Upload builds to a project.

This feature only works with Sentry SaaS.

Usage: sentry-cli[EXE] build upload [OPTIONS] <PATH>...

Arguments:
<PATH>... The path to the build to upload. Supported files include Apk, and Aab.
<PATH>...
The path to the build to upload. Supported files include Apk, and Aab.

Options:
-o, --org <ORG>
The organization ID or slug.

--header <KEY:VALUE>
Custom headers that should be attached to all requests
in key:value format.

-p, --project <PROJECT>
The project ID or slug.

--auth-token <AUTH_TOKEN>
Use the given Sentry auth token.

--head-sha <head_sha>
The VCS commit sha to use for the upload. If not provided, the current commit sha will be
used.

--base-sha <base_sha>
The VCS commit's base sha to use for the upload. If not provided, the merge-base of the
current and remote branch will be used.

--log-level <LOG_LEVEL>
Set the log output verbosity. [possible values: trace, debug, info, warn, error]

--quiet
Do not print any output while preserving correct exit code. This flag is currently
implemented only for selected subcommands. [aliases: --silent]
implemented only for selected subcommands.

[aliases: --silent]

--vcs-provider <vcs_provider>
The VCS provider to use for the upload. If not provided, the current provider will be
used.

--head-repo-name <head_repo_name>
The name of the git repository to use for the upload (e.g. organization/repository). If
not provided, the current repository will be used.

--base-repo-name <base_repo_name>
The name of the git repository to use for the upload (e.g. organization/repository). If
not provided, the current repository will be used.

--head-ref <head_ref>
The reference (branch) to use for the upload. If not provided, the current reference will
be used.

--base-ref <base_ref>
The base reference (branch) to use for the upload. If not provided, the merge-base with
the remote tracking branch will be used.

--pr-number <pr_number>
The pull request number to use for the upload. If not provided and running in a
pull_request-triggered GitHub Actions workflow, the PR number will be automatically
detected from GitHub Actions environment variables.

--build-configuration <build_configuration>
The build configuration to use for the upload. If not provided, the current version will
be used.

--release-notes <release_notes>
The release notes to use for the upload.

--force-git-metadata
Force collection and sending of git metadata (branch, commit, etc.). If neither this nor
--no-git-metadata is specified, git metadata is automatically collected when running in
most CI environments.

--no-git-metadata
Disable collection and sending of git metadata.

-h, --help
Print help
Print help (see a summary with '-h')

```