chore: update all target in Makefile

We should build the most common things by default.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This commit is contained in:
Andrew Rynhard 2020-01-04 13:19:34 -08:00
parent 6722a52aba
commit 794d9e6066
5 changed files with 87 additions and 295 deletions

View File

@ -228,53 +228,6 @@ steps:
depends_on:
- osctl-linux
- name: integration-test
pull: always
image: autonomy/build-container:latest
commands:
- make integration-test
environment:
BINDIR: /usr/local/bin
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:
- setup-ci
- name: rootfs
pull: always
image: autonomy/build-container:latest
commands:
- make target-rootfs
environment:
BINDIR: /usr/local/bin
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:
- machined
- osd
- trustd
- ntpd
- networkd
- apid
- name: initramfs
pull: always
image: autonomy/build-container:latest
@ -294,7 +247,12 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- apid
- machined
- networkd
- ntpd
- osd
- trustd
- name: installer
pull: always
@ -315,7 +273,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- initramfs
- name: talos
pull: always
@ -336,7 +294,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- installer
- name: lint-go
pull: always
@ -525,7 +483,6 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- talos
- name: unit-tests-race
@ -584,7 +541,6 @@ steps:
- unit-tests
- talos
- osctl-linux
- integration-test
- name: push
pull: always
@ -918,53 +874,6 @@ steps:
depends_on:
- osctl-linux
- name: integration-test
pull: always
image: autonomy/build-container:latest
commands:
- make integration-test
environment:
BINDIR: /usr/local/bin
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:
- setup-ci
- name: rootfs
pull: always
image: autonomy/build-container:latest
commands:
- make target-rootfs
environment:
BINDIR: /usr/local/bin
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:
- machined
- osd
- trustd
- ntpd
- networkd
- apid
- name: initramfs
pull: always
image: autonomy/build-container:latest
@ -984,7 +893,12 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- apid
- machined
- networkd
- ntpd
- osd
- trustd
- name: installer
pull: always
@ -1005,7 +919,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- initramfs
- name: talos
pull: always
@ -1026,7 +940,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- installer
- name: lint-go
pull: always
@ -1215,7 +1129,6 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- talos
- name: unit-tests-race
@ -1274,7 +1187,6 @@ steps:
- unit-tests
- talos
- osctl-linux
- integration-test
- name: push
pull: always
@ -1736,53 +1648,6 @@ steps:
depends_on:
- osctl-linux
- name: integration-test
pull: always
image: autonomy/build-container:latest
commands:
- make integration-test
environment:
BINDIR: /usr/local/bin
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:
- setup-ci
- name: rootfs
pull: always
image: autonomy/build-container:latest
commands:
- make target-rootfs
environment:
BINDIR: /usr/local/bin
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:
- machined
- osd
- trustd
- ntpd
- networkd
- apid
- name: initramfs
pull: always
image: autonomy/build-container:latest
@ -1802,7 +1667,12 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- apid
- machined
- networkd
- ntpd
- osd
- trustd
- name: installer
pull: always
@ -1823,7 +1693,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- initramfs
- name: talos
pull: always
@ -1844,7 +1714,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- installer
- name: lint-go
pull: always
@ -2033,7 +1903,6 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- talos
- name: unit-tests-race
@ -2092,7 +1961,6 @@ steps:
- unit-tests
- talos
- osctl-linux
- integration-test
- name: push
pull: always
@ -2584,53 +2452,6 @@ steps:
depends_on:
- osctl-linux
- name: integration-test
pull: always
image: autonomy/build-container:latest
commands:
- make integration-test
environment:
BINDIR: /usr/local/bin
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:
- setup-ci
- name: rootfs
pull: always
image: autonomy/build-container:latest
commands:
- make target-rootfs
environment:
BINDIR: /usr/local/bin
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:
- machined
- osd
- trustd
- ntpd
- networkd
- apid
- name: initramfs
pull: always
image: autonomy/build-container:latest
@ -2650,7 +2471,12 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- apid
- machined
- networkd
- ntpd
- osd
- trustd
- name: installer
pull: always
@ -2671,7 +2497,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- initramfs
- name: talos
pull: always
@ -2692,7 +2518,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- installer
- name: lint-go
pull: always
@ -2881,7 +2707,6 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- talos
- name: unit-tests-race
@ -2940,7 +2765,6 @@ steps:
- unit-tests
- talos
- osctl-linux
- integration-test
- name: push
pull: always
@ -3432,53 +3256,6 @@ steps:
depends_on:
- osctl-linux
- name: integration-test
pull: always
image: autonomy/build-container:latest
commands:
- make integration-test
environment:
BINDIR: /usr/local/bin
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:
- setup-ci
- name: rootfs
pull: always
image: autonomy/build-container:latest
commands:
- make target-rootfs
environment:
BINDIR: /usr/local/bin
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:
- machined
- osd
- trustd
- ntpd
- networkd
- apid
- name: initramfs
pull: always
image: autonomy/build-container:latest
@ -3498,7 +3275,12 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- apid
- machined
- networkd
- ntpd
- osd
- trustd
- name: installer
pull: always
@ -3519,7 +3301,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- initramfs
- name: talos
pull: always
@ -3540,7 +3322,7 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- installer
- name: lint-go
pull: always
@ -3729,7 +3511,6 @@ steps:
- name: tmp
path: /tmp
depends_on:
- rootfs
- talos
- name: unit-tests-race
@ -3788,7 +3569,6 @@ steps:
- unit-tests
- talos
- osctl-linux
- integration-test
- name: push
pull: always

View File

@ -345,7 +345,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build go test -v -count 1 -race ${
# The integration-test target builds integration test binary.
FROM base AS integration-test-build
FROM base AS integration-test-linux-build
ARG SHA
ARG TAG
ARG VERSION_PKG="github.com/talos-systems/talos/pkg/version"
@ -354,8 +354,20 @@ RUN --mount=type=cache,target=/.cache/go-build GOOS=linux GOARCH=amd64 go test -
-tags integration,integration_api,integration_cli,integration_k8s \
./internal/integration
FROM scratch AS integration-test
COPY --from=integration-test-build /src/integration.test /integration-test
FROM scratch AS integration-test-linux
COPY --from=integration-test-linux-build /src/integration.test /integration-test-linux-amd64
FROM base AS integration-test-darwin-build
ARG SHA
ARG TAG
ARG VERSION_PKG="github.com/talos-systems/talos/pkg/version"
RUN --mount=type=cache,target=/.cache/go-build GOOS=darwin GOARCH=amd64 go test -c \
-ldflags "-s -w -X ${VERSION_PKG}.Name=Client -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" \
-tags integration,integration_api,integration_cli,integration_k8s \
./internal/integration
FROM scratch AS integration-test-darwin
COPY --from=integration-test-darwin-build /src/integration.test /integration-test-darwin-amd64
# The lint target performs linting on the source code.

View File

@ -6,11 +6,12 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
REGISTRY_AND_USERNAME := $(REGISTRY)/$(USERNAME)
ARTIFACTS := _out
IMAGES := $(ARTIFACTS)/images
TOOLS ?= autonomy/tools:8fdb32d
GO_VERSION ?= 1.13
OPERATING_SYSTEM := $(shell uname -s | tr "[:upper:]" "[:lower:]")
OSCTL_DEFAULT_TARGET := osctl-$(OPERATING_SYSTEM)
OSCTL_COMMAND := $(ARTIFACTS)/osctl-$(OPERATING_SYSTEM)-amd64
INTEGRATION_TEST_DEFAULT_TARGET := integration-test-$(OPERATING_SYSTEM)
TESTPKGS ?= ./...
BUILD := docker buildx build
@ -25,10 +26,10 @@ COMMON_ARGS += --build-arg=TOOLS=$(TOOLS)
COMMON_ARGS += --build-arg=SHA=$(SHA)
COMMON_ARGS += --build-arg=TAG=$(TAG)
COMMON_ARGS += --build-arg=GO_VERSION=$(GO_VERSION)
COMMON_ARGS += --build-arg=IMAGES=$(ARTIFACTS)/images
COMMON_ARGS += --build-arg=IMAGES=$(IMAGES)
COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS)
all: help
all: initramfs kernel installer osctl talos
# Help Menu
@ -103,22 +104,22 @@ docs: ## Generates the documentation for machine config, and osctl.
# Apps
apid: ## Builds the apid container image. The build result will be output to the specified local destination.
@$(MAKE) docker-$@ DEST=./$(ARTIFACTS)/images
@$(MAKE) docker-$@ DEST=./$(IMAGES)
machined: ## Builds machined. The build result will only remain in the build cache.
@$(MAKE) target-$@
networkd: ## Builds the networkd container image. The build result will be output to the specified local destination.
@$(MAKE) docker-$@ DEST=./$(ARTIFACTS)/images
@$(MAKE) docker-$@ DEST=./$(IMAGES)
ntpd: ## Builds the ntpd container image. The build result will be output to the specified local destination.
@$(MAKE) docker-$@ DEST=./$(ARTIFACTS)/images
@$(MAKE) docker-$@ DEST=./$(IMAGES)
osd: ## Builds the osd container image. The build result will be output to the specified local destination.
@$(MAKE) docker-$@ DEST=./$(ARTIFACTS)/images
@$(MAKE) docker-$@ DEST=./$(IMAGES)
trustd: ## Builds the trustd container image. The build result will be output to the specified local destination.
@$(MAKE) docker-$@ DEST=./$(ARTIFACTS)/images
@$(MAKE) docker-$@ DEST=./$(IMAGES)
apps: apid machined networkd ntpd osd trustd ## Builds all apps (apid, machined, networkd, ntpd, osd, and trustd).
@ -130,16 +131,16 @@ kernel: ## Outputs the kernel package contents (vmlinuz, and vmlinux) to the art
@-rm -rf $(ARTIFACTS)/modules
.PHONY: initramfs
initramfs: ## Builds the compressed initramfs and outputs it to the artifact directory.
initramfs: apps ## Builds the compressed initramfs and outputs it to the artifact directory.
@$(MAKE) local-$@ DEST=$(ARTIFACTS)
.PHONY: installer
installer: ## Builds the container image for the installer and outputs it to the artifact directory.
installer: apps ## Builds the container image for the installer and outputs it to the artifact directory.
@$(MAKE) docker-$@ DEST=$(ARTIFACTS)
@docker load < $(ARTIFACTS)/$@.tar
.PHONY: talos
talos: ## Builds the Talos container image and outputs it to the artifact directory.
talos: apps ## Builds the Talos container image and outputs it to the artifact directory.
@$(MAKE) docker-$@ DEST=$(ARTIFACTS)
@mv $(ARTIFACTS)/$@.tar $(ARTIFACTS)/container.tar
@docker load < $(ARTIFACTS)/container.tar
@ -180,12 +181,13 @@ unit-tests: apps ## Performs unit tests.
unit-tests-race: ## Performs unit tests with race detection enabled.
@$(MAKE) local-$@ DEST=./
.PHONY: integration-test
integration-test: ## Runs the CLI and API integration tests against a running cluster.
@$(MAKE) local-$@ DEST=./bin
integration-test-%:
@$(MAKE) local-$@ DEST=$(ARTIFACTS)
integration-test: $(INTEGRATION_TEST_DEFAULT_TARGET) ## Builds the integration-test binary for the local machine.
.PHONY: basic-integration
basic-integration: ## Runs the basic integration test.
basic-integration: integration-test osctl talos ## Runs the basic integration test.
@$(MAKE) hack-test-$@
.PHONY: e2e-integration

View File

@ -179,11 +179,9 @@ local apid = Step("apid", depends_on=[setup_ci]);
local osctl_linux = Step("osctl-linux", depends_on=[setup_ci]);
local osctl_darwin = Step("osctl-darwin", depends_on=[setup_ci]);
local docs = Step("docs", depends_on=[osctl_linux]);
local integration_test = Step("integration-test", depends_on=[setup_ci]);
local rootfs = Step("rootfs", target="target-rootfs", depends_on=[machined, osd, trustd, ntpd, networkd, apid]);
local initramfs = Step("initramfs", depends_on=[rootfs]);
local installer = Step("installer", depends_on=[rootfs]);
local talos = Step("talos", depends_on=[rootfs]);
local initramfs = Step("initramfs", depends_on=[apid, machined, networkd, ntpd, osd, trustd]);
local installer = Step("installer", depends_on=[initramfs]);
local talos = Step("talos", depends_on=[installer]);
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]);
@ -192,9 +190,9 @@ 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 unit_tests = Step("unit-tests", depends_on=[rootfs, talos]);
local unit_tests = Step("unit-tests", depends_on=[talos]);
local unit_tests_race = Step("unit-tests-race", depends_on=[golint]);
local basic_integration = Step("basic-integration", depends_on=[unit_tests, talos, osctl_linux, integration_test]);
local basic_integration = Step("basic-integration", depends_on=[unit_tests, talos, osctl_linux]);
local coverage = {
name: 'coverage',
@ -263,8 +261,6 @@ local default_steps = [
osctl_linux,
osctl_darwin,
docs,
integration_test,
rootfs,
initramfs,
installer,
talos,

View File

@ -2,11 +2,9 @@
set -eou pipefail
TALOS_IMG="docker.io/autonomy/talos:${TAG}"
OSCTL="${PWD}/${ARTIFACTS}/osctl-linux-amd64"
INTEGRATIONTEST="${PWD}/bin/integration-test"
TMP="/tmp/e2e"
TALOS_IMG="docker.io/autonomy/talos:${TAG}"
export TALOSCONFIG="${TMP}/talosconfig"
case "${CI:-false}" in
@ -20,10 +18,12 @@ esac
case $(uname -s) in
Linux*)
LOCALOSCTL="${PWD}/${ARTIFACTS}/osctl-linux-amd64"
OSCTL="${PWD}/${ARTIFACTS}/osctl-linux-amd64"
INTEGRATION_TEST="${PWD}/${ARTIFACTS}/integration-test-linux-amd64"
;;
Darwin*)
LOCALOSCTL="${PWD}/${ARTIFACTS}/osctl-darwin-amd64"
OSCTL="${PWD}/${ARTIFACTS}/osctl-darwin-amd64"
INTEGRATION_TEST="${PWD}/${ARTIFACTS}/integration-test-darwin-amd64"
;;
*)
exit 1
@ -32,6 +32,8 @@ esac
mkdir -p "${TMP}"
${LOCALOSCTL} cluster create --name integration --image ${TALOS_IMG} --masters=3 --mtu 1440 --cpus 4.0 --wait --endpoint "${ENDPOINT}"
"${OSCTL}" cluster create --name basic-integration --image "${TALOS_IMG}" --masters=3 --mtu 1440 --cpus 4.0 --wait --endpoint "${ENDPOINT}"
"${INTEGRATIONTEST}" -test.v -talos.osctlpath "${LOCALOSCTL}" -talos.k8sendpoint "${ENDPOINT}:6443"
trap "${OSCTL} cluster destroy --name basic-integration" EXIT
"${INTEGRATION_TEST}" -test.v -talos.osctlpath "${OSCTL}" -talos.k8sendpoint "${ENDPOINT}:6443"