# ***********************************
# SECTION START: Backstage logstash-filter-elastic-integration component
# ***********************************

---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: logstash-filter-elastic-integration
  description: A plugin that can be used in a Logstash pipeline to perform the transformations that are applied by many [Elastic Integrations](https://www.elastic.co/integrations/data-integrations) before sending the events to Elasticsearch.
  annotations:
    backstage.io/source-location: url:https://github.com/elastic/logstash-filter-elastic_integration/
    github.com/project-slug: elastic/logstash-filter-elastic_integration/
    github.com/team-slug: elastic/logstash
    buildkite.com/project-slug: elastic/logstash
  tags:
    - logstash
    - filter
    - elastic-integration
  links:
    - title: Logstash filter for Elastic integration
      url: https://github.com/elastic/logstash-filter-elastic_integration
spec:
  type: tool
  owner: group:logstash
  system: platform-ingest
  lifecycle: production

# ***********************************
# SECTION START: Pull Request pipeline
# ***********************************

---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: logstash-filter-elastic-integration-pull-request
  description: 'A pipeline for Logstash filter for Elastic integration Pull Requests'
  links:
    - title: 'Logstash filter for Elastic integration Pull Request pipeline'
      url: https://buildkite.com/elastic/logstash-filter-elastic-integration-pull-request
spec:
  owner: group:logstash
  type: buildkite-pipeline
  system: platform-ingest
  implementation:
    apiVersion: buildkite.elastic.dev/v1
    kind: Pipeline
    metadata:
      description: ':logstash: Build and test `elastic_integration` pull request :pipeline:'
      name: logstash-filter-elastic-integration-pull-request
    spec:
      pipeline_file: .buildkite/pull-request-pipeline.yml
      maximum_timeout_in_minutes: 120
      repository: elastic/logstash-filter-elastic_integration
      provider_settings:
        build_pull_requests: true
        build_pull_request_forks: false
        build_branches: false
        build_tags: false
        filter_enabled: true
        filter_condition: >-
          build.creator.name == 'elasticmachine' && build.pull_request.id != null
      cancel_intermediate_builds: true
      skip_intermediate_builds: true
      env:
        ELASTIC_PR_COMMENTS_ENABLED: 'true'
      teams:
        logstash:
          access_level: MANAGE_BUILD_AND_READ
        ingest-fp:
          access_level: MANAGE_BUILD_AND_READ
        ingest-eng-prod:
          access_level: MANAGE_BUILD_AND_READ
        everyone:
          access_level: READ_ONLY


# ***********************************
# SECTION START: Plugin Build against Elasticsearch versions pipeline
# ***********************************

---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: logstash-filter-elastic-integration-build
  description: 'A pipeline for Logstash filter for Elastic integration build against Elasticsearch versions'
  links:
    - title: 'Logstash filter for Elastic integration build against Elasticsearch versions pipeline'
      url: https://buildkite.com/elastic/logstash-filter-elastic-integration-build
spec:
  owner: group:logstash
  type: buildkite-pipeline
  system: platform-ingest
  implementation:
    apiVersion: buildkite.elastic.dev/v1
    kind: Pipeline
    metadata:
      description: ':logstash: Build `elastic_integration` with Elasticsearch :pipeline:'
      name: logstash-filter-elastic-integration-build
    spec:
      pipeline_file: .buildkite/build-pipeline.yml
      maximum_timeout_in_minutes: 120
      provider_settings:
        trigger_mode: none
      repository: elastic/logstash-filter-elastic_integration
      env:
        ELASTIC_PR_COMMENTS_ENABLED: 'true'
        ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
        SLACK_NOTIFICATIONS_CHANNEL: '#logstash-build'
        SLACK_NOTIFICATIONS_ON_SUCCESS: 'false'
      schedules:
        Daily Plugin Build:
          branch: main
          cronline: "@daily"
          message: "Run plugin build every day."
      teams:
        logstash:
          access_level: MANAGE_BUILD_AND_READ
        ingest-fp:
          access_level: MANAGE_BUILD_AND_READ
        ingest-eng-prod:
          access_level: MANAGE_BUILD_AND_READ
        everyone:
          access_level: READ_ONLY

# ***********************************
# SECTION START: E2E tests pipeline
# ***********************************
---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: logstash-filter-elastic-integration-e2e
  description: 'A pipeline for `elastic_integration` E2E tests.'
  links:
    - title: 'A pipeline for `elastic_integration` E2E tests.'
      url: https://buildkite.com/elastic/logstash-filter-elastic-integration-e2e
spec:
  owner: group:logstash
  type: buildkite-pipeline
  system: platform-ingest
  implementation:
    apiVersion: buildkite.elastic.dev/v1
    kind: Pipeline
    metadata:
      description: ':logstash: `elastic_integration` E2E tests. :pipeline:'
      name: logstash-filter-elastic-integration-e2e
    spec:
      pipeline_file: .buildkite/e2e-pipeline.yml
      maximum_timeout_in_minutes: 120
      provider_settings:
        trigger_mode: none
      repository: elastic/logstash-filter-elastic_integration
      env:
        ELASTIC_PR_COMMENTS_ENABLED: 'true'
        ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
        SLACK_NOTIFICATIONS_CHANNEL: '#logstash-build'
        SLACK_NOTIFICATIONS_ON_SUCCESS: 'false'
      schedules:
        Weekly E2E Run:
          branch: main
          cronline: "@weekly"
          message: "Run plugin E2E tests weekly."
      teams:
        logstash:
          access_level: MANAGE_BUILD_AND_READ
        ingest-fp:
          access_level: MANAGE_BUILD_AND_READ
        ingest-eng-prod:
          access_level: MANAGE_BUILD_AND_READ
        everyone:
          access_level: READ_ONLY
