anodizer_core/config/blob.rs
1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use super::{
5 ExtraFileSpec, StringOrBool, TemplatedExtraFile, deserialize_string_or_bool_opt,
6 deserialize_string_or_vec_opt,
7};
8
9// ---------------------------------------------------------------------------
10// BlobConfig (S3/GCS/Azure cloud storage)
11// ---------------------------------------------------------------------------
12
13#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
14#[serde(default)]
15pub struct BlobConfig {
16 /// Unique identifier for this blob config.
17 pub id: Option<String>,
18 /// Cloud storage provider: s3, gcs (or gs), or azblob (or azure).
19 pub provider: String,
20 /// Bucket or container name (supports templates).
21 pub bucket: String,
22 /// Directory/folder within the bucket (supports templates).
23 /// Default: `{{ ProjectName }}/{{ Tag }}`.
24 pub directory: Option<String>,
25 /// AWS region (S3 only).
26 pub region: Option<String>,
27 /// Custom endpoint URL for S3-compatible storage (e.g. MinIO, R2, DO Spaces).
28 pub endpoint: Option<String>,
29 /// Disable SSL for the connection (S3 only, default: false).
30 pub disable_ssl: Option<bool>,
31 /// Enable path-style addressing for S3-compatible backends.
32 /// Defaults to `true` when `endpoint` is set (MinIO, R2, DO Spaces need this),
33 /// `false` otherwise (standard AWS virtual-hosted style).
34 pub s3_force_path_style: Option<bool>,
35 /// Canned ACL for uploaded objects.
36 /// **S3**: one of `private` (default), `public-read`, `public-read-write`,
37 /// `authenticated-read`, `aws-exec-read`, `bucket-owner-read`,
38 /// `bucket-owner-full-control`. Matches GoReleaser's accepted set;
39 /// AWS's `log-delivery-write` is intentionally omitted because it is only
40 /// valid on `S3LogBucket` targets and would silently fail on a normal bucket.
41 /// **GCS**: pass the camelCase predefined-ACL name (e.g. `publicRead`,
42 /// `bucketOwnerFullControl`); not validated up-front, so a typo surfaces
43 /// as a 400 from the GCS API at upload time.
44 pub acl: Option<String>,
45 /// HTTP Cache-Control header values, joined with ", " when uploading.
46 /// Accepts a string (single value) or array of strings in YAML.
47 #[serde(deserialize_with = "deserialize_string_or_vec_opt", default)]
48 pub cache_control: Option<Vec<String>>,
49 /// HTTP Content-Disposition header (supports templates).
50 /// Default: `"attachment;filename={{Filename}}"`. Set to `"-"` to disable.
51 pub content_disposition: Option<String>,
52 /// AWS KMS encryption key for server-side encryption (S3 only).
53 pub kms_key: Option<String>,
54 /// Build IDs to include. Empty means all artifacts.
55 pub ids: Option<Vec<String>>,
56 /// Skip this blob config. Accepts bool or template string
57 /// (e.g. `"{{ if IsSnapshot }}true{{ endif }}"` for conditional skip).
58 #[serde(deserialize_with = "deserialize_string_or_bool_opt", default)]
59 pub skip: Option<StringOrBool>,
60 /// Also upload metadata.json and artifacts.json.
61 pub include_meta: Option<bool>,
62 /// Pre-existing files to upload (supports glob patterns).
63 pub extra_files: Option<Vec<ExtraFileSpec>>,
64 /// Extra files whose contents are rendered through the template engine before upload.
65 /// Unlike `extra_files` which copy as-is, template variables like `{{ .Tag }}` are expanded.
66 /// GoReleaser Pro feature.
67 pub templated_extra_files: Option<Vec<TemplatedExtraFile>>,
68 /// Upload only extra files (skip artifacts).
69 pub extra_files_only: Option<bool>,
70 /// Maximum number of parallel uploads for this blob config.
71 /// Overrides the global `--parallelism` setting when set.
72 pub parallelism: Option<usize>,
73 /// When `true`, a failed blob upload counts as a required-publisher
74 /// failure: trips the submitter gate (chocolatey/winget/snapcraft/aur
75 /// don't run if blob failed) and surfaces in
76 /// `report.required_failures()` so the CLI exits non-zero.
77 ///
78 /// Default: `false`. Snapshot release pipelines typically don't
79 /// require blobs; production pipelines that ship binaries via S3/GCS
80 /// often do.
81 ///
82 /// When multiple blob configs exist, the blob stage records ONE
83 /// aggregated `PublisherResult`: `required = true` if ANY config opted
84 /// in. Same semantics as "any required blob target failing should
85 /// fail the release."
86 pub required: Option<bool>,
87}