Merge pull request #11036 from sjackman/sj/ghcr-compact
GHCR: Use reject to remove empty hash values
This commit is contained in:
commit
480d943035
@ -206,8 +206,7 @@ class GitHubPackages
|
|||||||
"org.opencontainers.image.url" => bottle_hash["formula"]["homepage"],
|
"org.opencontainers.image.url" => bottle_hash["formula"]["homepage"],
|
||||||
"org.opencontainers.image.vendor" => org,
|
"org.opencontainers.image.vendor" => org,
|
||||||
"org.opencontainers.image.version" => version,
|
"org.opencontainers.image.version" => version,
|
||||||
}
|
}.reject { |_, v| v.blank? }
|
||||||
delete_blank_hash_values(formula_annotations_hash)
|
|
||||||
|
|
||||||
manifests = bottle_hash["bottle"]["tags"].map do |bottle_tag, tag_hash|
|
manifests = bottle_hash["bottle"]["tags"].map do |bottle_tag, tag_hash|
|
||||||
local_file = tag_hash["local_filename"]
|
local_file = tag_hash["local_filename"]
|
||||||
@ -250,8 +249,7 @@ class GitHubPackages
|
|||||||
architecture: architecture,
|
architecture: architecture,
|
||||||
os: os,
|
os: os,
|
||||||
"os.version" => os_version,
|
"os.version" => os_version,
|
||||||
}
|
}.reject { |_, v| v.blank? }
|
||||||
delete_blank_hash_values(platform_hash)
|
|
||||||
|
|
||||||
tar_sha256 = Digest::SHA256.hexdigest(
|
tar_sha256 = Digest::SHA256.hexdigest(
|
||||||
Utils.safe_popen_read("gunzip", "--stdout", "--decompress", local_file),
|
Utils.safe_popen_read("gunzip", "--stdout", "--decompress", local_file),
|
||||||
@ -270,8 +268,7 @@ class GitHubPackages
|
|||||||
"sh.brew.bottle.digest" => tar_gz_sha256,
|
"sh.brew.bottle.digest" => tar_gz_sha256,
|
||||||
"sh.brew.bottle.glibc.version" => glibc_version,
|
"sh.brew.bottle.glibc.version" => glibc_version,
|
||||||
"sh.brew.tab" => tab.to_json,
|
"sh.brew.tab" => tab.to_json,
|
||||||
}
|
}.reject { |_, v| v.blank? }
|
||||||
delete_blank_hash_values(descriptor_annotations_hash)
|
|
||||||
|
|
||||||
annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
|
annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
|
||||||
{
|
{
|
||||||
@ -279,8 +276,7 @@ class GitHubPackages
|
|||||||
"org.opencontainers.image.documentation" => documentation,
|
"org.opencontainers.image.documentation" => documentation,
|
||||||
"org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
|
"org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
|
||||||
},
|
},
|
||||||
).sort.to_h
|
).reject { |_, v| v.blank? }.sort.to_h
|
||||||
delete_blank_hash_values(annotations_hash)
|
|
||||||
|
|
||||||
image_manifest = {
|
image_manifest = {
|
||||||
schemaVersion: 2,
|
schemaVersion: 2,
|
||||||
@ -388,10 +384,4 @@ class GitHubPackages
|
|||||||
|
|
||||||
[sha256, json.size]
|
[sha256, json.size]
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_blank_hash_values(hash)
|
|
||||||
hash.each do |key, value|
|
|
||||||
hash.delete(key) if value.blank?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user