2020-09-24 00:08:47 +03:00
REGISTRY ?= ghcr.io
USERNAME ?= talos-systems
2019-12-24 23:23:52 +03:00
SHA ?= $( shell git describe --match= none --always --abbrev= 8 --dirty)
TAG ?= $( shell git describe --tag --always --dirty)
2021-02-24 15:43:27 +03:00
IMAGE_REGISTRY ?= $( REGISTRY)
2020-11-26 22:00:13 +03:00
IMAGE_TAG ?= $( TAG)
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
2021-04-12 23:37:14 +03:00
TOOLS ?= ghcr.io/talos-systems/tools:v0.5.0
2021-05-11 21:20:41 +03:00
PKGS ?= v0.6.0-alpha.0
2021-04-12 23:37:14 +03:00
EXTRAS ?= v0.3.0
2021-03-11 22:09:47 +03:00
GO_VERSION ?= 1.16
2021-04-12 15:34:48 +03:00
GOFUMPT_VERSION ?= v0.1.0
STRINGER_VERSION ?= v0.1.0
2020-05-08 21:44:20 +03:00
IMPORTVET ?= autonomy/importvet:f6b07d9
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)
2021-04-09 11:55:15 +03:00
KUBECTL_URL ?= https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/$( OPERATING_SYSTEM) /amd64/kubectl
2021-03-31 17:32:41 +03:00
CLUSTERCTL_VERSION ?= 0.3.15
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
2021-03-22 20:14:50 +03:00
SONOBUOY_VERSION ?= 0.50.0
SONOBUOY_URL ?= https://github.com/vmware-tanzu/sonobuoy/releases/download/v$( SONOBUOY_VERSION) /sonobuoy_$( SONOBUOY_VERSION) _$( OPERATING_SYSTEM) _amd64.tar.gz
2020-08-17 19:12:47 +03:00
TESTPKGS ?= github.com/talos-systems/talos/...
2021-04-09 20:48:49 +03:00
RELEASES ?= v0.9.1 v0.10.0-alpha.2
2020-06-25 22:56:59 +03:00
SHORT_INTEGRATION_TEST ?=
2020-07-01 18:34:20 +03:00
CUSTOM_CNI_URL ?=
2019-12-24 23:23:52 +03:00
2021-03-29 17:27:23 +03:00
VERSION_PKG = github.com/talos-systems/talos/pkg/version
IMAGES_PKGS = github.com/talos-systems/talos/pkg/images
MGMT_HELPERS_PKG = github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers
CGO_ENABLED ?= 0
GO_BUILDFLAGS ?=
GO_LDFLAGS ?= -s -w \
-X $( VERSION_PKG) .Name= $( NAME) \
-X $( VERSION_PKG) .SHA= $( SHA) \
-X $( VERSION_PKG) .Tag= $( TAG) \
-X $( VERSION_PKG) .PkgsVersion= $( PKGS) \
-X $( VERSION_PKG) .ExtrasVersion= $( EXTRAS) \
-X $( IMAGES_PKGS) .Username= $( USERNAME) \
-X $( IMAGES_PKGS) .Registry= $( REGISTRY) \
-X $( MGMT_HELPERS_PKG) .ArtifactsPath= $( ARTIFACTS)
WITH_RACE ?=
2021-05-13 11:56:26 +03:00
WITH_DEBUG ?=
2021-03-29 17:27:23 +03:00
i f n e q ( $( strip $ ( WITH_RACE ) ) , )
CGO_ENABLED = 1
GO_BUILDFLAGS += -race
GO_LDFLAGS += -linkmode= external -extldflags '-static'
e n d i f
2021-05-13 11:56:26 +03:00
i f e q ( $( WITH_DEBUG ) , t r u e )
GO_BUILDFLAGS += -tags sidero.debug
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)
2021-04-12 15:34:48 +03:00
COMMON_ARGS += --build-arg= STRINGER_VERSION = $( STRINGER_VERSION)
2019-12-23 21:36:14 +03:00
COMMON_ARGS += --build-arg= TAG = $( TAG)
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-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)
2019-04-24 04:52:31 +03:00
2020-07-23 21:21:42 +03:00
CI_ARGS ?=
2021-03-18 19:46:32 +03:00
all : initramfs kernel installer 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 ) ).
2019-12-24 23:23:52 +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 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
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
2019-11-01 07:55:58 +03:00
hack-test-% : ## Runs the specied 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
# 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
2020-02-14 15:26:44 +03:00
installer : ## Builds the container image for the installer and outputs it to the artifact directory.
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
2020-02-14 15:26:44 +03:00
talos : ## Builds the Talos container image and outputs it to the artifact directory.
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
talosctl-image : ## Builds the talosctl container image and outputs it to the artifact directory.
@$( 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-02-24 15:43:27 +03:00
@docker pull $( REGISTRY_AND_USERNAME) /installer:$( TAG)
2021-04-16 14:33:34 +03:00
@for platform in $( subst $( ,) ,$( space) ,$( PLATFORM) ) ; do \
arch = ` basename " $$ {platform} " ` ; \
docker run --rm -v /dev:/dev --privileged $( REGISTRY_AND_USERNAME) /installer:$( TAG) image --platform $* --arch $$ arch --tar-to-stdout | tar xz -C $( ARTIFACTS) ; \
done
2019-11-01 07:55:58 +03:00
2021-04-07 16:23:14 +03:00
images : image -aws image -azure image -digital -ocean image -gcp image -metal image -openstack image -vmware ## Builds all known images (AWS, Azure, DigitalOcean, GCP, Metal, Openstack, 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-02-24 15:43:27 +03:00
@docker pull $( REGISTRY_AND_USERNAME) /installer:$( TAG)
2021-04-16 14:33:34 +03:00
@docker run --rm -v /dev:/dev --privileged $( REGISTRY_AND_USERNAME) /installer:$( TAG) image --platform metal --arch arm64 --board $* --tar-to-stdout | tar xz -C $( ARTIFACTS)
2020-12-01 05:52:23 +03:00
2021-05-04 21:48:10 +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 ## Builds all known SBC images (Raspberry Pi 4 Model B, Rock64, Banana Pi M64, Radxa ROCK Pi 4, pine64, and Libre Computer Board ALL-H3-CC).
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-02-24 15:43:27 +03:00
@docker pull $( REGISTRY_AND_USERNAME) /installer:$( TAG)
2021-04-16 14:33:34 +03:00
@for platform in $( subst $( ,) ,$( space) ,$( PLATFORM) ) ; do \
arch = ` basename " $$ {platform} " ` ; \
docker run --rm -i $( REGISTRY_AND_USERNAME) /installer:$( TAG) iso --arch $$ arch --tar-to-stdout | tar xz -C $( ARTIFACTS) ; \
done
2020-11-01 00:03:56 +03:00
2020-01-09 23:25:25 +03:00
.PHONY : boot
2020-09-26 00:00:43 +03:00
boot : ## Creates a compressed tarball that includes vmlinuz-{amd64,arm64} and initramfs-{amd64,arm64}.xz. Note that these files must already be present in the artifacts directory.
@for platform in $( subst $( ,) ,$( space) ,$( PLATFORM) ) ; do \
arch = ` basename " $$ {platform} " ` ; \
tar -C $( ARTIFACTS) --transform= s/-$$ { arch} // -czf $( ARTIFACTS) /boot-$$ { arch} .tar.gz vmlinuz-$$ { arch} initramfs-$$ { arch} .xz ; \
done
2020-01-09 23:25:25 +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
2019-12-24 23:23:52 +03:00
.PHONY : fmt
fmt : ## Formats the source code.
2021-04-12 15:34:48 +03:00
@docker run --rm -it -v $( PWD) :/src -w /src golang:$( GO_VERSION) bash -c " go install mvdan.cc/gofumpt/gofumports@ $( GOFUMPT_VERSION) && gofumports -w -local github.com/talos-systems/talos . "
2019-04-28 22:06:03 +03:00
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)/sonobuoy :
@mkdir -p $( ARTIFACTS)
@curl -L -o /tmp/sonobuoy.tar.gz ${ SONOBUOY_URL }
@tar -xf /tmp/sonobuoy.tar.gz -C $( ARTIFACTS)
$(ARTIFACTS)/kubectl :
@mkdir -p $( ARTIFACTS)
@curl -L -o $( ARTIFACTS) /kubectl " $( KUBECTL_URL) "
@chmod +x $( ARTIFACTS) /kubectl
2020-04-29 22:24:07 +03:00
$(ARTIFACTS)/clusterctl :
@mkdir -p $( ARTIFACTS)
@curl -L -o $( ARTIFACTS) /clusterctl " $( CLUSTERCTL_URL) "
@chmod +x $( ARTIFACTS) /clusterctl
e2e-% : $( ARTIFACTS ) /$( INTEGRATION_TEST_DEFAULT_TARGET ) -amd 64 $( ARTIFACTS ) /sonobuoy $( ARTIFACTS ) /kubectl $( ARTIFACTS ) /clusterctl ## 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) \
2020-01-24 07:52:02 +03:00
IMAGE = $( REGISTRY_AND_USERNAME) /talos:$( TAG) \
2020-07-23 21:21:42 +03:00
INSTALLER_IMAGE = $( REGISTRY_AND_USERNAME) /installer:$( 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 \
2020-04-29 22:24:07 +03:00
SONOBUOY = $( PWD) /$( ARTIFACTS) /sonobuoy \
CLUSTERCTL = $( PWD) /$( ARTIFACTS) /clusterctl
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) /
2020-10-23 23:59:50 +03:00
@case " $( TALOS_RELEASE) " in \
v0.6*) \
curl -L -o " $( ARTIFACTS) / $( TALOS_RELEASE) / $* " " https://github.com/talos-systems/talos/releases/download/ $( TALOS_RELEASE) / $* " \
; ; \
v0.7.0-alpha.[ 0-3] ) \
curl -L -o " $( ARTIFACTS) / $( TALOS_RELEASE) / $* " " https://github.com/talos-systems/talos/releases/download/ $( TALOS_RELEASE) / $* " \
; ; \
*) \
case " $* " in \
vmlinuz) \
curl -L -o " $( ARTIFACTS) / $( TALOS_RELEASE) / $* " " https://github.com/talos-systems/talos/releases/download/ $( TALOS_RELEASE) /vmlinuz-amd64 " \
; ; \
initramfs.xz) \
curl -L -o " $( ARTIFACTS) / $( TALOS_RELEASE) / $* " " https://github.com/talos-systems/talos/releases/download/ $( TALOS_RELEASE) /initramfs-amd64.xz " \
; ; \
esac \
; ; \
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.
2021-04-13 18:51:43 +03:00
docker run --rm -it -v $( PWD) :/src -w /src docker.io/autonomy/conform:v0.1.0-alpha.20
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
2020-01-01 21:28:44 +03:00
push : login ## Pushes the installer, and talos images to the configured container registry with the generated tag.
2020-09-26 00:00:43 +03:00
@$( MAKE) installer PUSH = true
@$( 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
push-% : login ## Pushes the installer, and talos 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)