apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: flask-oidc-dev
  labels:
    app: flask-oidc-dev
    build: flask-oidc-dev
spec:
  runPolicy: Serial
  source:
    type: Git
    git:
      uri: https://github.com/fedora-infra/test-auth.git
{% if env == "staging" %}
      ref: main
{% else %}
      ref: stable
{% endif %}
    contextDir: /
  strategy:
    type: Source
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: python:3.9-ubi8
        namespace: openshift
  output:
    to:
      kind: ImageStreamTag
      name: flask-oidc-dev:latest
  triggers:
  - type: ConfigChange
  - type: ImageChange
  - type: GitHub
{% if test_auth_stg_github_secret is defined and env == 'staging' %}
    github:
      secret: "{{ test_auth_stg_github_secret }}"
{% elif test_auth_github_secret is defined and env == 'production' %}
    github:
      secret: "{{ test_auth_github_secret }}"
{% endif %}
