# Declare a Backstage Component that represents your application.
---
# yaml-language-server: $schema=https://json.schemastore.org/catalog-info.json
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: fleet-server
  description: fleet-server - The control server for managing a fleet of elastic-agents
  annotations:
    sonarqube.org/project-key: elastic_fleet-server_AYpL8BsVaV3I-igkX4hx
    gitops.elastic.co/service-name: fleet
    pagerduty.com/service-id: PW0VP7P

spec:
  type: tool
  owner: group:ingest-fp
  system: platform-ingest
  lifecycle: production
  dependsOn:
    - "component:package-registry"
    - "resource:buildkite-pipeline-release-package-registry-distribution"


---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: buildkite-pipeline-fleet-server
  description: Buildkite pipeline for the Elastic Fleet Server project
  links:
    - title: Pipeline
      url: https://buildkite.com/elastic/fleet-server

spec:
  type: buildkite-pipeline
  owner: group:ingest-fp
  system: buildkite
  implementation:
    apiVersion: buildkite.elastic.dev/v1
    kind: Pipeline
    metadata:
      name: fleet-server
      description: Buildkite pipeline for the Elastic Fleet Server project
    spec:
      repository: elastic/fleet-server
      pipeline_file: ".buildkite/pipeline.yml"
      # patterns for tags are required to trigger the step that publishes the docker.elastic.co/package-registry/distribution images
      # step with key: "release-package-registry"
      branch_configuration: "main 9.* 8.* 7.* v9.* v8.* v7.*"
      provider_settings:
        build_pull_request_forks: false
        build_pull_requests: true # requires filter_enabled and filter_condition settings as below when used with buildkite-pr-bot
        build_tags: true
        filter_enabled: true
        # filter condition to ensure that builds triggered are created from branch (build.pull_request.id= null)
        # or if they are created from pull requests, just the build from the user `elasticmachine` is triggered.
        # this user is the one used by the buildkite-pr-bot
        filter_condition: >-
          build.pull_request.id == null || (build.creator.name == 'elasticmachine' && build.pull_request.id != null)
      env:
        ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
        SLACK_NOTIFICATIONS_CHANNEL: '#fleet-notifications'
        SLACK_NOTIFICATIONS_ALL_BRANCHES: 'false'
        SLACK_NOTIFICATIONS_ON_SUCCESS: 'false'
      teams:
        ingest-fp:
          access_level: MANAGE_BUILD_AND_READ
        observablt-ci:
          access_level: MANAGE_BUILD_AND_READ
        everyone:
          access_level: READ_ONLY

---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: buildkite-pipeline-fleet-server-package-mbp
  description: Buildkite pipeline for the Elastic Fleet Server package process
  links:
    - title: Pipeline
      url: https://buildkite.com/elastic/fleet-server-package-mbp

spec:
  type: buildkite-pipeline
  owner: group:ingest-fp
  system: buildkite
  implementation:
    apiVersion: buildkite.elastic.dev/v1
    kind: Pipeline
    metadata:
      name: fleet-server-package-mbp
      description: Buildkite pipeline for the Elastic Fleet Server package process
    spec:
      repository: elastic/fleet-server
      pipeline_file: ".buildkite/pipeline.package.mbp.yml"
      provider_settings:
        build_pull_request_forks: false
        build_pull_requests: true
        build_tags: false
        build_branches: false
        filter_enabled: true
        # filter condition to ensure that builds triggered are created from branch (build.pull_request.id= null)
        # or if they are created from pull requests, just the build from the user `elasticmachine` is triggered.
        # this user is the one used by the buildkite-pr-bot
        filter_condition: >-
          build.pull_request.id == null || (build.creator.name == 'elasticmachine' && build.pull_request.id != null)
      env:
        ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
        SLACK_NOTIFICATIONS_CHANNEL: '#fleet-notifications'
        SLACK_NOTIFICATIONS_ALL_BRANCHES: 'false'
        SLACK_NOTIFICATIONS_ON_SUCCESS: 'false'
      cancel_intermediate_builds: true
      cancel_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
      skip_intermediate_builds: true
      skip_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
      teams:
        ingest-fp:
          access_level: MANAGE_BUILD_AND_READ
        observablt-ci:
          access_level: MANAGE_BUILD_AND_READ
        everyone:
          access_level: READ_ONLY
      schedules:
        Weekly 7.17:
          branch: "7.17"
          cronline: "@weekly"
          message: Builds `7.17` DRA
---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: fleet-server-tests
  description: Pipeline tests the service integration in a specific environment
  links:
    - title: Pipeline
      url: https://buildkite.com/elastic/fleet-server-tests
spec:
  type: buildkite-pipeline
  owner: group:fleet
  system: buildkite
  implementation:
    apiVersion: buildkite.elastic.dev/v1
    kind: Pipeline
    metadata:
      name: fleet-server-tests
      description: fleet-server environment tests
    spec:
      repository: elastic/fleet-server
      pipeline_file: .buildkite/pipeline.fleet-server-tests.yaml
      branch_configuration: "main"
      skip_intermediate_builds: false
      provider_settings:
        build_pull_requests: false
        trigger_mode: none
      teams:
        ingest-fp:
          access_level: MANAGE_BUILD_AND_READ
        cloud-tooling:
          access_level: MANAGE_BUILD_AND_READ
        observablt-ci:
          access_level: MANAGE_BUILD_AND_READ
        everyone:
          access_level: READ_ONLY
---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: fleet-server-perf-tests
  description: Pipeline tests for serverless scale testing a PR
  links:
    - title: Pipeline
      url: https://buildkite.com/elastic/fleet-server-perf-tests
spec:
  type: buildkite-pipeline
  owner: group:ingest-fp
  system: buildkite
  implementation:
    apiVersion: buildkite.elastic.dev/v1
    kind: Pipeline
    metadata:
      name: fleet-server-perf-tests
      description: fleet-server observability-perf tests
    spec:
      repository: elastic/fleet-server
      pipeline_file: .buildkite/pipeline.perf-tests.yaml
      branch_configuration: "main"
      provider_settings:
        build_pull_request_forks: false
        build_pull_requests: true
        build_tags: false
        build_branches: false
        filter_enabled: true
        # filter condition to ensure that builds triggered are created from branch (build.pull_request.id= null)
        # or if they are created from pull requests, just the build from the user `elasticmachine` is triggered.
        # this user is the one used by the buildkite-pr-bot
        filter_condition: >-
          build.pull_request.id == null || (build.creator.name == 'elasticmachine' && build.pull_request.id != null)
      cancel_intermediate_builds: true
      cancel_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
      skip_intermediate_builds: true
      skip_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
      teams:
        ingest-fp:
          access_level: MANAGE_BUILD_AND_READ
        cloud-tooling:
          access_level: MANAGE_BUILD_AND_READ
        observablt-ci:
          access_level: MANAGE_BUILD_AND_READ
        everyone:
          access_level: READ_ONLY
