From f5e7df370d968bda6c78f73ef3875b4f2e2c3409 Mon Sep 17 00:00:00 2001 From: Alex Tercete Date: Tue, 17 Dec 2024 09:43:29 +0000 Subject: [PATCH 1/4] ci(e2e): create test suite --- e2e/BUILD.bazel | 4 ++++ e2e/localhost/BUILD.bazel | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 e2e/BUILD.bazel diff --git a/e2e/BUILD.bazel b/e2e/BUILD.bazel new file mode 100644 index 00000000..d3242e79 --- /dev/null +++ b/e2e/BUILD.bazel @@ -0,0 +1,4 @@ +test_suite( + name = "ci", + tests = ["//localhost"], +) diff --git a/e2e/localhost/BUILD.bazel b/e2e/localhost/BUILD.bazel index 51fad29e..05b48f0a 100644 --- a/e2e/localhost/BUILD.bazel +++ b/e2e/localhost/BUILD.bazel @@ -129,3 +129,7 @@ labgrid_test( src = ":inner", platform = "@rules_labgrid//labgrid/platform:localhost", ) + +test_suite( + name = "localhost", +) -- GitLab From b6d1f9368cd31fcaec4fb152e2ef7cbed05b7466 Mon Sep 17 00:00:00 2001 From: Alex Tercete Date: Thu, 19 Dec 2024 12:08:11 +0000 Subject: [PATCH 2/4] ci: update `bazelisk` --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0c7d51f..8a81640f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ include: - - component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@v1.0.1" + - component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@v1.1.0" inputs: needs: - oci -- GitLab From 624a7e2242f7beeb94d6cce8cf28b7824dd7d89d Mon Sep 17 00:00:00 2001 From: Alex Tercete Date: Tue, 17 Dec 2024 16:05:27 +0000 Subject: [PATCH 3/4] ci(e2e): run test suite on MRs This will shorten the feedback loop for MRs while they're in development. But we still run all the tests on `main` and for merge train pipelines. --- .gitlab-ci.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a81640f..16063f88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,8 @@ include: - component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@v1.1.0" inputs: + extends: + - .base needs: - oci - format-check @@ -18,6 +20,18 @@ default: tags: - arm64 +.base: + extends: .job + variables: + TARGET: "//..." + rules: + - if: $ROOT == "e2e" && $CI_MERGE_REQUEST_IID + variables: + TARGET: "//:ci" + - !reference [.bazelisk, rules] + script: + - cd "${ROOT}"; bazelisk test --config="${CONFIG}" ${TARGET} + oci: stage: .pre image: docker:27.3.0 @@ -35,14 +49,14 @@ oci: - docker info - echo "$CI_REGISTRY_PASSWORD" | docker login --username "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" - docker buildx build --tag="$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" --push --cache-from "type=registry,ref=$CI_REGISTRY_IMAGE:$CI_COMMIT_BEFORE_SHA" --build-arg BUILDKIT_INLINE_CACHE=1 . - rules: !reference [.bazelisk, rules] + rules: !reference [.base, rules] format-check: stage: .pre image: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}" tags: - dind - extends: .job + extends: .base needs: - oci script: @@ -53,7 +67,7 @@ pages: stage: deploy tags: - dind - extends: .job + extends: .base needs: - oci script: -- GitLab From d4377079334c1a32d014b9dea6e0dca917caba19 Mon Sep 17 00:00:00 2001 From: Alex Tercete Date: Thu, 19 Dec 2024 20:48:04 +0000 Subject: [PATCH 4/4] ci: use K8s runners by default Now that we can customise the base job, we can assign the bare metal runners only where needed. --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 16063f88..f70dca77 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,9 +19,15 @@ include: default: tags: - arm64 + - linux + - dind .base: extends: .job + tags: + - arm64 + - linux + - metal variables: TARGET: "//..." rules: @@ -35,8 +41,6 @@ default: oci: stage: .pre image: docker:27.3.0 - tags: - - dind services: - docker:27.3.0-dind variables: @@ -54,8 +58,6 @@ oci: format-check: stage: .pre image: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}" - tags: - - dind extends: .base needs: - oci @@ -65,8 +67,6 @@ format-check: pages: stage: deploy - tags: - - dind extends: .base needs: - oci -- GitLab