2020-09-24 00:08:47 +03:00
REGISTRY ?= ghcr.io
2022-03-23 20:02:22 +03:00
USERNAME ?= siderolabs
2019-12-24 23:23:52 +03:00
SHA ?= $( shell git describe --match= none --always --abbrev= 8 --dirty)
2021-09-13 17:34:15 +03:00
TAG ?= $( shell git describe --tag --always --dirty --match v[ 0-9] \* )
2022-03-30 22:05:43 +03:00
ABBREV_TAG ?= $( shell git describe --tag --always --match v[ 0-9] \* --abbrev= 0 )
2021-08-16 18:23:39 +03:00
TAG_SUFFIX ?=
2021-08-10 22:49:33 +03:00
SOURCE_DATE_EPOCH ?= $( shell git log -1 --pretty= %ct)
2021-02-24 15:43:27 +03:00
IMAGE_REGISTRY ?= $( REGISTRY)
2021-08-16 18:23:39 +03:00
IMAGE_TAG ?= $( TAG) $( TAG_SUFFIX)
2019-12-24 23:23:52 +03:00
BRANCH ?= $( shell git rev-parse --abbrev-ref HEAD)
2021-02-24 15:43:27 +03:00
REGISTRY_AND_USERNAME := $( IMAGE_REGISTRY) /$( USERNAME)
2020-02-13 23:07:36 +03:00
DOCKER_LOGIN_ENABLED ?= true
2021-03-29 17:27:23 +03:00
NAME = Talos
2019-12-23 21:36:14 +03:00
2019-12-24 23:23:52 +03:00
ARTIFACTS := _out
2022-03-23 20:02:22 +03:00
TOOLS ?= ghcr.io/siderolabs/tools:v1.1.0-alpha.0-1-g99be089
2022-03-30 17:07:08 +03:00
PKGS ?= v1.1.0-alpha.0-15-g4b3e70e
2022-03-22 21:16:30 +03:00
EXTRAS ?= v1.1.0-alpha.0
2021-09-13 17:34:15 +03:00
GO_VERSION ?= 1.17
2022-03-23 10:49:07 +03:00
GOIMPORTS_VERSION ?= v0.1.10
GOFUMPT_VERSION ?= v0.3.0
GOLANGCILINT_VERSION ?= v1.45.0
2021-09-13 17:34:15 +03:00
STRINGER_VERSION ?= v0.1.5
2021-12-30 15:57:32 +03:00
ENUMER_VERSION ?= v1.1.2
2021-07-19 14:57:33 +03:00
DEEPCOPY_GEN_VERSION ?= v0.21.3
2021-11-08 18:31:05 +03:00
VTPROTOBUF_VERSION ?= v0.2.0
2022-03-23 20:02:22 +03:00
IMPORTVET ?= ghcr.io/siderolabs/importvet:c9424fe
2019-12-24 23:23:52 +03:00
OPERATING_SYSTEM := $( shell uname -s | tr "[:upper:]" "[:lower:]" )
2020-06-14 02:43:22 +03:00
TALOSCTL_DEFAULT_TARGET := talosctl-$( OPERATING_SYSTEM)
2020-01-05 00:19:34 +03:00
INTEGRATION_TEST_DEFAULT_TARGET := integration-test-$( OPERATING_SYSTEM)
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
INTEGRATION_TEST_PROVISION_DEFAULT_TARGET := integration-test-provision-$( OPERATING_SYSTEM)
2022-03-31 18:04:52 +03:00
KUBECTL_URL ?= https://storage.googleapis.com/kubernetes-release/release/v1.24.0-beta.0/bin/$( OPERATING_SYSTEM) /amd64/kubectl
2022-01-21 16:37:13 +03:00
KUBESTR_URL ?= https://github.com/kastenhq/kubestr/releases/download/v0.4.31/kubestr_0.4.31_Linux_amd64.tar.gz
2022-02-03 16:53:01 +03:00
CLUSTERCTL_VERSION ?= 1.0.4
2020-04-29 22:24:07 +03:00
CLUSTERCTL_URL ?= https://github.com/kubernetes-sigs/cluster-api/releases/download/v$( CLUSTERCTL_VERSION) /clusterctl-$( OPERATING_SYSTEM) -amd64
2022-03-23 20:02:22 +03:00
D2CTL_URL ?= https://github.com/siderolabs/day-two/releases/download/v0.1.0-alpha.1/d2ctl-$( OPERATING_SYSTEM) -amd64
2022-03-21 13:18:58 +03:00
PULUMI_URL ?= https://get.pulumi.com/releases/sdk/pulumi-v3.26.1-$( OPERATING_SYSTEM) -x64.tar.gz
2020-08-17 19:12:47 +03:00
TESTPKGS ?= github.com/talos-systems/talos/...
2022-03-30 16:13:29 +03:00
RELEASES ?= v0.14.3 v1.0.0
2020-06-25 22:56:59 +03:00
SHORT_INTEGRATION_TEST ?=
2020-07-01 18:34:20 +03:00
CUSTOM_CNI_URL ?=
2021-05-31 20:30:01 +03:00
INSTALLER_ARCH ?= all
2019-12-24 23:23:52 +03:00
2021-03-29 17:27:23 +03:00
CGO_ENABLED ?= 0
GO_BUILDFLAGS ?=
2022-03-28 12:07:37 +03:00
GO_LDFLAGS ?=
2021-03-29 17:27:23 +03:00
2021-05-13 13:28:38 +03:00
WITH_RACE ?= false
WITH_DEBUG ?= false
2021-03-29 17:27:23 +03:00
2021-05-26 17:20:54 +03:00
i f n e q ( , $( filter $ ( WITH_RACE ) , t true TRUE y yes 1) )
2021-03-29 17:27:23 +03:00
CGO_ENABLED = 1
GO_BUILDFLAGS += -race
GO_LDFLAGS += -linkmode= external -extldflags '-static'
2021-05-31 20:30:01 +03:00
INSTALLER_ARCH = targetarch
2021-03-29 17:27:23 +03:00
e n d i f
2021-05-26 17:20:54 +03:00
i f n e q ( , $( filter $ ( WITH_DEBUG ) , t true TRUE y yes 1) )
2021-05-13 11:56:26 +03:00
GO_BUILDFLAGS += -tags sidero.debug
2021-05-17 12:39:27 +03:00
e l s e
GO_LDFLAGS += -s -w
2021-05-13 11:56:26 +03:00
e n d i f
2020-09-26 00:00:43 +03:00
, : = ,
2020-10-30 01:08:05 +03:00
space := $( subst ,, )
2019-12-24 23:23:52 +03:00
BUILD := docker buildx build
2019-12-23 21:36:14 +03:00
PLATFORM ?= linux/amd64
PROGRESS ?= auto
PUSH ?= false
COMMON_ARGS := --file= Dockerfile
COMMON_ARGS += --progress= $( PROGRESS)
COMMON_ARGS += --platform= $( PLATFORM)
COMMON_ARGS += --push= $( PUSH)
COMMON_ARGS += --build-arg= TOOLS = $( TOOLS)
2020-09-07 16:52:26 +03:00
COMMON_ARGS += --build-arg= PKGS = $( PKGS)
2020-10-08 22:46:55 +03:00
COMMON_ARGS += --build-arg= EXTRAS = $( EXTRAS)
2020-07-16 16:25:04 +03:00
COMMON_ARGS += --build-arg= GOFUMPT_VERSION = $( GOFUMPT_VERSION)
2022-03-23 10:49:07 +03:00
COMMON_ARGS += --build-arg= GOIMPORTS_VERSION = $( GOIMPORTS_VERSION)
2021-04-12 15:34:48 +03:00
COMMON_ARGS += --build-arg= STRINGER_VERSION = $( STRINGER_VERSION)
2021-12-30 15:57:32 +03:00
COMMON_ARGS += --build-arg= ENUMER_VERSION = $( ENUMER_VERSION)
2021-07-07 18:12:53 +03:00
COMMON_ARGS += --build-arg= DEEPCOPY_GEN_VERSION = $( DEEPCOPY_GEN_VERSION)
2021-08-09 14:46:00 +03:00
COMMON_ARGS += --build-arg= VTPROTOBUF_VERSION = $( VTPROTOBUF_VERSION)
2022-01-26 16:02:31 +03:00
COMMON_ARGS += --build-arg= GOLANGCILINT_VERSION = $( GOLANGCILINT_VERSION)
2019-12-23 21:36:14 +03:00
COMMON_ARGS += --build-arg= TAG = $( TAG)
2021-08-10 22:49:33 +03:00
COMMON_ARGS += --build-arg= SOURCE_DATE_EPOCH = $( SOURCE_DATE_EPOCH)
2019-12-27 23:49:24 +03:00
COMMON_ARGS += --build-arg= ARTIFACTS = $( ARTIFACTS)
2020-05-08 21:44:20 +03:00
COMMON_ARGS += --build-arg= IMPORTVET = $( IMPORTVET)
2019-11-01 07:55:58 +03:00
COMMON_ARGS += --build-arg= TESTPKGS = $( TESTPKGS)
2021-05-31 20:30:01 +03:00
COMMON_ARGS += --build-arg= INSTALLER_ARCH = $( INSTALLER_ARCH)
2021-03-29 17:27:23 +03:00
COMMON_ARGS += --build-arg= CGO_ENABLED = $( CGO_ENABLED)
COMMON_ARGS += --build-arg= GO_BUILDFLAGS = " $( GO_BUILDFLAGS) "
COMMON_ARGS += --build-arg= GO_LDFLAGS = " $( GO_LDFLAGS) "
2020-02-20 14:33:12 +03:00
COMMON_ARGS += --build-arg= http_proxy = $( http_proxy)
COMMON_ARGS += --build-arg= https_proxy = $( https_proxy)
2022-03-28 12:07:37 +03:00
COMMON_ARGS += --build-arg= NAME = $( NAME)
COMMON_ARGS += --build-arg= SHA = $( SHA)
COMMON_ARGS += --build-arg= USERNAME = $( USERNAME)
COMMON_ARGS += --build-arg= REGISTRY = $( REGISTRY)
COMMON_ARGS += --build-arg= ABBREV_TAG = $( ABBREV_TAG)
2019-04-24 04:52:31 +03:00
2020-07-23 21:21:42 +03:00
CI_ARGS ?=
2021-12-03 14:18:59 +03:00
all : initramfs kernel installer imager talosctl talosctl -image talos
2019-12-24 23:23:52 +03:00
# Help Menu
d e f i n e H E L P _ M E N U _ H E A D E R
# Getting Started
To build this project, you must have the following installed :
- g i t
- m a k e
- d o c k e r ( 1 9 . 0 3 o r h i g h e r )
- buildx (https : //github .com /docker /buildx )
## Creating a Builder Instance
T h e b u i l d p r o c e s s m a k e s u s e o f f e a t u r e s n o t c u r r e n t l y s u p p o r t e d b y t h e d e f a u l t
builder instance (docker driver). To create a compatible builder instance, run :
2019-07-23 17:17:16 +03:00
2019-12-24 23:23:52 +03:00
` ` `
d o c k e r b u i l d x c r e a t e - - d r i v e r d o c k e r - c o n t a i n e r - - n a m e l o c a l - - b u i l d k i t d - f l a g s '--allow-insecure-entitlement security.insecure' - - u s e
` ` `
2019-04-29 19:25:04 +03:00
2019-12-24 23:23:52 +03:00
I f y o u a l r e a d y h a v e a c o m p a t i b l e b u i l d e r i n s t a n c e , y o u m a y u s e t h a t i n s t e a d .
2019-02-15 07:32:00 +03:00
2020-02-13 23:07:36 +03:00
> Note : The security .insecure entitlement is only required , and used by the unit -tests target and targets which build container images
f o r a p p l i c a t i o n s u s i n g ` i m g ` t o o l .
2019-06-05 21:44:15 +03:00
2019-12-24 23:23:52 +03:00
## Artifacts
2019-02-15 07:32:00 +03:00
2019-12-24 23:23:52 +03:00
A l l a r t i f a c t s w i l l b e o u t p u t t o . / $( ARTIFACTS ) . I m a g e s w i l l b e t a g g e d w i t h t h e
2021-02-24 15:43:27 +03:00
registry "$(IMAGE_REGISTRY)", username "$(USERNAME)", and a dynamic tag (e.g. $(REGISTRY_AND_USERNAME)/image : $( IMAGE_TAG ) ).
2022-03-15 10:37:13 +03:00
T h e r e g i s t r y a n d u s e r n a m e c a n b e o v e r r i d d e n b y e x p o r t i n g R E G I S T R Y , a n d U S E R N A M E
2019-12-24 23:23:52 +03:00
r e s p e c t i v e l y .
2021-03-29 17:27:23 +03:00
## Race Detector
B u i l d i n g w i t h ` WITH_RACE = 1` enables race detector in the Talos executables. Integration tests are always built with the race detector
e n a b l e d .
2019-12-24 23:23:52 +03:00
e n d e f
export HELP_MENU_HEADER
help : ## This help menu.
@echo " $$ HELP_MENU_HEADER "
2021-03-19 15:46:39 +03:00
@grep -E '^[a-zA-Z0-9%_-]+:.*?## .*$$' $( MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2019-12-24 23:23:52 +03:00
# Build Abstractions
.PHONY : base
target-% : ## Builds the specified target defined in the Dockerfile. The build result will only remain in the build cache.
2019-12-23 21:36:14 +03:00
@$( BUILD) \
2019-12-24 23:23:52 +03:00
--target= $* \
$( COMMON_ARGS) \
2020-07-23 21:21:42 +03:00
$( TARGET_ARGS) \
$( CI_ARGS) .
2019-12-24 23:23:52 +03:00
2019-11-01 07:55:58 +03:00
local-% : ## Builds the specified target defined in the Dockerfile using the local output type. The build result will be output to the specified local destination.
2019-12-24 23:23:52 +03:00
@$( MAKE) target-$* TARGET_ARGS = " --output=type=local,dest= $( DEST) $( TARGET_ARGS) "
2020-09-26 00:00:43 +03:00
@PLATFORM= $( PLATFORM) \
ARTIFACTS = $( ARTIFACTS) \
./hack/fix-artifacts.sh
2019-12-24 23:23:52 +03:00
2019-11-01 07:55:58 +03:00
docker-% : ## Builds the specified target defined in the Dockerfile using the docker output type. The build result will be output to the specified local destination.
2019-12-24 23:23:52 +03:00
@mkdir -p $( DEST)
2020-11-26 22:00:13 +03:00
@$( MAKE) target-$* TARGET_ARGS = " --output type=docker,dest= $( DEST) / $* .tar,name= $( REGISTRY_AND_USERNAME) / $* : $( IMAGE_TAG) $( TARGET_ARGS) "
2019-12-24 23:23:52 +03:00
2020-09-26 00:00:43 +03:00
registry-% : ## Builds the specified target defined in the Dockerfile using the image/registry output type. The build result will be pushed to the registry if PUSH=true.
2020-11-26 22:00:13 +03:00
@$( MAKE) target-$* TARGET_ARGS = " --output type=image,name= $( REGISTRY_AND_USERNAME) / $* : $( IMAGE_TAG) $( TARGET_ARGS) "
2020-09-26 00:00:43 +03:00
2022-03-21 13:18:58 +03:00
hack-test-% : ## Runs the specified script in ./hack/test with well known environment variables.
2020-01-24 07:52:02 +03:00
@./hack/test/$* .sh
2019-11-01 07:55:58 +03:00
2019-12-24 23:23:52 +03:00
# Generators
2019-04-24 04:52:31 +03:00
2019-08-09 06:45:13 +03:00
.PHONY : generate
2021-04-01 19:46:54 +03:00
generate : ## Generates code from protobuf service definitions and machinery config.
2020-09-26 00:00:43 +03:00
@$( MAKE) local-$@ DEST = ./ PLATFORM = linux/amd64
2019-08-09 06:45:13 +03:00
2019-11-09 18:22:43 +03:00
.PHONY : docs
2020-03-21 03:38:48 +03:00
docs : ## Generates the documentation for machine config, and talosctl.
2020-10-20 22:05:13 +03:00
@rm -rf docs/configuration/*
2020-03-21 03:38:48 +03:00
@rm -rf docs/talosctl/*
2020-09-26 00:00:43 +03:00
@$( MAKE) local-$@ DEST = ./ PLATFORM = linux/amd64
2019-12-24 23:23:52 +03:00
2022-03-28 18:00:24 +03:00
.PHONY : docs -preview
docs-preview : ## Starts a local preview of the documentation using Hugo
@hugo server -s website
2019-12-24 23:23:52 +03:00
# Local Artifacts
2019-11-09 18:22:43 +03:00
2019-04-19 05:31:43 +03:00
.PHONY : kernel
2020-09-01 00:35:12 +03:00
kernel : ## Outputs the kernel package contents (vmlinuz) to the artifact directory.
2021-02-16 22:30:26 +03:00
@$( MAKE) local-$@ DEST = $( ARTIFACTS) PUSH = false
2019-12-24 23:23:52 +03:00
@-rm -rf $( ARTIFACTS) /modules
2019-01-18 06:14:52 +03:00
2019-04-19 05:31:43 +03:00
.PHONY : initramfs
2020-02-14 15:26:44 +03:00
initramfs : ## Builds the compressed initramfs and outputs it to the artifact directory.
2021-02-16 22:30:26 +03:00
@$( MAKE) local-$@ DEST = $( ARTIFACTS) PUSH = false TARGET_ARGS = "--allow security.insecure"
2018-12-20 09:22:05 +03:00
2019-12-24 23:23:52 +03:00
.PHONY : installer
2021-12-03 14:18:59 +03:00
installer : ## Builds the container image for the installer and outputs it to the registry.
@INSTALLER_ARCH= targetarch \
$( MAKE) registry-$@ TARGET_ARGS = "--allow security.insecure"
.PHONY : imager
imager : ## Builds the container image for the imager and outputs it to the registry.
2020-09-26 00:00:43 +03:00
@$( MAKE) registry-$@ TARGET_ARGS = "--allow security.insecure"
2019-10-31 01:52:36 +03:00
2019-12-24 23:23:52 +03:00
.PHONY : talos
2021-12-03 14:18:59 +03:00
talos : ## Builds the Talos container image and outputs it to the registry.
2020-09-26 00:00:43 +03:00
@$( MAKE) registry-$@ TARGET_ARGS = "--allow security.insecure"
2018-12-20 09:22:05 +03:00
2021-03-18 19:46:32 +03:00
.PHONY : talosctl -image
2021-12-03 14:18:59 +03:00
talosctl-image : ## Builds the talosctl container image and outputs it to the registry.
2021-03-18 19:46:32 +03:00
@$( MAKE) registry-talosctl TARGET_ARGS = "--allow security.insecure"
2020-03-21 03:38:48 +03:00
talosctl-% :
2021-03-29 17:27:23 +03:00
@$( MAKE) local-$@ DEST = $( ARTIFACTS) PLATFORM = linux/amd64 PUSH = false NAME = Client
2019-12-24 23:23:52 +03:00
2020-06-14 02:43:22 +03:00
talosctl : $( TALOSCTL_DEFAULT_TARGET ) ## Builds the talosctl binary for the local machine.
2019-12-24 23:23:52 +03:00
2019-11-01 07:55:58 +03:00
image-% : ## Builds the specified image. Valid options are aws, azure, digital-ocean, gcp, and vmware (e.g. image-aws)
2021-12-03 14:18:59 +03:00
@docker pull $( REGISTRY_AND_USERNAME) /imager:$( IMAGE_TAG)
2021-04-16 14:33:34 +03:00
@for platform in $( subst $( ,) ,$( space) ,$( PLATFORM) ) ; do \
arch = ` basename " $$ {platform} " ` ; \
2021-12-03 14:18:59 +03:00
docker run --rm -v /dev:/dev --privileged $( REGISTRY_AND_USERNAME) /imager:$( IMAGE_TAG) image --platform $* --arch $$ arch --tar-to-stdout | tar xz -C $( ARTIFACTS) ; \
2021-04-16 14:33:34 +03:00
done
2019-11-01 07:55:58 +03:00
2021-12-24 21:30:07 +03:00
images-essential : image -aws image -gcp image -metal ## Builds only essential images used in the CI (AWS, GCP, and Metal).
2021-12-17 09:18:32 +03:00
images : image -aws image -azure image -digital -ocean image -gcp image -hcloud image -metal image -nocloud image -openstack image -oracle image -scaleway image -upcloud image -vmware image -vultr ## Builds all known images (AWS, Azure, DigitalOcean, GCP, HCloud, Metal, NoCloud, Openstack, Oracle, Scaleway, UpCloud, Vultr and VMware).
2019-04-05 07:34:58 +03:00
2021-04-20 21:22:10 +03:00
sbc-% : ## Builds the specified SBC image. Valid options are rpi_4, rock64, bananapi_m64, libretech_all_h3_cc_h5, rockpi_4 and pine64 (e.g. sbc-rpi_4)
2021-12-03 14:18:59 +03:00
@docker pull $( REGISTRY_AND_USERNAME) /imager:$( IMAGE_TAG)
@docker run --rm -v /dev:/dev --privileged $( REGISTRY_AND_USERNAME) /imager:$( IMAGE_TAG) image --platform metal --arch arm64 --board $* --tar-to-stdout | tar xz -C $( ARTIFACTS)
2020-12-01 05:52:23 +03:00
2022-01-13 22:38:07 +03:00
sbcs : sbc -rpi_ 4 sbc -rock 64 sbc -bananapi_m 64 sbc -libretech_all_h 3_cc_h 5 sbc -rockpi_ 4 sbc -pine 64 sbc -jetson_nano ## Builds all known SBC images (Raspberry Pi 4 Model B, Rock64, Banana Pi M64, Radxa ROCK Pi 4, pine64, Libre Computer Board ALL-H3-CC and Jetson Nano).
2020-12-01 05:52:23 +03:00
2020-11-01 00:03:56 +03:00
.PHONY : iso
iso : ## Builds the ISO and outputs it to the artifact directory.
2021-12-03 14:18:59 +03:00
@docker pull $( REGISTRY_AND_USERNAME) /imager:$( IMAGE_TAG)
2021-04-16 14:33:34 +03:00
@for platform in $( subst $( ,) ,$( space) ,$( PLATFORM) ) ; do \
arch = ` basename " $$ {platform} " ` ; \
2021-12-03 14:18:59 +03:00
docker run --rm -e SOURCE_DATE_EPOCH = $( SOURCE_DATE_EPOCH) -i $( REGISTRY_AND_USERNAME) /imager:$( IMAGE_TAG) iso --arch $$ arch --tar-to-stdout | tar xz -C $( ARTIFACTS) ; \
2021-04-16 14:33:34 +03:00
done
2020-11-01 00:03:56 +03:00
2020-10-30 01:08:05 +03:00
.PHONY : talosctl -cni -bundle
talosctl-cni-bundle : ## Creates a compressed tarball that includes CNI bundle for talosctl.
@$( MAKE) local-$@ DEST = $( ARTIFACTS)
@for platform in $( subst $( ,) ,$( space) ,$( PLATFORM) ) ; do \
arch = ` basename " $$ {platform} " ` ; \
tar -C $( ARTIFACTS) /talosctl-cni-bundle-$$ { arch} -czf $( ARTIFACTS) /talosctl-cni-bundle-$$ { arch} .tar.gz . ; \
done
@rm -rf $( ARTIFACTS) /talosctl-cni-bundle-*/
2020-12-11 23:22:56 +03:00
.PHONY : cloud -images
cloud-images : ## Uploads cloud images (AMIs, etc.) to the cloud registry.
@docker run --rm -v $( PWD) :/src -w /src \
-e TAG = $( TAG) -e ARTIFACTS = $( ARTIFACTS) \
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SVC_ACCT \
-e AZURE_SVC_ACCT -e GCE_SVC_ACCT -e PACKET_AUTH_TOKEN \
golang:$( GO_VERSION) \
./hack/cloud-image-uploader.sh
2019-12-24 23:23:52 +03:00
# Code Quality
2019-02-19 19:41:41 +03:00
2021-11-29 20:45:31 +03:00
api-descriptors : ## Generates API descriptors used to detect breaking API changes.
@$( MAKE) local-api-descriptors DEST = ./ PLATFORM = linux/amd64
2021-11-23 18:03:38 +03:00
fmt-go : ## Formats the source code.
2022-03-23 10:49:07 +03:00
@docker run --rm -it -v $( PWD) :/src -w /src golang:$( GO_VERSION) bash -c " go install golang.org/x/tools/cmd/goimports@ $( GOIMPORTS_VERSION) && goimports -w -local github.com/talos-systems/talos . && go install mvdan.cc/gofumpt@ $( GOFUMPT_VERSION) && gofumpt -w . "
2019-04-28 22:06:03 +03:00
2021-11-23 18:03:38 +03:00
fmt-protobuf : ## Formats protobuf files.
@$( MAKE) local-fmt-protobuf DEST = ./ PLATFORM = linux/amd64
fmt : ## Formats the source code and protobuf files.
@$( MAKE) fmt-go fmt-protobuf
2019-11-01 07:55:58 +03:00
lint-% : ## Runs the specified linter. Valid options are go, protobuf, and markdown (e.g. lint-go).
2020-09-26 00:00:43 +03:00
@$( MAKE) target-lint-$* PLATFORM = linux/amd64
2019-08-02 18:05:34 +03:00
2019-12-24 23:23:52 +03:00
lint : ## Runs linters on go, protobuf, and markdown file types.
@$( MAKE) lint-go lint-protobuf lint-markdown
2020-04-07 22:49:12 +03:00
check-dirty : ## Verifies that source tree is not dirty
2020-10-20 12:20:31 +03:00
@if test -n "`git status --porcelain`" ; then echo "Source tree is dirty" ; git status; exit 1 ; fi
2020-04-07 22:49:12 +03:00
2019-12-24 23:23:52 +03:00
# Tests
2019-06-17 19:36:48 +03:00
2019-08-09 06:45:13 +03:00
.PHONY : unit -tests
2020-02-14 15:26:44 +03:00
unit-tests : ## Performs unit tests.
2020-09-26 00:00:43 +03:00
@$( MAKE) local-$@ DEST = $( ARTIFACTS) TARGET_ARGS = "--allow security.insecure" PLATFORM = linux/amd64
2019-08-07 01:08:27 +03:00
2019-08-09 06:45:13 +03:00
.PHONY : unit -tests -race
2019-12-24 23:23:52 +03:00
unit-tests-race : ## Performs unit tests with race detection enabled.
2020-09-26 00:00:43 +03:00
@$( MAKE) target-$@ TARGET_ARGS = "--allow security.insecure" PLATFORM = linux/amd64
2019-12-24 23:23:52 +03:00
2020-01-24 07:52:02 +03:00
$(ARTIFACTS)/$(INTEGRATION_TEST_DEFAULT_TARGET)-amd64 :
2021-03-29 17:27:23 +03:00
@$( MAKE) local-$( INTEGRATION_TEST_DEFAULT_TARGET) DEST = $( ARTIFACTS) PLATFORM = linux/amd64 WITH_RACE = true NAME = Client
2020-01-24 07:52:02 +03:00
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
$(ARTIFACTS)/$(INTEGRATION_TEST_PROVISION_DEFAULT_TARGET)-amd64 :
2021-03-29 17:27:23 +03:00
@$( MAKE) local-$( INTEGRATION_TEST_PROVISION_DEFAULT_TARGET) DEST = $( ARTIFACTS) PLATFORM = linux/amd64 WITH_RACE = true NAME = Client
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2020-01-24 07:52:02 +03:00
$(ARTIFACTS)/kubectl :
@mkdir -p $( ARTIFACTS)
@curl -L -o $( ARTIFACTS) /kubectl " $( KUBECTL_URL) "
@chmod +x $( ARTIFACTS) /kubectl
2022-01-21 16:37:13 +03:00
$(ARTIFACTS)/kubestr :
@mkdir -p $( ARTIFACTS)
@curl -L " $( KUBESTR_URL) " | tar xzf - -C $( ARTIFACTS) kubestr
@chmod +x $( ARTIFACTS) /kubestr
2020-04-29 22:24:07 +03:00
$(ARTIFACTS)/clusterctl :
@mkdir -p $( ARTIFACTS)
@curl -L -o $( ARTIFACTS) /clusterctl " $( CLUSTERCTL_URL) "
@chmod +x $( ARTIFACTS) /clusterctl
2022-03-21 13:18:58 +03:00
$(ARTIFACTS)/d2ctl :
@mkdir -p $( ARTIFACTS)
@curl -L -o $( ARTIFACTS) /d2ctl " $( D2CTL_URL) "
@chmod +x $( ARTIFACTS) /d2ctl
$(ARTIFACTS)/pulumi :
@mkdir -p $( ARTIFACTS)
@curl -L " $( PULUMI_URL) " | tar xzf - -C $( ARTIFACTS) --strip-components 1 pulumi/pulumi
e2e-% : $( ARTIFACTS ) /$( INTEGRATION_TEST_DEFAULT_TARGET ) -amd 64 $( ARTIFACTS ) /kubectl $( ARTIFACTS ) /clusterctl $( ARTIFACTS ) /kubestr $( ARTIFACTS ) /d 2ctl $( ARTIFACTS ) /pulumi ## Runs the E2E test for the specified platform (e.g. e2e-docker).
2020-01-24 07:52:02 +03:00
@$( MAKE) hack-test-$@ \
PLATFORM = $* \
TAG = $( TAG) \
SHA = $( SHA) \
2021-02-24 15:43:27 +03:00
REGISTRY = $( IMAGE_REGISTRY) \
2021-08-16 18:23:39 +03:00
IMAGE = $( REGISTRY_AND_USERNAME) /talos:$( IMAGE_TAG) \
INSTALLER_IMAGE = $( REGISTRY_AND_USERNAME) /installer:$( IMAGE_TAG) \
2020-01-24 07:52:02 +03:00
ARTIFACTS = $( ARTIFACTS) \
2020-06-14 02:43:22 +03:00
TALOSCTL = $( PWD) /$( ARTIFACTS) /$( TALOSCTL_DEFAULT_TARGET) -amd64 \
2020-01-24 07:52:02 +03:00
INTEGRATION_TEST = $( PWD) /$( ARTIFACTS) /$( INTEGRATION_TEST_DEFAULT_TARGET) -amd64 \
2020-06-25 22:56:59 +03:00
SHORT_INTEGRATION_TEST = $( SHORT_INTEGRATION_TEST) \
2020-07-01 18:34:20 +03:00
CUSTOM_CNI_URL = $( CUSTOM_CNI_URL) \
2020-01-24 07:52:02 +03:00
KUBECTL = $( PWD) /$( ARTIFACTS) /kubectl \
2022-01-21 16:37:13 +03:00
KUBESTR = $( PWD) /$( ARTIFACTS) /kubestr \
2022-03-21 13:18:58 +03:00
CLUSTERCTL = $( PWD) /$( ARTIFACTS) /clusterctl \
D2CTL = $( PWD) /$( ARTIFACTS) /d2ctl \
PULUMI = $( PWD) /$( ARTIFACTS) /pulumi
2020-04-29 22:24:07 +03:00
2020-03-24 21:20:36 +03:00
provision-tests-prepare : release -artifacts $( ARTIFACTS ) /$( INTEGRATION_TEST_PROVISION_DEFAULT_TARGET ) -amd 64
provision-tests : provision -tests -prepare
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
@$( MAKE) hack-test-$@ \
TAG = $( TAG) \
2020-06-14 02:43:22 +03:00
TALOSCTL = $( PWD) /$( ARTIFACTS) /$( TALOSCTL_DEFAULT_TARGET) -amd64 \
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
INTEGRATION_TEST = $( PWD) /$( ARTIFACTS) /$( INTEGRATION_TEST_PROVISION_DEFAULT_TARGET) -amd64
2020-03-24 21:20:36 +03:00
provision-tests-track-% :
@$( MAKE) hack-test-provision-tests \
TAG = $( TAG) \
2020-06-14 02:43:22 +03:00
TALOSCTL = $( PWD) /$( ARTIFACTS) /$( TALOSCTL_DEFAULT_TARGET) -amd64 \
2020-03-24 21:20:36 +03:00
INTEGRATION_TEST = $( PWD) /$( ARTIFACTS) /$( INTEGRATION_TEST_PROVISION_DEFAULT_TARGET) -amd64 \
2020-07-27 19:28:28 +03:00
INTEGRATION_TEST_RUN = " TestIntegration/.+-TR $* " \
2020-09-07 23:36:42 +03:00
INTEGRATION_TEST_TRACK = " $* " \
2020-09-26 00:00:43 +03:00
CUSTOM_CNI_URL = $( CUSTOM_CNI_URL) \
2021-03-12 17:40:17 +03:00
REGISTRY = $( IMAGE_REGISTRY) \
ARTIFACTS = $( ARTIFACTS)
2020-03-24 21:20:36 +03:00
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
# Assets for releases
.PHONY : $( ARTIFACTS ) /$( TALOS_RELEASE )
2020-07-29 19:39:47 +03:00
$(ARTIFACTS)/$(TALOS_RELEASE) : $( ARTIFACTS ) /$( TALOS_RELEASE ) /vmlinuz $( ARTIFACTS ) /$( TALOS_RELEASE ) /initramfs .xz
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
# download release artifacts for specific version
$(ARTIFACTS)/$(TALOS_RELEASE)/% :
@mkdir -p $( ARTIFACTS) /$( TALOS_RELEASE) /
2021-12-03 14:18:59 +03:00
@case " $* " in \
vmlinuz) \
2022-03-23 20:02:22 +03:00
curl -L -o " $( ARTIFACTS) / $( TALOS_RELEASE) / $* " " https://github.com/siderolabs/talos/releases/download/ $( TALOS_RELEASE) /vmlinuz-amd64 " \
2020-10-23 23:59:50 +03:00
; ; \
2021-12-03 14:18:59 +03:00
initramfs.xz) \
2022-03-23 20:02:22 +03:00
curl -L -o " $( ARTIFACTS) / $( TALOS_RELEASE) / $* " " https://github.com/siderolabs/talos/releases/download/ $( TALOS_RELEASE) /initramfs-amd64.xz " \
2020-10-23 23:59:50 +03:00
; ; \
esac
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
.PHONY : release -artifacts
release-artifacts :
@for release in $( RELEASES) ; do \
$( MAKE) $( ARTIFACTS) /$$ release TALOS_RELEASE = $$ release; \
done
2019-12-24 23:23:52 +03:00
# Utilities
2019-01-19 12:58:26 +03:00
2020-04-11 03:06:59 +03:00
.PHONY : conformance
conformance : ## Performs policy checks against the commit and source code.
2022-03-23 20:02:22 +03:00
docker run --rm -it -v $( PWD) :/src -w /src ghcr.io/siderolabs/conform:v0.1.0-alpha.22 enforce
2020-04-11 03:06:59 +03:00
2020-07-28 23:55:47 +03:00
.PHONY : release -notes
release-notes :
2020-10-07 16:46:37 +03:00
ARTIFACTS = $( ARTIFACTS) ./hack/release.sh $@ $( ARTIFACTS) /RELEASE_NOTES.md $( TAG)
2020-07-28 23:55:47 +03:00
2019-04-12 09:40:30 +03:00
.PHONY : login
2019-12-24 23:23:52 +03:00
login : ## Logs in to the configured container registry.
2020-02-13 23:07:36 +03:00
i f e q ( $( DOCKER_LOGIN_ENABLED ) , t r u e )
2021-02-24 15:43:27 +03:00
@docker login --username " $( GHCR_USERNAME) " --password " $( GHCR_PASSWORD) " $( IMAGE_REGISTRY)
2020-02-13 23:07:36 +03:00
e n d i f
2019-04-12 09:40:30 +03:00
2021-12-03 14:18:59 +03:00
push : login ## Pushes the installer, imager, talos and talosctl images to the configured container registry with the generated tag.
2020-09-26 00:00:43 +03:00
@$( MAKE) installer PUSH = true
2021-12-03 14:18:59 +03:00
@$( MAKE) imager PUSH = true
2020-09-26 00:00:43 +03:00
@$( MAKE) talos PUSH = true
2021-03-18 19:46:32 +03:00
@$( MAKE) talosctl-image PUSH = true
2020-01-01 21:28:44 +03:00
2021-12-03 14:18:59 +03:00
push-% : login ## Pushes the installer, imager, talos and talosctl images to the configured container registry with the specified tag (e.g. push-latest).
2020-11-26 22:00:13 +03:00
@$( MAKE) push IMAGE_TAG = $*
2019-04-12 09:40:30 +03:00
2019-04-19 05:31:43 +03:00
.PHONY : clean
2019-12-24 23:23:52 +03:00
clean : ## Cleans up all artifacts.
2020-01-24 07:52:02 +03:00
@-rm -rf $( ARTIFACTS)