diff --git a/docs/03-Tagged-versions.md b/docs/03-Tagged-versions.md index f8b58c8..270ca11 100644 --- a/docs/03-Tagged-versions.md +++ b/docs/03-Tagged-versions.md @@ -3,24 +3,20 @@ Over time the SDK will introduce major changes that will break behavior; In order to easily use older versions we support tagged versions. -There are two parts to a SDK version the scripts and the image. +To use a specific tag the `wkdev-create` and `wkdev-sdk-bakery` commands take a `--tag` +argument. You can also set the `WKDEV_SDK_TAG` environment variable. -## Images +To get a list of available tags you can pass `--list-tags` to `wkdev-create`. -To use an older image with the latest scripts you can set `WKDEV_SDK_TAG`, e.g.: +For example using an older image when creating a container: ```sh -export WKDEV_SDK_TAG='23.04' -wkdev-create --name='example-name' +wkdev-create --name='example-name' --tag='23.04' ``` As the scripts diverge from older images this *may* fail but for now should work fine. - -## Scripts - -To use older scripts you can simply checkout the branch for that tag: `git checkout tag/23.04`. - -This will use the `23.04` image by default but you may override it with `WKDEV_SDK_TAG`. +However to use older scripts you can simply checkout the branch for that tag: `git checkout tag/23.04`. +This will use the `23.04` image by default but you may override as mentioned above. ## Creating a tag diff --git a/scripts/host-only/wkdev-create b/scripts/host-only/wkdev-create index 759627a..961052f 100755 --- a/scripts/host-only/wkdev-create +++ b/scripts/host-only/wkdev-create @@ -25,6 +25,8 @@ argsparse_use_option =name: "Name of container" default:wkdev argsparse_use_option rm "Force removal of container if it already exists." argsparse_use_option attach "Attach to container as it starts up." argsparse_use_option no-pull "Do not login or pull images." +argsparse_use_option list-tags "List available image tags." +argsparse_use_option =tag: "Create the container using a specific tag, see-also --list-tags." default:$(get_default_container_tag) argsparse_usage_description="$(cat <> @@ -56,6 +58,14 @@ process_command_line_arguments() { argsparse_parse_options "${@}" argsparse_is_option_set "trace" && set -o xtrace + if argsparse_is_option_set "list-tags"; then + echo "" + podman search "$(get_sdk_qualified_name)" --list-tags --format='{{ .Tag }}' + exit 0 + fi + + container_tag="${program_options["tag"]}" + container_shell="${program_options["shell"]}" container_name="${program_options["name"]}" container_user_home="${program_options["home"]}" @@ -450,7 +460,7 @@ build_podman_create_arguments() { try_process_podman ${1} set -o nounset - arguments+=("$(get_sdk_qualified_name_and_tag)") + arguments+=("$(get_sdk_qualified_name):${container_tag}") # Entry point arguments+=("/wkdev-sdk/scripts/container-only/.wkdev-init") diff --git a/scripts/host-only/wkdev-sdk-bakery b/scripts/host-only/wkdev-sdk-bakery index b7ae6b6..da845d2 100755 --- a/scripts/host-only/wkdev-sdk-bakery +++ b/scripts/host-only/wkdev-sdk-bakery @@ -20,6 +20,7 @@ argsparse_use_option =verbose "Increase verbosity of this script" argsparse_use_option =name: "Name of container image" mandatory default:wkdev-sdk argsparse_use_option =mode: "Operation mode: 'build', 'deploy', or 'export'" mandatory argsparse_use_option idle-cores: "Number of CPU cores to leave idle, when building the image" type:uint default:2 +argsparse_use_option =tag: "Tag to use for created image." default:$(get_default_container_tag) argsparse_usage_description="$(cat <> @@ -33,21 +34,22 @@ argsparse_usage_description="$(cat <//:" -get_qualified_name_and_tag() { - - local image_name="${1}" - local image_tag="${2}" - echo "$(get_qualified_name "${image_name}"):${image_tag}" -} # Get absolute path to 'user_home_directory_defaults' directory in the wkdev-sdk. get_container_home_defaults_directory_name() { echo "${WKDEV_SDK}/images/wkdev_sdk/user_home_directory_defaults"; } ##### wkdev-sdk definitions get_sdk_image_name() { echo "wkdev-sdk"; } -get_sdk_image_tag() { get_container_tag; } -get_sdk_qualified_name_and_tag() { get_qualified_name_and_tag "$(get_sdk_image_name)" "$(get_sdk_image_tag)"; } +get_sdk_qualified_name() { get_qualified_name "$(get_sdk_image_name)"; }