{% macro load_file(filename) %}{% include filename %}{%- endmacro -%}
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: fasjson
  labels:
    app: fasjson
    build: fasjson
spec:
  runPolicy: Serial
  source:
    type: Git
    git:
      uri: https://github.com/fedora-infra/fasjson.git
      ref: {{ (env == 'production')|ternary('stable', 'staging') }}
  strategy:
    type: Docker
  output:
    to:
      kind: ImageStreamTag
      name: fasjson:latest
  triggers:
  - type: ConfigChange
  - type: ImageChange
{% if fasjson_stg_github_secret is defined and env == 'staging' %}
  - type: GitHub
    github:
      secret: "{{ fasjson_stg_github_secret }}"
{% elif fasjson_github_secret is defined and env == 'production' %}
  - type: GitHub
    github:
      secret: "{{ fasjson_github_secret }}"
{% endif %}
