diff --git a/.buildkite/pipeline-resource-definitions/kibana-package-registry.yml b/.buildkite/pipeline-resource-definitions/kibana-package-registry.yml index 392a511e22281..0efa8f2cfe803 100644 --- a/.buildkite/pipeline-resource-definitions/kibana-package-registry.yml +++ b/.buildkite/pipeline-resource-definitions/kibana-package-registry.yml @@ -2,10 +2,10 @@ apiVersion: backstage.io/v1alpha1 kind: Resource metadata: - name: bk-kibana-package-registry-promote + name: bk-kibana-package-registry-verify-and-promote description: Promote package-registry/distribution:lite links: - - url: 'https://buildkite.com/elastic/kibana-package-registry-promote' + - url: 'https://buildkite.com/elastic/kibana-package-registry-verify-and-promote' title: Pipeline link spec: type: buildkite-pipeline @@ -15,18 +15,21 @@ spec: apiVersion: buildkite.elastic.dev/v1 kind: Pipeline metadata: - name: kibana / package registry promote - description: Promote package-registry/distribution:lite + name: kibana / package registry verify and promote + description: Verify and promote docker.elastic.co/package-registry/distribution:lite spec: env: SLACK_NOTIFICATIONS_CHANNEL: "#kibana-operations-alerts" - ELASTIC_SLACK_NOTIFICATIONS_ENABLED: "false" + ELASTIC_SLACK_NOTIFICATIONS_ENABLED: "true" repository: elastic/kibana branch_configuration: main default_branch: main pipeline_file: ".buildkite/pipelines/fleet/package_registry.yml" provider_settings: trigger_mode: none + schedules: + Daily promotion: + cronline: 0 22 * * * America/New_York teams: everyone: access_level: BUILD_AND_READ diff --git a/.buildkite/pipelines/fleet/package_registry.yml b/.buildkite/pipelines/fleet/package_registry.yml index 52fc4f910713a..252082f31a98f 100644 --- a/.buildkite/pipelines/fleet/package_registry.yml +++ b/.buildkite/pipelines/fleet/package_registry.yml @@ -1,2 +1,70 @@ +env: + IGNORE_SHIP_CI_STATS_ERROR: 'true' steps: - - command: echo "Placeholder" + - command: .buildkite/scripts/lifecycle/pre_build.sh + label: Pre-Build + timeout_in_minutes: 10 + agents: + image: family/kibana-ubuntu-2004 + imageProject: elastic-images-prod + provider: gcp + machineType: n2-standard-2 + + - wait + + - command: .buildkite/scripts/steps/build_kibana.sh + label: Build Kibana Distribution + agents: + image: family/kibana-ubuntu-2004 + imageProject: elastic-images-prod + provider: gcp + machineType: n2-standard-8 + preemptible: true + key: build + if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" + timeout_in_minutes: 60 + retry: + automatic: + - exit_status: '-1' + limit: 3 + + - command: .buildkite/scripts/steps/test/pick_test_group_run_order.sh + label: 'Pick Test Group Run Order' + agents: + image: family/kibana-ubuntu-2004 + imageProject: elastic-images-prod + provider: gcp + machineType: n2-standard-2 + timeout_in_minutes: 10 + env: + JEST_UNIT_SCRIPT: '.buildkite/scripts/steps/test/jest.sh' + JEST_INTEGRATION_SCRIPT: '.buildkite/scripts/steps/test/jest_integration.sh' + FTR_CONFIGS_SCRIPT: '.buildkite/scripts/steps/test/ftr_configs.sh' + LIMIT_CONFIG_TYPE: integration,functional + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/fleet/promote_package_registry.sh + label: Promote docker.elastic.co/package-registry/distribution:lite + agents: + image: family/kibana-ubuntu-2004 + imageProject: elastic-images-prod + provider: gcp + machineType: n2-standard-2 + depends_on: + - ftr-configs + - jest-integration + + - wait: ~ + continue_on_failure: true + + - command: .buildkite/scripts/lifecycle/post_build.sh + label: Post-Build + timeout_in_minutes: 10 + agents: + image: family/kibana-ubuntu-2004 + imageProject: elastic-images-prod + provider: gcp + machineType: n2-standard-2 diff --git a/.buildkite/scripts/steps/fleet/promote_package_registry.sh b/.buildkite/scripts/steps/fleet/promote_package_registry.sh new file mode 100755 index 0000000000000..c5906bf774725 --- /dev/null +++ b/.buildkite/scripts/steps/fleet/promote_package_registry.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -euo pipefail + +PACKAGE_REGISTRY_BASE_IMAGE='docker.elastic.co/package-registry/distribution:lite' +PACKAGE_REGISTRY_TARGET_IMAGE='docker.elastic.co/kibana-ci/package-registry-distribution:lite' + +if [[ "$BUILDKITE_BRANCH" == "main" ]]; then + docker buildx imagetools create -t "$PACKAGE_REGISTRY_TARGET_IMAGE" "$PACKAGE_REGISTRY_BASE_IMAGE" + cat << EOF | buildkite-agent pipeline upload +steps: + - label: "Update cache for EPR image" + trigger: kibana-vm-images + async: true + build: + env: + IMAGES_CONFIG="kibana/images.yml" + RETRY="1" +EOF +else + echo "Skipping promotion for untracked branch $BUILDKITE_BRANCH" +fi