Skip to content

Commit

Permalink
fix(ci): always serialize upload_files
Browse files Browse the repository at this point in the history
While it's usually an error if we received a totally empty set of
artifacts, it's possible in the global build job under a very
specific set of conditions:

* There are no installers, *and*
* The source tarball was disabled

In this case we need to make sure we still provide an upload_files
array in the manifest so that we can always index into it.

Fixes #1387.
  • Loading branch information
mistydemeo committed Sep 18, 2024
1 parent bb48ed6 commit 4c66d7b
Show file tree
Hide file tree
Showing 56 changed files with 107 additions and 51 deletions.
3 changes: 2 additions & 1 deletion cargo-dist-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ pub struct DistManifest {
pub linkage: Vec<Linkage>,
/// Files to upload
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
// We need to make sure we always serialize this when it's empty,
// because we index into this array unconditionally during upload.
pub upload_files: Vec<String>,
/// Whether Artifact Attestations should be found in the GitHub Release
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ expression: json_schema
},
"upload_files": {
"description": "Files to upload",
"default": [],
"type": "array",
"items": {
"type": "string"
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/akaikatana_basic.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,8 @@ try {
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/akaikatana_musl.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,8 @@ download_binary_and_run_installer "$@" || exit 1
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,8 @@ try {
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,8 @@ try {
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/akaikatana_updaters.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,8 @@ try {
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
1 change: 1 addition & 0 deletions cargo-dist/tests/snapshots/axolotlsay_abyss.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3677,6 +3677,7 @@ run("axolotlsay");
}
},
"linkage": [],
"upload_files": [],
"github_attestations": true
}

Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3670,7 +3670,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_alias.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3700,7 +3700,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3702,7 +3702,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_basic.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3668,7 +3668,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3764,7 +3764,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3668,7 +3668,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_checksum_blake2b.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,8 @@ download_binary_and_run_installer "$@" || exit 1
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_checksum_blake2s.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,8 @@ download_binary_and_run_installer "$@" || exit 1
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_256.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,8 @@ download_binary_and_run_installer "$@" || exit 1
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_checksum_sha3_512.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,8 @@ download_binary_and_run_installer "$@" || exit 1
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_custom_formula.snap
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ end
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ expression: self.payload
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3657,7 +3657,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_dispatch.snap
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ expression: self.payload
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_dispatch_abyss.snap
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ expression: self.payload
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ expression: self.payload
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4016,7 +4016,8 @@ try {
"pr_run_mode": "upload"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3670,7 +3670,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_musl.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3011,7 +3011,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_no_locals.snap
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ expression: self.payload
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ expression: self.payload
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3706,7 +3706,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,8 @@ try {
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,8 @@ try {
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_tag_namespace.snap
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ expression: self.payload
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ owo-release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_updaters.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,8 @@ run("axolotlsay");
"pr_run_mode": "plan"
}
},
"linkage": []
"linkage": [],
"upload_files": []
}

================ release.yml ================
Expand Down
Loading

0 comments on commit 4c66d7b

Please sign in to comment.