chore: push installer & talos images to the CI registry on every build

This enables a way to run the matching installer image in firecracker
tests. New image is used in firecracker tests and bootloader support to
use installed kernel/initramfs, which opens path for upgrade tests.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This commit is contained in:
Andrey Smirnov 2020-02-13 23:07:36 +03:00 committed by Andrew Rynhard
parent c9a8605f87
commit 5f330f1f64
4 changed files with 380 additions and 11 deletions

View File

@ -163,6 +163,27 @@ steps:
depends_on:
- initramfs
- name: installer-local
pull: always
image: autonomy/build-container:latest
commands:
- make installer
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer
- name: talos
pull: always
image: autonomy/build-container:latest
@ -182,6 +203,27 @@ steps:
depends_on:
- initramfs
- name: talos-local
pull: always
image: autonomy/build-container:latest
commands:
- make talos
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- talos
- name: lint-go
pull: always
image: autonomy/build-container:latest
@ -386,6 +428,29 @@ steps:
depends_on:
- unit-tests
- name: push-local
pull: always
image: autonomy/build-container:latest
commands:
- make push
environment:
DOCKER_LOGIN_ENABLED: false
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer-local
- talos-local
- name: e2e-docker
pull: always
image: autonomy/build-container:latest
@ -411,6 +476,8 @@ steps:
image: autonomy/build-container:latest
commands:
- make e2e-firecracker
environment:
REGISTRY: registry.ci.svc:5000
privileged: true
volumes:
- name: dockersock
@ -427,6 +494,7 @@ steps:
- initramfs
- osctl-linux
- kernel
- push-local
- name: push
pull: always
@ -499,6 +567,7 @@ services:
- --dns=8.8.4.4
- --mtu=1500
- --log-level=error
- --insecure-registry=registry.ci.svc:5000
privileged: true
ports:
- 6443
@ -689,6 +758,27 @@ steps:
depends_on:
- initramfs
- name: installer-local
pull: always
image: autonomy/build-container:latest
commands:
- make installer
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer
- name: talos
pull: always
image: autonomy/build-container:latest
@ -708,6 +798,27 @@ steps:
depends_on:
- initramfs
- name: talos-local
pull: always
image: autonomy/build-container:latest
commands:
- make talos
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- talos
- name: lint-go
pull: always
image: autonomy/build-container:latest
@ -912,6 +1023,29 @@ steps:
depends_on:
- unit-tests
- name: push-local
pull: always
image: autonomy/build-container:latest
commands:
- make push
environment:
DOCKER_LOGIN_ENABLED: false
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer-local
- talos-local
- name: e2e-docker
pull: always
image: autonomy/build-container:latest
@ -937,6 +1071,8 @@ steps:
image: autonomy/build-container:latest
commands:
- make e2e-firecracker
environment:
REGISTRY: registry.ci.svc:5000
privileged: true
volumes:
- name: dockersock
@ -953,6 +1089,7 @@ steps:
- initramfs
- osctl-linux
- kernel
- push-local
- name: push
pull: always
@ -1122,6 +1259,7 @@ services:
- --dns=8.8.4.4
- --mtu=1500
- --log-level=error
- --insecure-registry=registry.ci.svc:5000
privileged: true
ports:
- 6443
@ -1307,6 +1445,27 @@ steps:
depends_on:
- initramfs
- name: installer-local
pull: always
image: autonomy/build-container:latest
commands:
- make installer
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer
- name: talos
pull: always
image: autonomy/build-container:latest
@ -1326,6 +1485,27 @@ steps:
depends_on:
- initramfs
- name: talos-local
pull: always
image: autonomy/build-container:latest
commands:
- make talos
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- talos
- name: lint-go
pull: always
image: autonomy/build-container:latest
@ -1530,6 +1710,29 @@ steps:
depends_on:
- unit-tests
- name: push-local
pull: always
image: autonomy/build-container:latest
commands:
- make push
environment:
DOCKER_LOGIN_ENABLED: false
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer-local
- talos-local
- name: e2e-docker
pull: always
image: autonomy/build-container:latest
@ -1555,6 +1758,8 @@ steps:
image: autonomy/build-container:latest
commands:
- make e2e-firecracker
environment:
REGISTRY: registry.ci.svc:5000
privileged: true
volumes:
- name: dockersock
@ -1571,6 +1776,7 @@ steps:
- initramfs
- osctl-linux
- kernel
- push-local
- name: push
pull: always
@ -1770,6 +1976,7 @@ services:
- --dns=8.8.4.4
- --mtu=1500
- --log-level=error
- --insecure-registry=registry.ci.svc:5000
privileged: true
ports:
- 6443
@ -1955,6 +2162,27 @@ steps:
depends_on:
- initramfs
- name: installer-local
pull: always
image: autonomy/build-container:latest
commands:
- make installer
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer
- name: talos
pull: always
image: autonomy/build-container:latest
@ -1974,6 +2202,27 @@ steps:
depends_on:
- initramfs
- name: talos-local
pull: always
image: autonomy/build-container:latest
commands:
- make talos
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- talos
- name: lint-go
pull: always
image: autonomy/build-container:latest
@ -2178,6 +2427,29 @@ steps:
depends_on:
- unit-tests
- name: push-local
pull: always
image: autonomy/build-container:latest
commands:
- make push
environment:
DOCKER_LOGIN_ENABLED: false
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer-local
- talos-local
- name: e2e-docker
pull: always
image: autonomy/build-container:latest
@ -2203,6 +2475,8 @@ steps:
image: autonomy/build-container:latest
commands:
- make e2e-firecracker
environment:
REGISTRY: registry.ci.svc:5000
privileged: true
volumes:
- name: dockersock
@ -2219,6 +2493,7 @@ steps:
- initramfs
- osctl-linux
- kernel
- push-local
- name: push
pull: always
@ -2418,6 +2693,7 @@ services:
- --dns=8.8.4.4
- --mtu=1500
- --log-level=error
- --insecure-registry=registry.ci.svc:5000
privileged: true
ports:
- 6443
@ -2603,6 +2879,27 @@ steps:
depends_on:
- initramfs
- name: installer-local
pull: always
image: autonomy/build-container:latest
commands:
- make installer
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer
- name: talos
pull: always
image: autonomy/build-container:latest
@ -2622,6 +2919,27 @@ steps:
depends_on:
- initramfs
- name: talos-local
pull: always
image: autonomy/build-container:latest
commands:
- make talos
environment:
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- talos
- name: lint-go
pull: always
image: autonomy/build-container:latest
@ -2826,6 +3144,29 @@ steps:
depends_on:
- unit-tests
- name: push-local
pull: always
image: autonomy/build-container:latest
commands:
- make push
environment:
DOCKER_LOGIN_ENABLED: false
REGISTRY: registry.ci.svc:5000
volumes:
- name: dockersock
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube
- name: dev
path: /dev
- name: tmp
path: /tmp
depends_on:
- installer-local
- talos-local
- name: e2e-docker
pull: always
image: autonomy/build-container:latest
@ -2851,6 +3192,8 @@ steps:
image: autonomy/build-container:latest
commands:
- make e2e-firecracker
environment:
REGISTRY: registry.ci.svc:5000
privileged: true
volumes:
- name: dockersock
@ -2867,6 +3210,7 @@ steps:
- initramfs
- osctl-linux
- kernel
- push-local
- name: push
pull: always
@ -3014,6 +3358,7 @@ services:
- --dns=8.8.4.4
- --mtu=1500
- --log-level=error
- --insecure-registry=registry.ci.svc:5000
privileged: true
ports:
- 6443
@ -3102,6 +3447,6 @@ depends_on:
---
kind: signature
hmac: 84131ac5504f383563cba78fdadbf8f21721bc9a2e46991f236944c533137850
hmac: bd5e6446a0d875f2acec08a36fbb274e4763fdf115e1042bf07f8cacc6c37263
...

View File

@ -4,6 +4,7 @@ SHA ?= $(shell git describe --match=none --always --abbrev=8 --dirty)
TAG ?= $(shell git describe --tag --always --dirty)
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
REGISTRY_AND_USERNAME := $(REGISTRY)/$(USERNAME)
DOCKER_LOGIN_ENABLED ?= true
ARTIFACTS := _out
TOOLS ?= autonomy/tools:v0.1.0-1-g1c0644f
@ -57,7 +58,8 @@ docker buildx create --driver docker-container --name local --buildkitd-flags '-
If you already have a compatible builder instance, you may use that instead.
> Note: The security.insecure entitlement is only required, and used by the unit-tests target.
> Note: The security.insecure entitlement is only required, and used by the unit-tests target and targets which build container images
for applications using `img` tool.
## Artifacts
@ -195,17 +197,19 @@ e2e-%: $(ARTIFACTS)/$(INTEGRATION_TEST_DEFAULT_TARGET)-amd64 $(ARTIFACTS)/sonobu
.PHONY: login
login: ## Logs in to the configured container registry.
ifeq ($(DOCKER_LOGIN_ENABLED), true)
@docker login --username "$(DOCKER_USERNAME)" --password "$(DOCKER_PASSWORD)" $(REGISTRY)
endif
push: login ## Pushes the installer, and talos images to the configured container registry with the generated tag.
@docker push autonomy/installer:$(TAG)
@docker push autonomy/talos:$(TAG)
@docker push $(REGISTRY_AND_USERNAME)/installer:$(TAG)
@docker push $(REGISTRY_AND_USERNAME)/talos:$(TAG)
push-%: login ## Pushes the installer, and talos images to the configured container registry with the specified tag (e.g. push-latest).
@docker tag autonomy/installer:$(TAG) autonomy/installer:$*
@docker tag autonomy/talos:$(TAG) autonomy/talos:$*
@docker push autonomy/installer:$*
@docker push autonomy/talos:$*
@docker tag $(REGISTRY_AND_USERNAME)/installer:$(TAG) $(REGISTRY_AND_USERNAME)/installer:$*
@docker tag $(REGISTRY_AND_USERNAME)/talos:$(TAG) $(REGISTRY_AND_USERNAME)/talos:$*
@docker push $(REGISTRY_AND_USERNAME)/installer:$*
@docker push $(REGISTRY_AND_USERNAME)/talos:$*
.PHONY: clean
clean: ## Cleans up all artifacts.

View File

@ -5,6 +5,7 @@
// Generate with `drone jsonnet --source ./hack/drone.jsonnet --stream --format`
local build_container = 'autonomy/build-container:latest';
local local_registry = 'registry.ci.svc:5000';
local secret = {
kind: 'secret',
@ -118,6 +119,7 @@ local docker = {
'--dns=8.8.4.4',
'--mtu=1500',
'--log-level=error',
'--insecure-registry=' + local_registry,
],
ports: [
6443,
@ -195,6 +197,8 @@ local kernel = Step('kernel', depends_on=[setup_ci]);
local initramfs = Step("initramfs", depends_on=[setup_ci]);
local installer = Step("installer", depends_on=[initramfs]);
local talos = Step("talos", depends_on=[initramfs]);
local installer_local = Step("installer-local", depends_on=[installer], target="installer", environment={"REGISTRY": local_registry});
local talos_local = Step("talos-local", depends_on=[talos], target="talos", environment={"REGISTRY": local_registry});
local golint = Step("lint-go", depends_on=[setup_ci]);
local protobuflint = Step("lint-protobuf", depends_on=[setup_ci]);
local markdownlint = Step("lint-markdown", depends_on=[setup_ci]);
@ -203,10 +207,11 @@ local image_azure = Step("image-azure", depends_on=[installer]);
local image_digital_ocean = Step("image-digital-ocean", depends_on=[installer]);
local image_gcp = Step("image-gcp", depends_on=[installer]);
local image_vmware = Step("image-vmware", depends_on=[installer]);
local push_local = Step("push-local", depends_on=[installer_local, talos_local], target="push", environment={"REGISTRY": local_registry, "DOCKER_LOGIN_ENABLED": "false"} );
local unit_tests = Step("unit-tests", depends_on=[initramfs]);
local unit_tests_race = Step("unit-tests-race", depends_on=[golint]);
local e2e_docker = Step("e2e-docker", depends_on=[talos, osctl_linux]);
local e2e_firecracker = Step("e2e-firecracker", privileged=true, depends_on=[initramfs, osctl_linux, kernel]);
local e2e_firecracker = Step("e2e-firecracker", privileged=true, depends_on=[initramfs, osctl_linux, kernel, push_local], environment={"REGISTRY": local_registry});
local coverage = {
name: 'coverage',
@ -275,7 +280,9 @@ local default_steps = [
kernel,
initramfs,
installer,
installer_local,
talos,
talos_local,
golint,
protobuflint,
markdownlint,
@ -287,6 +294,7 @@ local default_steps = [
unit_tests,
unit_tests_race,
coverage,
push_local,
e2e_docker,
e2e_firecracker,
push,

View File

@ -7,6 +7,18 @@ source ./hack/test/e2e.sh
PROVISIONER=firecracker
CLUSTER_NAME=e2e-${PROVISIONER}
case "${REGISTRY:-false}" in
registry.ci.svc:5000)
REGISTRY_ADDR=`python -c "import socket; print socket.gethostbyname('registry.ci.svc')"`
FIRECRACKER_FLAGS="--registry-mirror ${REGISTRY}=http://${REGISTRY_ADDR}:5000 --with-bootloader-emulation"
INSTALLER_TAG="${TAG}"
;;
*)
FIRECRACKER_FLAGS=
INSTALLER_TAG="latest"
;;
esac
function create_cluster {
"${OSCTL}" cluster create \
--provisioner "${PROVISIONER}" \
@ -16,9 +28,9 @@ function create_cluster {
--memory 2048 \
--cpus 2.0 \
--cidr 172.20.0.0/24 \
--init-node-as-endpoint \
--wait \
--install-image docker.io/autonomy/installer:latest
--install-image ${REGISTRY:-docker.io}/autonomy/installer:${INSTALLER_TAG} \
${FIRECRACKER_FLAGS}
}
create_cluster