Skip to content

feat: receive and use tags in image options #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion src/batchimages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Base.@kwdef struct BatchImage
image::String
_cpu_image_key::Union{String, Nothing}
_gpu_image_key::Union{String, Nothing}
_image_tag::Union{String, Nothing}
_image_sha::Union{String, Nothing}
_is_product_default::Bool
_interactive_product_name::Union{String, Nothing}
end
Expand All @@ -34,6 +36,8 @@ function Base.show(io::IO, ::MIME"text/plain", image::BatchImage)
print(io, '\n', " image: ", image.image)
isnothing(image._cpu_image_key) || print(io, "\n CPU image: ", image._cpu_image_key)
isnothing(image._gpu_image_key) || print(io, "\n GPU image: ", image._gpu_image_key)
isnothing(image._image_tag) || print(io, ":$(image._image_tag)")
isnothing(image._image_sha) || print(io, ":$(image._image_sha)")
if !isnothing(image._interactive_product_name)
print(io, "\n Features:")
print(io, "\n - Expose Port: ✓")
Expand Down Expand Up @@ -214,6 +218,8 @@ Base.@kwdef mutable struct _ImageKeys
isdefault::Bool = false
cpu::Union{String, Nothing} = nothing
gpu::Union{String, Nothing} = nothing
tag::Union{String, Nothing} = nothing
sha::Union{String, Nothing} = nothing
end

function _group_images(images; image_group::AbstractString)
Expand All @@ -231,9 +237,13 @@ function _group_images(images; image_group::AbstractString)
end
image_key_name = _get_json(image, "image_key_name", String)
display_name = _get_json(image, "display_name", String)
tag = _get_json_or(image, "image_tag", Union{String, Nothing})
sha = _get_json_or(image, "image_sha", Union{String, Nothing})
image_type = _parse_image_group_entry_type(image)
isnothing(image_type) && continue # invalid image type will return a nothing, which we will ignore
imagekeys = get!(grouped_images, display_name, _ImageKeys(; isdefault=image_type.isdefault))
imagekeys = get!(
grouped_images, display_name, _ImageKeys(; isdefault=image_type.isdefault, tag, sha)
)
# If this image key set is already problematic, no point in checking further
imagekeys.error && continue
# We make sure that there are no conflicts with base- and option- image types
Expand Down Expand Up @@ -333,6 +343,8 @@ function _batchimages_62(auth::Authentication)
_gpu_image_key = imagekey.gpu,
_is_product_default = imagekey.isdefault,
_interactive_product_name = interactive_product_name,
_image_tag = imagekey.tag,
_image_sha = imagekey.sha,
)
end
end
Expand Down
12 changes: 10 additions & 2 deletions src/jobsubmission.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct _JobSubmission1
# Job image configuration
product_name::Union{String, Nothing}
image::Union{String, Nothing}
image_tag::Union{String, Nothing}
image_sha256::Union{String, Nothing}
sysimage_build::Union{String, Nothing}
sysimage_manifest_sha::Union{String, Nothing}
Expand Down Expand Up @@ -56,6 +57,7 @@ struct _JobSubmission1
# Job image configuration
product_name::Union{AbstractString, Nothing}=nothing,
image::Union{AbstractString, Nothing}=nothing,
image_tag::Union{AbstractString, Nothing}=nothing,
image_sha256::Union{AbstractString, Nothing}=nothing,
sysimage_build::Union{Bool, Nothing}=nothing,
sysimage_manifest_sha::Union{AbstractString, Nothing}=nothing,
Expand Down Expand Up @@ -138,7 +140,8 @@ struct _JobSubmission1
appbundle, appbundle_upload_info,
registry_name, package_name, branch_name, git_revision,
# Job image configuration
product_name, image, image_sha256, string(sysimage_build), sysimage_manifest_sha,
product_name, image, image_tag, image_sha256,
string(sysimage_build), sysimage_manifest_sha,
# Compute configuration
node_class, string(cpu),
string(nworkers), _string_or_nothing(elastic), _string_or_nothing(min_workers_required),
Expand Down Expand Up @@ -1311,7 +1314,12 @@ function _job_submit_args(
end
batch.image._cpu_image_key
end
(; product_name=batch.image.product, image)
(;
product_name=batch.image.product,
image,
image_tag=batch.image._image_tag,
image_sha256=batch.image._image_sha,
)
else
(;)
end
Expand Down
Loading