apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: websites-build
  labels:
    environment: "websites"
spec:
  runPolicy: SerialLatestOnly
  failedBuildsHistoryLimit: 2
  successfulBuildsHistoryLimit: 1
  source:
    git:
      uri: "https://gitlab.com/fedora/websites-apps/fedora-websites/fedora-websites-3.0.git"
{% if env == 'staging' %}
      ref: staging
{% else %}
      ref: main
{% endif %}
  strategy:
    type: Docker
    dockerStrategy:
      dockerfilePath: .build/Dockerfile
  output:
    to:
      kind: ImageStreamTag
      name: builder:latest
  triggers:
{% if websites_github_secret is defined %}
  - type: Generic
    generic:
      secret: "{{ websites_github_secret }}"
{% endif %}
  - type: ConfigChange
  - type: ImageChange
