Skip to content

Commit

Permalink
Image Customizer: Move version into separate file. (#9304)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwize1 authored Jun 5, 2024
1 parent 77ebaa9 commit 41394c1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 38 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@
/toolkit/tools/osmodifier @microsoft/cbl-mariner-imagecustomizer
/toolkit/tools/pkg/imagecustomizerlib/ @microsoft/cbl-mariner-imagecustomizer
/toolkit/tools/pkg/osmodifierlib @microsoft/cbl-mariner-imagecustomizer
/toolkit/scripts/build_tag_imagecustomizer.mk @microsoft/cbl-mariner-imagecustomizer
1 change: 1 addition & 0 deletions toolkit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ include $(SCRIPTS_DIR)/profile.mk

# Set the variables for build number, distro tag, etc
include $(SCRIPTS_DIR)/build_tag.mk
include $(SCRIPTS_DIR)/build_tag_imagecustomizer.mk

# go utilities with:
# go-tools, clean-go-tools, go-tidy-all (tidy go utilities before committing) go-test-coverage
Expand Down
49 changes: 25 additions & 24 deletions toolkit/docs/building/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -806,30 +806,31 @@ To reproduce an ISO build, run the same make invocation as before, but set:

### Misc Build

| Variable | Default | Description
|:------------------------------|:-------------------------------------------------------------------------------------------------------|:---
| LOG_LEVEL | info | Console log level for go tools (`panic, fatal, error, warn, info, debug, trace`)
| LOG_COLOR | auto | Console log color for go tools (`always`, `auto`, `never`). `always` enables color in both logs and terminal output, `auto`(default option) enables color in terminal output, and `never` disables color in all.
| STOP_ON_WARNING | n | Stop on non-fatal makefile failures (see `$(call print_warning, message)`)
| STOP_ON_PKG_FAIL | n | Stop all package builds on any failure rather than try and continue.
| SRPM_FILE_SIGNATURE_HANDLING | enforce | Behavior when checking source file hashes from SPEC files. `update` will create a new entry in the signature file (`enforce, skip, update`)
| ARCHIVE_TOOL | $(shell if command -v pigz 1>/dev/null 2>&1 ; then echo pigz ; else echo gzip ; fi ) | Default tool to use in conjunction with `tar` to extract `*.tar.gz` files. Tries to use `pigz` if available, otherwise uses `gzip`
| INCREMENTAL_TOOLCHAIN | n | Only build toolchain RPM packages if they are not already present
| RUN_CHECK | n | Run the %check sections when compiling packages
| ALLOW_TOOLCHAIN_REBUILDS | n | Do not treat rebuilds of toolchain packages during regular package build phase as errors.
| PACKAGE_BUILD_RETRIES | 1 | Number of build retries for each package
| CHECK_BUILD_RETRIES | 1 | Minimum number of check section retries for each package if RUN_CHECK=y and tests fail.
| MAX_CASCADING_REBUILDS | | When a package rebuilds, how many additional layers of dependent packages will be forced to rebuild (leave unset for unbounded, i.e., all downstream packages will rebuild)
| EXTRA_BUILD_LAYERS | 0 | How many additional layers of the build graph to build beyond the requested packages (useful for testing changes in dependent packages)
| IMAGE_TAG | (empty) | Text appended to a resulting image name - empty by default. Does not apply to the initrd. The text will be prepended with a hyphen.
| CONCURRENT_PACKAGE_BUILDS | 0 | The maximum number of concurrent package builds that are allowed at once. If set to 0 this defaults to the number of logical CPUs.
| CLEANUP_PACKAGE_BUILDS | y | Cleanup a package build's working directory (`./build/worker/chroot/<pkg>/*`) when it finishes. Note that `rpmbuild`'s `BUILD` directory will still be removed on a successful package build even when this is turned off. Consider `make containerized-rpmbuild SRPM_PACKLIST=<pkg>` for debugging build issues instead. The user must call `sudo make clean-build-packages-workers` to tidy any uncleaned build environments after a build.
| USE_PACKAGE_BUILD_CACHE | y | Skip building a package if it and its dependencies are already built.
| NUM_OF_ANALYTICS_RESULTS | 10 | The number of entries to print when using the `graphanalytics` tool. If set to 0 this will print all available results.
| TARGET_ARCH | | The architecture of the machine that will run the package binaries.
| USE_CCACHE | n | Use ccache automatically to speed up repeat package builds.
| MAX_CPU | | Max number of CPUs used for package building. Use 0 for unlimited. Overrides `%_smp_ncpus_max` macro.
| BUILD_TOOLS_NONPROD | n | Enables non-production features in the go build tools.
| Variable | Default | Description
|:---------------------------------|:-------------------------------------------------------------------------------------------------------|:---
| LOG_LEVEL | info | Console log level for go tools (`panic, fatal, error, warn, info, debug, trace`)
| LOG_COLOR | auto | Console log color for go tools (`always`, `auto`, `never`). `always` enables color in both logs and terminal output, `auto`(default option) enables color in terminal output, and `never` disables color in all.
| STOP_ON_WARNING | n | Stop on non-fatal makefile failures (see `$(call print_warning, message)`)
| STOP_ON_PKG_FAIL | n | Stop all package builds on any failure rather than try and continue.
| SRPM_FILE_SIGNATURE_HANDLING | enforce | Behavior when checking source file hashes from SPEC files. `update` will create a new entry in the signature file (`enforce, skip, update`)
| ARCHIVE_TOOL | $(shell if command -v pigz 1>/dev/null 2>&1 ; then echo pigz ; else echo gzip ; fi ) | Default tool to use in conjunction with `tar` to extract `*.tar.gz` files. Tries to use `pigz` if available, otherwise uses `gzip`
| INCREMENTAL_TOOLCHAIN | n | Only build toolchain RPM packages if they are not already present
| RUN_CHECK | n | Run the %check sections when compiling packages
| ALLOW_TOOLCHAIN_REBUILDS | n | Do not treat rebuilds of toolchain packages during regular package build phase as errors.
| PACKAGE_BUILD_RETRIES | 1 | Number of build retries for each package
| CHECK_BUILD_RETRIES | 1 | Minimum number of check section retries for each package if RUN_CHECK=y and tests fail.
| MAX_CASCADING_REBUILDS | | When a package rebuilds, how many additional layers of dependent packages will be forced to rebuild (leave unset for unbounded, i.e., all downstream packages will rebuild)
| EXTRA_BUILD_LAYERS | 0 | How many additional layers of the build graph to build beyond the requested packages (useful for testing changes in dependent packages)
| IMAGE_TAG | (empty) | Text appended to a resulting image name - empty by default. Does not apply to the initrd. The text will be prepended with a hyphen.
| CONCURRENT_PACKAGE_BUILDS | 0 | The maximum number of concurrent package builds that are allowed at once. If set to 0 this defaults to the number of logical CPUs.
| CLEANUP_PACKAGE_BUILDS | y | Cleanup a package build's working directory (`./build/worker/chroot/<pkg>/*`) when it finishes. Note that `rpmbuild`'s `BUILD` directory will still be removed on a successful package build even when this is turned off. Consider `make containerized-rpmbuild SRPM_PACKLIST=<pkg>` for debugging build issues instead. The user must call `sudo make clean-build-packages-workers` to tidy any uncleaned build environments after a build.
| USE_PACKAGE_BUILD_CACHE | y | Skip building a package if it and its dependencies are already built.
| NUM_OF_ANALYTICS_RESULTS | 10 | The number of entries to print when using the `graphanalytics` tool. If set to 0 this will print all available results.
| TARGET_ARCH | | The architecture of the machine that will run the package binaries.
| USE_CCACHE | n | Use ccache automatically to speed up repeat package builds.
| MAX_CPU | | Max number of CPUs used for package building. Use 0 for unlimited. Overrides `%_smp_ncpus_max` macro.
| BUILD_TOOLS_NONPROD | n | Enables non-production features in the go build tools.
| IMAGE_CUSTOMIZER_VERSION_PREVIEW | -dev.\<date>.\<time>+\<commit-id> | Overrides the prefix suffix of the Image Customizer version string.

---

Expand Down
13 changes: 0 additions & 13 deletions toolkit/scripts/build_tag.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,3 @@ DIST_VERSION_MACRO := $(DIST_NAME_ABRV) $(dist_major_version_number)

##help:var:DIST_TAG:<dist_tag>=Distribution tag, defines the "dist" macro used by the specs. Default: '.<DIST_NAME_ABRV><dist_major_version_number>' e.g., ".azl3"
DIST_TAG ?= .$(DIST_NAME_ABRV)$(dist_major_version_number)

# Azure Linux Image Customizer version.
# This is using semantic versioning.
#
# IMAGE_CUSTOMIZER_VERSION should have the format:
#
# <major>.<minor>.<patch>
#
# and should hold the value of the next (or current) official release, not the previous official
# release.
IMAGE_CUSTOMIZER_VERSION ?= 0.2.0
IMAGE_CUSTOMIZER_VERSION_PREVIEW ?= -dev.$(DATETIME_AS_VERSION)+$(GIT_COMMIT_ID)
IMAGE_CUSTOMIZER_FULL_VERSION := $(IMAGE_CUSTOMIZER_VERSION)$(IMAGE_CUSTOMIZER_VERSION_PREVIEW)
15 changes: 15 additions & 0 deletions toolkit/scripts/build_tag_imagecustomizer.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Azure Linux Image Customizer version.
# This is using semantic versioning.
#
# image_customizer_version should have the format:
#
# <major>.<minor>.<patch>
#
# and should hold the value of the next (or current) official release, not the previous official
# release.
image_customizer_version ?= 0.3.0
IMAGE_CUSTOMIZER_VERSION_PREVIEW ?= -dev.$(DATETIME_AS_VERSION)+$(GIT_COMMIT_ID)
image_customizer_full_version := $(image_customizer_version)$(IMAGE_CUSTOMIZER_VERSION_PREVIEW)
2 changes: 1 addition & 1 deletion toolkit/scripts/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ clean-go-tools:
rm -rf $(BUILD_DIR)/tools

go_ldflags := -X github.com/microsoft/azurelinux/toolkit/tools/internal/exe.ToolkitVersion=$(RELEASE_VERSION) \
-X github.com/microsoft/azurelinux/toolkit/tools/pkg/imagecustomizerlib.ToolVersion=$(IMAGE_CUSTOMIZER_FULL_VERSION) \
-X github.com/microsoft/azurelinux/toolkit/tools/pkg/imagecustomizerlib.ToolVersion=$(image_customizer_full_version) \
-X github.com/microsoft/azurelinux/toolkit/tools/internal/exe.DistroNameAbbreviation=$(DIST_NAME_ABRV) \
-X github.com/microsoft/azurelinux/toolkit/tools/internal/exe.DistroMajorVersion=$(dist_major_version_number)

Expand Down

0 comments on commit 41394c1

Please sign in to comment.