Skip to content

Commit

Permalink
[ci] Implement package registry promotion pipeline (elastic#199071)
Browse files Browse the repository at this point in the history
This adds a daily build that runs tests again
`docker.elastic.co/package-registry/distribution:lite` and if
successful, promotes the image to
`docker.elastic.co/kibana-ci/package-registry-distribution:lite`.

A follow up pull request will swap integration tests over to use the
promoted image, and add environment overrides to run tests against the
source image in this pipeline.

https://buildkite.com/elastic/kibana-package-registry-promote/builds/2
  • Loading branch information
jbudz authored and cqliu1 committed Jan 2, 2025
1 parent 61aea65 commit cab7971
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
70 changes: 69 additions & 1 deletion .buildkite/pipelines/fleet/package_registry.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions .buildkite/scripts/steps/fleet/promote_package_registry.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cab7971

Please sign in to comment.