diff --git a/design/multiple-arch-build-with-windows.md b/design/multiple-arch-build-with-windows.md index d4a5946406..0c61a66d65 100644 --- a/design/multiple-arch-build-with-windows.md +++ b/design/multiple-arch-build-with-windows.md @@ -17,8 +17,9 @@ At present, Velero by default build images locally, or no image or manifest is p ## Local Build -For local build, the images are only built for the platform (`/`) as same as the building env. E.g., when building from linux-amd64 env, a single manifest of linux-amd64 is created regardless how the input parameters are configured. -For local build, the `--output` parameter for `docker buildx build` is always `docker`. +For local build, two values of `--output` parameter for `docker buildx build` are supported: +- `docker`: a docker format image is built, but the image is only built for the platform (`/`) as same as the building env. E.g., when building from linux-amd64 env, a single manifest of linux-amd64 is created regardless how the input parameters are configured. +- `tar`: one or more images are built as tarballs according to the input platform (`/`) parameters. Specifically, one tarball is generated for each platform. The build process is the same with the `Build Separate Manifests` of `Push Build` as detailed below. Merely, the `--output` parameter diffs, as `type=tar;dest=`. The tarball is generated to the `_output` folder and named with the platform info, e.g., `_output/velero-main-linux-amd64.tar`. ## Push Build @@ -46,7 +47,7 @@ The created manifest will be pushed to registry by command `docker manifest push ## Input Parameters Below are the input parameters that are configurable to meet different build purposes during Dev and release cycle: -- BUILD_PUSH: whether to make a push build. Default value is `false` +- BUILD_OUTPUT_TYPE: the type of output for the build, i.e., `docker`, `tar`, `registry`, while `docker` and `tar` is for local build; `registry` means push build. Default value is `docker` - BUILD_OS: which types of OS should be built for. Multiple values are accepted, e.g., `linux,windows`. Default value is `linux` - BUILD_ARCH: which types of architecture should be built for. Multiple values are accepted, e.g., `amd64,arm64`. Default value is `amd64` - BUILD_TAG_GCR: whether to build and push GCR images. GCR images are not likely required during Dev cycle, so the default value is `false` @@ -56,8 +57,9 @@ Below are the input parameters that are configurable to meet different build pur Windows container images vary from Windows OS versions, e.g., `ltsc2022` for Windows server 2022 and `1809` for Windows server 2019. Images for different OS versions should be built separately. Therefore, separate build targets are added for each OS version, like `container-windows-%`. For the same reason, a new input parameter is added, `BUILD_WINDOWS_VERSION`. The default value is `ltsc2022`. Windows server 2022 is the only base image we will deliver officially, Windows server 2019 is not supported. In future, we may need to support Windows server 2025 base image. +For local build to tar, the Windows OS version is also added to the name of the tarball, e.g., `_output/velero-main-windows-ltsc2022-amd64.tar`. -At present, Windows container image only supports `amd64` as the architecture, so `BUILD_BUILD_ARCH` is ignored for Windows. +At present, Windows container image only supports `amd64` as the architecture, so `BUILD_ARCH` is ignored for Windows. The Windows manifests need to be annotated with os type, arch, and os version. This will be done through `docker manifest annotate` command. @@ -67,16 +69,37 @@ In order to use the images, the manifest list's tag should be provided to `veler ## Build Samples -**Local build** +**Local build to docker** ``` make container ``` -The built image could be listed by `docker image ls`. +The built image could be listed by `docker image ls`. + +**Local build for linux-amd64 and windows-amd64 to tar** +``` +BUILDX_OUTPUT_TYPE=tar BUILD_OS=linux,windows make container +``` +Under `_output` directory, below files are generated: +``` +velero-main-linux-amd64.tar +velero-main-windows-ltsc2022-amd64.tar +``` + +**Local build for linux-amd64, linux-arm64 and windows-amd64 to tar** +``` +BUILDX_OUTPUT_TYPE=tar BUILD_OS=linux,windows BUILD_ARCH=amd64,arm64 make container +``` +Under `_output` directory, below files are generated: +``` +velero-main-linux-amd64.tar +velero-main-linux-arm64.tar +velero-main-windows-ltsc2022-amd64.tar +``` **Push build for linux-amd64 and windows-amd64** Prerequisite: login to registry, e.g., through `docker login` ``` -BUILD_PUSH=true REGISTRY= BUILD_BUILD_OS=linux,windows make container +BUILDX_OUTPUT_TYPE=registry REGISTRY= BUILD_OS=linux,windows make container ``` Nothing is available locally, in the registry 3 tags are available: ``` @@ -88,7 +111,7 @@ velero/velero:main-linux-amd64 **Push build for linux-amd64, linux-arm64 and windows-amd64** Prerequisite: login to registry, e.g., through `docker login` ``` -BUILD_PUSH=true REGISTRY= BUILD_BUILD_OS=linux,windows BUILD_BUILD_ARCH=amd64,arm64 make container +BUILDX_OUTPUT_TYPE=registry REGISTRY= BUILD_OS=linux,windows BUILD_ARCH=amd64,arm64 make container ``` Nothing is available locally, in the registry 4 tags are available: ```