apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: noggin
  labels:
    app: {{ app }}
    build: noggin
spec:
  runPolicy: Serial
  source:
    type: Git
    git:
      uri: https://github.com/fedora-infra/noggin.git
{% if env == "staging" %}
      ref: staging
{% else %}
      ref: stable
{% endif %}
    contextDir: /
  strategy:
    type: Source
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: python:3.9-ubi8
        namespace: openshift
  output:
    to:
      kind: ImageStreamTag
      name: noggin:latest
  triggers:
  - type: ConfigChange
  - type: ImageChange
{% if noggin_stg_github_secret is defined and env == 'staging' %}
  - type: GitHub
    github:
      secret: "{{ noggin_stg_github_secret }}"
{% endif %}
{% if noggin_github_secret is defined and env == 'production' %}
  # Do we really want auto rebuilds in prod?
  # - type: GitHub
  #   github:
  #     secret: "{{ noggin_github_secret }}"
{% endif %}
