2019-08-11 00:29:25 +03:00
// This file contains the logic for building our CI for Drone. The idea here is
// that we create a pipeline for all of the major tasks we need to perform
// (e.g. builds, E2E testing, conformance testing, releases). Each pipeline
// after the default builds on a previous pipeline.
2019-09-07 06:37:37 +03:00
// Generate with `drone jsonnet --source ./hack/drone.jsonnet --stream --format`
2020-04-07 22:49:12 +03:00
// Sign with `drone sign talos-systems/talos --save`
2019-08-11 00:29:25 +03:00
2019-08-03 00:08:24 +03:00
local build_container = 'autonomy/build-container:latest';
2020-09-26 00:00:43 +03:00
local local_registry = 'registry.dev.talos-systems.io';
2019-12-23 21:36:14 +03:00
2019-08-11 00:29:25 +03:00
local volumes = {
dockersock: {
pipeline: {
2019-08-03 00:08:24 +03:00
name: 'dockersock',
2019-08-11 00:29:25 +03:00
temp: {},
},
step: {
name: $.dockersock.pipeline.name,
2019-08-03 00:08:24 +03:00
path: '/var/run',
2019-08-11 00:29:25 +03:00
},
2019-08-09 06:45:13 +03:00
},
2019-08-11 00:29:25 +03:00
2020-07-27 23:24:07 +03:00
outerdockersock: {
pipeline: {
name: 'outerdockersock',
host: {
path: '/var/ci-docker'
},
},
step: {
name: $.outerdockersock.pipeline.name,
path: '/var/outer-run',
},
},
2019-12-23 21:36:14 +03:00
docker: {
pipeline: {
name: 'docker',
temp: {},
},
step: {
name: $.docker.pipeline.name,
path: '/root/.docker/buildx',
},
},
kube: {
pipeline: {
name: 'kube',
temp: {},
},
step: {
name: $.kube.pipeline.name,
path: '/root/.kube',
},
},
2019-08-11 00:29:25 +03:00
dev: {
pipeline: {
2019-08-03 00:08:24 +03:00
name: 'dev',
2019-08-11 00:29:25 +03:00
host: {
2019-08-03 00:08:24 +03:00
path: '/dev',
2019-08-11 00:29:25 +03:00
},
},
step: {
name: $.dev.pipeline.name,
2019-08-03 00:08:24 +03:00
path: '/dev',
2019-08-11 00:29:25 +03:00
},
2019-08-09 06:45:13 +03:00
},
2019-08-11 00:29:25 +03:00
2020-06-29 21:36:51 +03:00
tmp: {
pipeline: {
name: 'tmp',
2020-07-30 16:21:38 +03:00
temp: {
'medium': 'memory',
},
2020-06-29 21:36:51 +03:00
},
step: {
name: $.tmp.pipeline.name,
path: '/tmp',
},
},
2019-08-11 00:29:25 +03:00
ForStep(): [
self.dockersock.step,
2020-07-27 23:24:07 +03:00
self.outerdockersock.step,
2019-12-23 21:36:14 +03:00
self.docker.step,
self.kube.step,
2019-08-11 00:29:25 +03:00
self.dev.step,
2020-07-30 00:36:58 +03:00
self.tmp.step,
2019-08-11 00:29:25 +03:00
],
ForPipeline(): [
self.dockersock.pipeline,
2020-07-27 23:24:07 +03:00
self.outerdockersock.pipeline,
2019-12-23 21:36:14 +03:00
self.docker.pipeline,
self.kube.pipeline,
2019-08-11 00:29:25 +03:00
self.dev.pipeline,
2020-06-29 21:36:51 +03:00
self.tmp.pipeline,
2019-08-11 00:29:25 +03:00
],
};
2019-08-09 06:45:13 +03:00
2019-08-11 00:29:25 +03:00
// This provides the docker service.
2019-08-09 06:45:13 +03:00
local docker = {
2019-08-03 00:08:24 +03:00
name: 'docker',
2021-10-05 21:29:26 +03:00
image: 'ghcr.io/smira/docker:20.10-dind-hacked',
2019-08-03 00:08:24 +03:00
entrypoint: ['dockerd'],
2019-08-09 06:45:13 +03:00
privileged: true,
command: [
2019-08-03 00:08:24 +03:00
'--dns=8.8.8.8',
'--dns=8.8.4.4',
2020-12-17 15:47:58 +03:00
'--mtu=1450',
2019-08-03 00:08:24 +03:00
'--log-level=error',
2019-12-27 21:12:04 +03:00
],
2021-02-16 22:30:26 +03:00
// Set resource requests to ensure that only three builds can be performed at a
2020-07-23 21:21:42 +03:00
// time. We set it on the service so that we get the scheduling restricitions
// while still allowing parallel steps.
resources: {
requests: {
2021-02-16 22:30:26 +03:00
cpu: 12000,
memory: '18GiB',
2020-07-23 21:21:42 +03:00
},
},
2019-08-11 00:29:25 +03:00
volumes: volumes.ForStep(),
2019-08-09 06:45:13 +03:00
};
2019-12-24 20:28:58 +03:00
// Sets up the CI environment
local setup_ci = {
name: 'setup-ci',
2019-12-23 21:36:14 +03:00
image: 'autonomy/build-container:latest',
2020-11-10 20:12:26 +03:00
pull: "always",
2019-08-09 06:45:13 +03:00
privileged: true,
2020-09-26 00:00:43 +03:00
2019-12-23 21:36:14 +03:00
commands: [
2020-11-10 20:12:26 +03:00
'setup-ci',
2022-02-22 22:12:39 +03:00
'make ./_out/kubectl ./_out/kubestr ./_out/clusterctl',
2019-12-23 21:36:14 +03:00
],
2021-10-05 22:32:46 +03:00
environment: {
"BUILDKIT_FLAVOR": "cross",
},
2019-12-23 21:36:14 +03:00
volumes: volumes.ForStep(),
2019-08-09 06:45:13 +03:00
};
2019-08-11 00:29:25 +03:00
// Step standardizes the creation of build steps. The name of the step is used
// as the target when building the make command. For example, if name equals
// "test", the resulting step command will be "make test". This is done to
// encourage alignment between this file and the Makefile, and gives us a
// standardized structure that should make things easier to reason about if we
// know that each step is essentially a Makefile target.
2020-07-01 21:20:24 +03:00
local Step(name, image='', target='', privileged=false, depends_on=[], environment={}, extra_volumes=[], when={}) = {
2019-08-03 00:08:24 +03:00
local make = if target == '' then std.format('make %s', name) else std.format('make %s', target),
2019-12-04 18:22:36 +03:00
2020-07-23 21:21:42 +03:00
local common_env_vars = {
2020-09-26 00:00:43 +03:00
"PLATFORM": "linux/amd64,linux/arm64",
2020-07-23 21:21:42 +03:00
},
2019-08-09 06:45:13 +03:00
2019-08-11 00:29:25 +03:00
name: name,
2019-12-04 18:22:36 +03:00
image: if image == '' then build_container else image,
2019-09-24 07:45:21 +03:00
pull: "always",
2019-08-11 00:29:25 +03:00
commands: [make],
2020-01-22 06:37:12 +03:00
privileged: privileged,
2019-08-11 00:29:25 +03:00
environment: common_env_vars + environment,
2020-06-29 21:36:51 +03:00
volumes: volumes.ForStep() + extra_volumes,
2019-08-09 06:45:13 +03:00
depends_on: [x.name for x in depends_on],
2020-07-01 21:20:24 +03:00
when: when,
2019-08-09 06:45:13 +03:00
};
2019-08-11 00:29:25 +03:00
// Pipeline is a way to standardize the creation of pipelines. It supports
// using and existing pipeline as a base.
2020-07-23 21:21:42 +03:00
local Pipeline(name, steps=[], depends_on=[], with_docker=true, disable_clone=false, type='kubernetes') = {
2019-08-03 00:08:24 +03:00
kind: 'pipeline',
2020-07-23 21:21:42 +03:00
type: type,
2019-08-09 06:45:13 +03:00
name: name,
2020-07-23 21:21:42 +03:00
[if type == 'digitalocean' then 'token']: {
from_secret: 'digitalocean_token'
},
// See https://slugs.do-api.dev/.
[if type == 'digitalocean' then 'server']: {
image: 'ubuntu-20-04-x64',
size: 'c-32',
region: 'nyc3',
},
[if with_docker then 'services']: [docker],
2019-12-10 20:44:07 +03:00
[ if disable_clone then 'clone']: {
disable: true,
},
2019-09-24 07:45:21 +03:00
steps: steps,
2019-08-11 00:29:25 +03:00
volumes: volumes.ForPipeline(),
depends_on: [x.name for x in depends_on],
2019-08-09 06:45:13 +03:00
};
2019-08-11 00:29:25 +03:00
// Default pipeline.
2020-10-21 16:59:52 +03:00
local generate = Step("generate", target="generate docs", depends_on=[setup_ci]);
local check_dirty = Step("check-dirty", depends_on=[generate]);
2021-12-03 14:18:59 +03:00
local build = Step("build", target="talosctl-linux talosctl-darwin talosctl-windows kernel initramfs installer imager talos", depends_on=[check_dirty], environment={"IMAGE_REGISTRY": local_registry, "PUSH": true});
2021-02-16 22:30:26 +03:00
local lint = Step("lint", depends_on=[build]);
local talosctl_cni_bundle = Step('talosctl-cni-bundle', depends_on=[build, lint]);
2021-04-16 14:33:34 +03:00
local iso = Step("iso", target="iso", depends_on=[build], environment={"IMAGE_REGISTRY": local_registry});
2021-12-24 21:30:07 +03:00
local images_essential = Step("images-essential", target="images-essential", depends_on=[iso], environment={"IMAGE_REGISTRY": local_registry});
2021-02-16 22:30:26 +03:00
local unit_tests = Step("unit-tests", target="unit-tests unit-tests-race", depends_on=[build, lint]);
2021-02-24 15:43:27 +03:00
local e2e_docker = Step("e2e-docker-short", depends_on=[build, unit_tests], target="e2e-docker", environment={"SHORT_INTEGRATION_TEST": "yes", "IMAGE_REGISTRY": local_registry});
local e2e_qemu = Step("e2e-qemu-short", privileged=true, target="e2e-qemu", depends_on=[build, unit_tests, talosctl_cni_bundle], environment={"IMAGE_REGISTRY": local_registry, "SHORT_INTEGRATION_TEST": "yes"}, when={event: ['pull_request']});
2021-04-16 14:33:34 +03:00
local e2e_iso = Step("e2e-iso", privileged=true, target="e2e-iso", depends_on=[build, unit_tests, iso, talosctl_cni_bundle], when={event: ['pull_request']}, environment={"IMAGE_REGISTRY": local_registry});
2021-08-06 18:28:51 +03:00
local release_notes = Step('release-notes', depends_on=[e2e_docker, e2e_qemu]);
2019-08-09 06:45:13 +03:00
local coverage = {
2019-08-03 00:08:24 +03:00
name: 'coverage',
2021-04-19 20:17:48 +03:00
image: 'autonomy/build-container:latest',
pull: 'always',
2020-01-24 07:52:02 +03:00
environment: {
CODECOV_TOKEN: { from_secret: 'codecov_token' },
2019-08-09 06:45:13 +03:00
},
2020-01-24 07:52:02 +03:00
commands: [
2021-04-19 20:17:48 +03:00
'/usr/local/bin/codecov -f _out/coverage.txt -X fix'
2020-01-24 07:52:02 +03:00
],
2019-08-11 00:29:25 +03:00
when: {
2019-08-03 00:08:24 +03:00
event: ['pull_request'],
2019-08-09 06:45:13 +03:00
},
2021-02-16 22:30:26 +03:00
depends_on: [unit_tests.name],
2019-08-09 06:45:13 +03:00
};
2020-01-01 21:28:44 +03:00
local push = {
name: 'push',
image: 'autonomy/build-container:latest',
pull: 'always',
environment: {
2020-09-24 02:21:43 +03:00
GHCR_USERNAME: { from_secret: 'ghcr_username' },
GHCR_PASSWORD: { from_secret: 'ghcr_token' },
2020-09-28 16:10:49 +03:00
PLATFORM: "linux/amd64,linux/arm64",
2020-01-01 21:28:44 +03:00
},
commands: ['make push'],
volumes: volumes.ForStep(),
when: {
event: {
exclude: [
'pull_request',
2020-01-01 22:51:48 +03:00
'promote',
'cron',
2020-01-01 21:28:44 +03:00
],
},
},
2020-07-30 21:44:10 +03:00
depends_on: [e2e_docker.name, e2e_qemu.name],
2020-01-01 21:28:44 +03:00
};
2019-11-27 18:39:53 +03:00
local push_latest = {
name: 'push-latest',
2019-08-03 00:08:24 +03:00
image: 'autonomy/build-container:latest',
pull: 'always',
environment: {
2020-09-24 02:21:43 +03:00
GHCR_USERNAME: { from_secret: 'ghcr_username' },
GHCR_PASSWORD: { from_secret: 'ghcr_token' },
2020-09-28 16:10:49 +03:00
PLATFORM: "linux/amd64,linux/arm64",
2019-08-09 06:45:13 +03:00
},
2020-01-01 21:28:44 +03:00
commands: ['make push-latest'],
2019-08-11 00:29:25 +03:00
volumes: volumes.ForStep(),
2019-08-09 06:45:13 +03:00
when: {
2020-01-01 22:51:48 +03:00
branch: [
'master',
],
event: [
'push',
2020-01-01 20:43:24 +03:00
],
2019-08-09 06:45:13 +03:00
},
2020-11-27 00:03:18 +03:00
depends_on: [push.name],
2019-08-09 06:45:13 +03:00
};
2021-02-16 22:30:26 +03:00
local save_artifacts = {
name: 'save-artifacts',
image: 'docker.io/d3fk/s3cmd:latest',
pull: 'always',
environment: {
AWS_ACCESS_KEY_ID: { from_secret: 'rook_access_key_id' },
AWS_SECRET_ACCESS_KEY: { from_secret: 'rook_secret_access_key' },
},
commands: [
2021-02-17 17:55:45 +03:00
's3cmd --host=rook-ceph-rgw-ci-store.rook-ceph.svc --host-bucket=rook-ceph-rgw-ci-store.rook-ceph.svc --no-ssl mb s3://${CI_COMMIT_SHA}${DRONE_TAG//./-}',
2021-03-04 16:30:32 +03:00
's3cmd --host=rook-ceph-rgw-ci-store.rook-ceph.svc --host-bucket=rook-ceph-rgw-ci-store.rook-ceph.svc --no-ssl expire s3://${CI_COMMIT_SHA}${DRONE_TAG//./-} --expiry-days=3',
2021-02-17 17:55:45 +03:00
's3cmd --host=rook-ceph-rgw-ci-store.rook-ceph.svc --host-bucket=rook-ceph-rgw-ci-store.rook-ceph.svc --no-ssl --stats sync _out s3://${CI_COMMIT_SHA}${DRONE_TAG//./-}',
2021-02-16 22:30:26 +03:00
],
volumes: volumes.ForStep(),
2021-12-24 21:30:07 +03:00
depends_on: [build.name, images_essential.name, iso.name, talosctl_cni_bundle.name],
2021-02-16 22:30:26 +03:00
};
local load_artifacts = {
name: 'load-artifacts',
image: 'docker.io/d3fk/s3cmd:latest',
pull: 'always',
environment: {
AWS_ACCESS_KEY_ID: { from_secret: 'rook_access_key_id' },
AWS_SECRET_ACCESS_KEY: { from_secret: 'rook_secret_access_key' },
},
commands: [
2021-02-17 17:55:45 +03:00
's3cmd --host=rook-ceph-rgw-ci-store.rook-ceph.svc --host-bucket=rook-ceph-rgw-ci-store.rook-ceph.svc --no-ssl --stats sync s3://${CI_COMMIT_SHA}${DRONE_TAG//./-} .',
2021-02-16 22:30:26 +03:00
],
volumes: volumes.ForStep(),
depends_on: [setup_ci.name],
};
2019-08-11 00:29:25 +03:00
local default_steps = [
2019-12-24 20:28:58 +03:00
setup_ci,
2020-04-07 22:49:12 +03:00
generate,
check_dirty,
2021-02-16 22:30:26 +03:00
build,
2020-10-21 16:59:52 +03:00
lint,
2020-10-30 01:08:05 +03:00
talosctl_cni_bundle,
2021-04-16 14:33:34 +03:00
iso,
2021-12-24 21:30:07 +03:00
images_essential,
2019-08-09 06:45:13 +03:00
unit_tests,
2021-02-16 22:30:26 +03:00
save_artifacts,
2019-08-09 06:45:13 +03:00
coverage,
2020-12-08 07:41:07 +03:00
e2e_iso,
2020-07-30 21:44:10 +03:00
e2e_qemu,
2020-12-08 07:41:07 +03:00
e2e_docker,
2021-08-06 18:28:51 +03:00
release_notes,
2020-01-01 21:28:44 +03:00
push,
2019-11-27 18:39:53 +03:00
push_latest,
2019-08-09 06:45:13 +03:00
];
local default_trigger = {
trigger: {
2019-08-12 21:28:42 +03:00
event: {
2019-08-13 03:40:00 +03:00
exclude: [
2019-08-03 00:08:24 +03:00
'tag',
'promote',
2020-12-04 18:15:31 +03:00
'cron',
2019-08-03 00:08:24 +03:00
],
2019-08-09 06:45:13 +03:00
},
},
};
2021-02-16 22:30:26 +03:00
local cron_trigger(schedules) = {
trigger: {
cron: {
2021-02-17 20:35:12 +03:00
include: schedules,
2021-02-16 22:30:26 +03:00
},
},
};
2021-02-18 19:07:13 +03:00
local default_pipeline = Pipeline('default', default_steps) + default_trigger;
2021-02-18 20:44:24 +03:00
local default_cron_pipeline = Pipeline('cron-default', default_steps) + cron_trigger(['thrice-daily', 'nightly']);
2021-02-18 19:07:13 +03:00
// Full integration pipeline.
2021-02-16 22:30:26 +03:00
local default_pipeline_steps = [
setup_ci,
load_artifacts,
];
2021-02-24 15:43:27 +03:00
local integration_qemu = Step("e2e-qemu", privileged=true, depends_on=[load_artifacts], environment={"IMAGE_REGISTRY": local_registry});
2021-02-16 22:30:26 +03:00
2021-10-08 21:56:28 +03:00
local build_race = Step("build-race", target="initramfs installer", depends_on=[load_artifacts], environment={"IMAGE_REGISTRY": local_registry, "PUSH": true, "TAG_SUFFIX": "-race", "WITH_RACE": "1", "PLATFORM": "linux/amd64"});
2021-08-16 18:23:39 +03:00
local integration_qemu_race = Step("e2e-qemu-race", target="e2e-qemu", privileged=true, depends_on=[build_race], environment={"IMAGE_REGISTRY": local_registry, "TAG_SUFFIX": "-race"});
2021-02-16 22:30:26 +03:00
local integration_provision_tests_prepare = Step("provision-tests-prepare", privileged=true, depends_on=[load_artifacts]);
2021-02-24 15:43:27 +03:00
local integration_provision_tests_track_0 = Step("provision-tests-track-0", privileged=true, depends_on=[integration_provision_tests_prepare], environment={"IMAGE_REGISTRY": local_registry});
local integration_provision_tests_track_1 = Step("provision-tests-track-1", privileged=true, depends_on=[integration_provision_tests_prepare], environment={"IMAGE_REGISTRY": local_registry});
2021-02-20 17:07:38 +03:00
local integration_provision_tests_track_2 = Step("provision-tests-track-2", privileged=true, depends_on=[integration_provision_tests_prepare], environment={"IMAGE_REGISTRY": local_registry});
2021-02-16 22:30:26 +03:00
2022-02-10 23:30:09 +03:00
local integration_extensions = Step("e2e-extensions", target="e2e-qemu", privileged=true, depends_on=[load_artifacts], environment={
2022-01-26 23:26:34 +03:00
"SHORT_INTEGRATION_TEST": "yes",
2022-03-23 20:02:22 +03:00
"WITH_CONFIG_PATCH": '[{"op":"add","path":"/machine/install/extensions","value":[{"image":"ghcr.io/siderolabs/gvisor:54b831d"},{"image":"ghcr.io/siderolabs/intel-ucode:54b831d"},{"image":"ghcr.io/siderolabs/hello-world-service:a05f558"}]},{"op":"add","path":"/machine/sysctls","value":{"user.max_user_namespaces": "11255"}}]',
2022-02-10 23:30:09 +03:00
"WITH_TEST": "run_extensions_test",
2022-01-26 23:26:34 +03:00
"IMAGE_REGISTRY": local_registry,
});
2022-02-10 23:30:09 +03:00
local integration_cilium = Step("e2e-cilium-1.9.10", target="e2e-qemu", privileged=true, depends_on=[integration_extensions], environment={
2020-07-01 18:34:20 +03:00
"SHORT_INTEGRATION_TEST": "yes",
2021-10-14 15:40:54 +03:00
"CUSTOM_CNI_URL": "https://raw.githubusercontent.com/cilium/cilium/v1.9.10/install/kubernetes/quick-install.yaml",
2021-11-15 23:50:00 +03:00
"WITH_CONFIG_PATCH": '[{"op": "replace", "path": "/cluster/network/podSubnets", "value": ["10.0.0.0/8"]}]', # use Pod CIDRs as hardcoded in Cilium's quick-install
2021-02-24 15:43:27 +03:00
"IMAGE_REGISTRY": local_registry,
2020-07-01 18:34:20 +03:00
});
2022-03-02 18:36:04 +03:00
local integration_bios = Step("e2e-bios", target="e2e-qemu", privileged=true, depends_on=[integration_cilium], environment={
2020-08-27 23:23:20 +03:00
"SHORT_INTEGRATION_TEST": "yes",
2022-03-02 18:36:04 +03:00
"WITH_UEFI": "false",
2021-02-24 15:43:27 +03:00
"IMAGE_REGISTRY": local_registry,
2020-08-27 23:23:20 +03:00
});
2022-03-02 18:36:04 +03:00
local integration_disk_image = Step("e2e-disk-image", target="e2e-qemu", privileged=true, depends_on=[integration_bios], environment={
2020-12-21 21:01:37 +03:00
"SHORT_INTEGRATION_TEST": "yes",
"USE_DISK_IMAGE": "true",
2021-02-24 15:43:27 +03:00
"IMAGE_REGISTRY": local_registry,
2021-06-16 20:48:49 +03:00
"WITH_DISK_ENCRYPTION": "true",
2021-01-31 18:23:09 +03:00
});
2021-11-12 13:25:58 +03:00
local integration_canal_reset = Step("e2e-canal-disabled-reset", target="e2e-qemu", privileged=true, depends_on=[integration_disk_image], environment={
2020-12-24 18:06:25 +03:00
"INTEGRATION_TEST_RUN": "TestIntegration/api.ResetSuite/TestResetWithSpec",
2021-11-12 13:25:58 +03:00
// TODO: re-enable when https://github.com/projectcalico/cni-plugin/issues/1214 is fixed
// "CUSTOM_CNI_URL": "https://docs.projectcalico.org/manifests/canal.yaml",
2020-12-24 18:06:25 +03:00
"REGISTRY": local_registry,
});
2021-10-14 15:40:54 +03:00
local integration_no_cluster_discovery = Step("e2e-no-cluster-discovery", target="e2e-qemu", privileged=true, depends_on=[integration_canal_reset], environment={
"SHORT_INTEGRATION_TEST": "yes",
"WITH_CLUSTER_DISCOVERY": "false",
"IMAGE_REGISTRY": local_registry,
});
local integration_kubespan = Step("e2e-kubespan", target="e2e-qemu", privileged=true, depends_on=[integration_no_cluster_discovery], environment={
"SHORT_INTEGRATION_TEST": "yes",
"WITH_CLUSTER_DISCOVERY": "false",
"IMAGE_REGISTRY": local_registry,
});
2021-02-24 19:46:38 +03:00
local integration_qemu_encrypted_vip = Step("e2e-encrypted-vip", target="e2e-qemu", privileged=true, depends_on=[load_artifacts], environment={
2021-01-31 18:23:09 +03:00
"WITH_DISK_ENCRYPTION": "true",
2021-02-24 19:46:38 +03:00
"WITH_VIRTUAL_IP": "true",
2021-02-24 15:43:27 +03:00
"IMAGE_REGISTRY": local_registry,
2020-12-21 21:01:37 +03:00
});
2021-02-16 22:30:26 +03:00
2022-03-21 13:18:58 +03:00
local integration_qemu_day_two = Step("e2e-day-two", target="e2e-qemu", privileged=true, depends_on=[load_artifacts], environment={
2022-01-21 16:37:13 +03:00
"IMAGE_REGISTRY": local_registry,
"SHORT_INTEGRATION_TEST": "yes",
"QEMU_WORKERS": "3",
"QEMU_CPUS_WORKERS": "4",
"QEMU_MEMORY_WORKERS": "5120",
"QEMU_EXTRA_DISKS": "1",
"QEMU_EXTRA_DISKS_SIZE": "12288",
2022-03-21 13:18:58 +03:00
"WITH_TEST": "run_day_two_tests",
2022-01-21 16:37:13 +03:00
});
2021-12-24 21:30:07 +03:00
local integration_images = Step("images", target="images", depends_on=[load_artifacts], environment={"IMAGE_REGISTRY": local_registry});
local integration_sbcs = Step("sbcs", target="sbcs", depends_on=[integration_images], environment={"IMAGE_REGISTRY": local_registry});
2020-09-18 22:56:53 +03:00
local push_edge = {
name: 'push-edge',
image: 'autonomy/build-container:latest',
pull: 'always',
environment: {
2020-09-24 02:21:43 +03:00
GHCR_USERNAME: { from_secret: 'ghcr_username' },
2020-09-24 04:03:25 +03:00
GHCR_PASSWORD: { from_secret: 'ghcr_token' },
2020-09-18 22:56:53 +03:00
},
commands: ['make push-edge'],
volumes: volumes.ForStep(),
when: {
cron: [
'nightly',
],
},
depends_on: [
2021-02-16 22:30:26 +03:00
integration_qemu.name,
2020-09-18 22:56:53 +03:00
],
};
2020-06-25 22:56:59 +03:00
2021-02-16 22:30:26 +03:00
local integration_trigger(names) = {
2020-06-25 22:56:59 +03:00
trigger: {
target: {
2021-02-16 22:30:26 +03:00
include: ['integration'] + names,
2020-07-02 00:11:26 +03:00
},
},
};
2021-02-16 22:30:26 +03:00
local integration_pipelines = [
// regular pipelines, triggered on promote events
Pipeline('integration-qemu', default_pipeline_steps + [integration_qemu, push_edge]) + integration_trigger(['integration-qemu']),
Pipeline('integration-provision-0', default_pipeline_steps + [integration_provision_tests_prepare, integration_provision_tests_track_0]) + integration_trigger(['integration-provision', 'integration-provision-0']),
Pipeline('integration-provision-1', default_pipeline_steps + [integration_provision_tests_prepare, integration_provision_tests_track_1]) + integration_trigger(['integration-provision', 'integration-provision-1']),
2021-02-20 17:07:38 +03:00
Pipeline('integration-provision-2', default_pipeline_steps + [integration_provision_tests_prepare, integration_provision_tests_track_2]) + integration_trigger(['integration-provision', 'integration-provision-2']),
2022-02-10 23:30:09 +03:00
Pipeline('integration-misc', default_pipeline_steps + [integration_extensions
2022-03-02 18:36:04 +03:00
, integration_cilium, integration_bios, integration_disk_image, integration_canal_reset, integration_no_cluster_discovery, integration_kubespan]) + integration_trigger(['integration-misc']),
2021-02-24 19:46:38 +03:00
Pipeline('integration-qemu-encrypted-vip', default_pipeline_steps + [integration_qemu_encrypted_vip]) + integration_trigger(['integration-qemu-encrypted-vip']),
2021-08-16 18:23:39 +03:00
Pipeline('integration-qemu-race', default_pipeline_steps + [build_race, integration_qemu_race]) + integration_trigger(['integration-qemu-race']),
2022-03-21 13:18:58 +03:00
Pipeline('integration-qemu-day-two', default_pipeline_steps + [integration_qemu_day_two]) + integration_trigger(['integration-qemu-day-two']),
2021-12-24 21:30:07 +03:00
Pipeline('integration-images', default_pipeline_steps + [integration_images, integration_sbcs]) + integration_trigger(['integration-images']),
2021-02-16 22:30:26 +03:00
// cron pipelines, triggered on schedule events
2021-02-18 19:07:13 +03:00
Pipeline('cron-integration-qemu', default_pipeline_steps + [integration_qemu, push_edge], [default_cron_pipeline]) + cron_trigger(['thrice-daily', 'nightly']),
Pipeline('cron-integration-provision-0', default_pipeline_steps + [integration_provision_tests_prepare, integration_provision_tests_track_0], [default_cron_pipeline]) + cron_trigger(['thrice-daily', 'nightly']),
Pipeline('cron-integration-provision-1', default_pipeline_steps + [integration_provision_tests_prepare, integration_provision_tests_track_1], [default_cron_pipeline]) + cron_trigger(['thrice-daily', 'nightly']),
2021-02-20 17:07:38 +03:00
Pipeline('cron-integration-provision-2', default_pipeline_steps + [integration_provision_tests_prepare, integration_provision_tests_track_2], [default_cron_pipeline]) + cron_trigger(['thrice-daily', 'nightly']),
2022-02-10 23:30:09 +03:00
Pipeline('cron-integration-misc', default_pipeline_steps + [integration_extensions
2022-03-02 18:36:04 +03:00
, integration_cilium, integration_bios, integration_disk_image, integration_canal_reset, integration_no_cluster_discovery, integration_kubespan], [default_cron_pipeline]) + cron_trigger(['thrice-daily', 'nightly']),
2021-02-24 19:46:38 +03:00
Pipeline('cron-integration-qemu-encrypted-vip', default_pipeline_steps + [integration_qemu_encrypted_vip], [default_cron_pipeline]) + cron_trigger(['thrice-daily', 'nightly']),
2021-08-16 18:23:39 +03:00
Pipeline('cron-integration-qemu-race', default_pipeline_steps + [build_race, integration_qemu_race], [default_cron_pipeline]) + cron_trigger(['nightly']),
2022-03-21 13:18:58 +03:00
Pipeline('cron-integration-qemu-day-two', default_pipeline_steps + [integration_qemu_day_two], [default_cron_pipeline]) + cron_trigger(['nightly']),
2021-12-24 21:30:07 +03:00
Pipeline('cron-integration-images', default_pipeline_steps + [integration_images, integration_sbcs], [default_cron_pipeline]) + cron_trigger(['nightly']),
2021-02-16 22:30:26 +03:00
];
2020-07-02 00:11:26 +03:00
2020-06-25 22:56:59 +03:00
2019-08-11 00:29:25 +03:00
// E2E pipeline.
local creds_env_vars = {
2020-01-24 07:52:02 +03:00
AWS_ACCESS_KEY_ID: { from_secret: 'aws_access_key_id' },
AWS_SECRET_ACCESS_KEY: { from_secret: 'aws_secret_access_key' },
AWS_SVC_ACCT: {from_secret: "aws_svc_acct"},
AZURE_SVC_ACCT: {from_secret: "azure_svc_acct"},
// TODO(andrewrynhard): Rename this to the GCP convention.
GCE_SVC_ACCT: {from_secret: "gce_svc_acct"},
PACKET_AUTH_TOKEN: {from_secret: "packet_auth_token"},
2019-08-09 06:45:13 +03:00
};
2021-08-09 18:19:14 +03:00
local capi_docker = Step("e2e-docker", depends_on=[load_artifacts], target="e2e-docker", environment={
"IMAGE_REGISTRY": local_registry,
"SHORT_INTEGRATION_TEST": "yes",
"INTEGRATION_TEST_RUN": "XXX",
});
2021-02-16 22:30:26 +03:00
local e2e_capi = Step("e2e-capi", depends_on=[capi_docker], environment=creds_env_vars);
2020-07-30 00:36:58 +03:00
local e2e_aws = Step("e2e-aws", depends_on=[e2e_capi], environment=creds_env_vars);
local e2e_azure = Step("e2e-azure", depends_on=[e2e_capi], environment=creds_env_vars);
local e2e_gcp = Step("e2e-gcp", depends_on=[e2e_capi], environment=creds_env_vars);
2019-08-11 00:29:25 +03:00
2021-02-16 22:30:26 +03:00
local e2e_trigger(names) = {
2019-08-09 06:45:13 +03:00
trigger: {
target: {
2021-02-16 22:30:26 +03:00
include: ['e2e'] + names,
2019-08-09 06:45:13 +03:00
},
},
};
2021-02-16 22:30:26 +03:00
local e2e_pipelines = [
// regular pipelines, triggered on promote events
Pipeline('e2e-aws', default_pipeline_steps + [capi_docker, e2e_capi, e2e_aws]) + e2e_trigger(['e2e-aws']),
Pipeline('e2e-gcp', default_pipeline_steps + [capi_docker, e2e_capi, e2e_gcp]) + e2e_trigger(['e2e-gcp']),
// cron pipelines, triggered on schedule events
2021-02-18 19:07:13 +03:00
Pipeline('cron-e2e-aws', default_pipeline_steps + [capi_docker, e2e_capi, e2e_aws], [default_cron_pipeline]) + cron_trigger(['thrice-daily','nightly']),
Pipeline('cron-e2e-gcp', default_pipeline_steps + [capi_docker, e2e_capi, e2e_gcp], [default_cron_pipeline]) + cron_trigger(['thrice-daily','nightly']),
2021-02-16 22:30:26 +03:00
];
2019-08-11 00:29:25 +03:00
// Conformance pipeline.
2021-04-14 16:19:15 +03:00
local conformance_k8s_qemu = Step("conformance-k8s-qemu", target="e2e-qemu", privileged=true, depends_on=[load_artifacts], environment={
"QEMU_WORKERS": "2", // conformance test requires >=2 workers
"QEMU_CPUS": "4", // conformance test in parallel runs with number of CPUs
"TEST_MODE": "fast-conformance",
"IMAGE_REGISTRY": local_registry,
});
2019-08-11 00:29:25 +03:00
2021-02-16 22:30:26 +03:00
local conformance_trigger(names) = {
2019-08-09 06:45:13 +03:00
trigger: {
target: {
2021-02-16 22:30:26 +03:00
include: ['conformance'] + names,
2019-08-09 06:45:13 +03:00
},
},
};
2021-02-16 22:30:26 +03:00
local conformance_pipelines = [
2021-04-14 16:19:15 +03:00
// regular pipelines, triggered on promote events
Pipeline('conformance-qemu', default_pipeline_steps + [conformance_k8s_qemu]) + conformance_trigger(['conformance-qemu']),
// cron pipelines, triggered on schedule events
2021-05-07 21:37:34 +03:00
Pipeline('cron-conformance-qemu', default_pipeline_steps + [conformance_k8s_qemu], [default_cron_pipeline]) + cron_trigger(['nightly']),
2021-02-16 22:30:26 +03:00
];
2019-08-11 00:29:25 +03:00
// Release pipeline.
2021-06-23 21:05:10 +03:00
local cloud_images = Step("cloud-images", depends_on=[e2e_docker, e2e_qemu], environment=creds_env_vars);
2022-03-14 18:32:03 +03:00
local images = Step("images", target="images", depends_on=[iso, images_essential], environment={"IMAGE_REGISTRY": local_registry});
2021-12-24 21:30:07 +03:00
local sbcs = Step("sbcs", target="sbcs", depends_on=[images], environment={"IMAGE_REGISTRY": local_registry});
2021-06-23 21:05:10 +03:00
2019-08-11 00:29:25 +03:00
// TODO(andrewrynhard): We should run E2E tests on a release.
2019-08-03 00:08:24 +03:00
local release = {
name: 'release',
image: 'plugins/github-release',
settings: {
api_key: { from_secret: 'github_token' },
2019-08-11 00:29:25 +03:00
draft: true,
2020-07-28 23:55:47 +03:00
note: '_out/RELEASE_NOTES.md',
2019-12-31 04:16:37 +03:00
files: [
2020-11-13 17:17:07 +03:00
'_out/aws-amd64.tar.gz',
'_out/aws-arm64.tar.gz',
'_out/azure-amd64.tar.gz',
'_out/azure-arm64.tar.gz',
2021-06-23 21:05:10 +03:00
'_out/cloud-images.json',
2020-11-13 17:17:07 +03:00
'_out/digital-ocean-amd64.tar.gz',
'_out/digital-ocean-arm64.tar.gz',
'_out/gcp-amd64.tar.gz',
'_out/gcp-arm64.tar.gz',
2021-08-17 18:29:59 +03:00
'_out/hcloud-amd64.raw.xz',
'_out/hcloud-arm64.raw.xz',
2020-09-26 00:00:43 +03:00
'_out/initramfs-amd64.xz',
'_out/initramfs-arm64.xz',
2020-11-25 18:00:02 +03:00
'_out/metal-amd64.tar.gz',
'_out/metal-arm64.tar.gz',
2020-12-02 05:30:02 +03:00
'_out/metal-rpi_4-arm64.img.xz',
2021-04-03 22:48:31 +03:00
'_out/metal-rockpi_4-arm64.img.xz',
2020-12-04 22:59:08 +03:00
'_out/metal-rock64-arm64.img.xz',
2021-05-04 21:48:10 +03:00
'_out/metal-pine64-arm64.img.xz',
2020-12-02 05:30:02 +03:00
'_out/metal-bananapi_m64-arm64.img.xz',
'_out/metal-libretech_all_h3_cc_h5-arm64.img.xz',
2022-01-13 22:38:07 +03:00
'_out/metal-jetson_nano-arm64.img.xz',
2021-08-28 10:56:26 +03:00
'_out/nocloud-amd64.raw.xz',
'_out/nocloud-arm64.raw.xz',
2020-11-25 17:15:50 +03:00
'_out/openstack-amd64.tar.gz',
'_out/openstack-arm64.tar.gz',
2021-12-17 09:18:32 +03:00
'_out/oracle-amd64.qcow2.xz',
'_out/oracle-arm64.qcow2.xz',
2021-08-21 20:00:00 +03:00
'_out/scaleway-amd64.raw.xz',
'_out/scaleway-arm64.raw.xz',
2020-11-01 00:03:56 +03:00
'_out/talos-amd64.iso',
2020-11-13 17:17:07 +03:00
'_out/talos-arm64.iso',
2020-10-30 01:08:05 +03:00
'_out/talosctl-cni-bundle-amd64.tar.gz',
'_out/talosctl-cni-bundle-arm64.tar.gz',
2020-03-21 03:38:48 +03:00
'_out/talosctl-darwin-amd64',
2021-04-20 15:58:30 +03:00
'_out/talosctl-darwin-arm64',
2020-03-21 03:38:48 +03:00
'_out/talosctl-linux-amd64',
2020-03-22 00:27:03 +03:00
'_out/talosctl-linux-arm64',
2020-03-22 04:08:09 +03:00
'_out/talosctl-linux-armv7',
2021-08-25 19:08:48 +03:00
'_out/talosctl-windows-amd64.exe',
2021-08-24 21:09:51 +03:00
'_out/upcloud-amd64.raw.xz',
'_out/upcloud-arm64.raw.xz',
2020-11-13 17:17:07 +03:00
'_out/vmware-amd64.ova',
'_out/vmware-arm64.ova',
2020-09-26 00:00:43 +03:00
'_out/vmlinuz-amd64',
'_out/vmlinuz-arm64',
2021-08-25 21:13:17 +03:00
'_out/vultr-amd64.raw.xz',
'_out/vultr-arm64.raw.xz',
2019-12-31 04:16:37 +03:00
],
2019-08-03 00:08:24 +03:00
checksum: ['sha256', 'sha512'],
2019-08-11 00:29:25 +03:00
},
when: {
2019-08-03 00:08:24 +03:00
event: ['tag'],
2019-08-11 00:29:25 +03:00
},
2021-12-07 15:42:07 +03:00
depends_on: [build.name, cloud_images.name, talosctl_cni_bundle.name, images.name, sbcs.name, iso.name, push.name, release_notes.name]
2019-08-11 00:29:25 +03:00
};
local release_steps = default_steps + [
2021-12-30 17:46:00 +03:00
images,
sbcs,
2021-06-23 21:05:10 +03:00
cloud_images,
2019-08-11 19:54:33 +03:00
release,
2019-08-11 00:29:25 +03:00
];
2019-08-09 06:45:13 +03:00
local release_trigger = {
trigger: {
2019-08-11 20:52:20 +03:00
event: [
2019-08-03 00:08:24 +03:00
'tag',
2019-08-11 20:52:20 +03:00
],
2021-07-07 19:09:37 +03:00
ref: {
exclude: [
"refs/tags/pkg/**",
],
},
2019-08-09 06:45:13 +03:00
},
};
2019-08-03 00:08:24 +03:00
local release_pipeline = Pipeline('release', release_steps) + release_trigger;
2019-08-11 00:29:25 +03:00
// Notify pipeline.
local notify = {
2019-08-03 00:08:24 +03:00
name: 'slack',
image: 'plugins/slack',
2020-07-23 21:21:42 +03:00
settings: {
2019-08-03 00:08:24 +03:00
webhook: { from_secret: 'slack_webhook' },
2019-09-09 18:51:10 +03:00
channel: 'proj-talos-maintainers',
2019-10-22 16:07:31 +03:00
link_names: true,
template: '{{#if build.pull }}
*{{#success build.status}}✓ Success{{else}}✕ Fail{{/success}}*: {{ repo.owner }}/{{ repo.name }} - <https://github.com/{{ repo.owner }}/{{ repo.name }}/pull/{{ build.pull }}|Pull Request #{{ build.pull }}>
{{else}}
*{{#success build.status}}✓ Success{{else}}✕ Fail{{/success}}: {{ repo.owner }}/{{ repo.name }} - Build #{{ build.number }}* (type: `{{ build.event }}`)
{{/if}}
Commit: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
Branch: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
Author: {{ build.author }}
<{{ build.link }}|Visit build page>'
2019-08-11 00:29:25 +03:00
},
2020-07-23 21:21:42 +03:00
when: {
status: [
'success',
'failure'
],
},
2019-08-11 00:29:25 +03:00
};
local notify_steps = [notify];
2019-08-09 06:45:13 +03:00
local notify_trigger = {
trigger: {
2019-08-03 00:08:24 +03:00
status: ['success', 'failure'],
2019-08-09 06:45:13 +03:00
},
};
2021-06-23 21:05:10 +03:00
local notify_pipeline = Pipeline('notify', notify_steps, [default_pipeline, release_pipeline] + integration_pipelines + e2e_pipelines + conformance_pipelines, false, true) + notify_trigger;
2019-08-11 00:29:25 +03:00
// Final configuration file definition.
2019-08-09 06:45:13 +03:00
[
default_pipeline,
2021-02-18 20:44:24 +03:00
default_cron_pipeline,
2019-08-09 06:45:13 +03:00
release_pipeline,
2021-02-16 22:30:26 +03:00
] + integration_pipelines + e2e_pipelines + conformance_pipelines + [
2019-08-09 06:45:13 +03:00
notify_pipeline,
]