---
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: coreos-koji-tagger-build
  labels:
    build: coreos-koji-tagger
spec:
  source:
    type: Git
    contextDir: coreos-koji-tagger
    git:
{% if env == "staging" %}
      ref: fedora-infra-staging
      uri: https://github.com/coreos/fedora-coreos-releng-automation.git
{% else %}
      ref: main
      uri: https://github.com/coreos/fedora-coreos-releng-automation.git
{% endif %}
  strategy:
    type: Docker
    dockerStrategy:
      from:
        kind: ImageStreamTag
        name: fedora:38
  output:
    to:
      kind: ImageStreamTag
      name: coreos-koji-tagger-img:latest
  triggers:
    - type: ImageChange
      imageChange: {}
    - type: ConfigChange
{% if env == "staging" and coreos_koji_tagger_webhook_secret_stg is defined %}
    - type: GitHub
      github:
        secret: "{{ coreos_koji_tagger_webhook_secret_stg }}"
{% elif coreos_koji_tagger_webhook_secret_prod is defined %}
    - type: GitHub
      github:
        secret: "{{ coreos_koji_tagger_webhook_secret_prod }}"
{% endif %}
