From f61e597b5be7985d5b3206fa62a5ea25b3ed9b31 Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Tue, 8 Jan 2019 20:13:20 +0100 Subject: [PATCH] whatcanidoforfedora: use staging/production branch to trigger build in openshift Signed-off-by: Clement Verna --- playbooks/openshift-apps/asknot.yml | 2 +- .../asknot/files/buildconfig.yml | 19 ----------- .../asknot/templates/buildconfig.yml | 33 +++++++++++++++++++ 3 files changed, 34 insertions(+), 20 deletions(-) delete mode 100644 roles/openshift-apps/asknot/files/buildconfig.yml create mode 100644 roles/openshift-apps/asknot/templates/buildconfig.yml diff --git a/playbooks/openshift-apps/asknot.yml b/playbooks/openshift-apps/asknot.yml index 0e6cebc629..f7f86a85a4 100644 --- a/playbooks/openshift-apps/asknot.yml +++ b/playbooks/openshift-apps/asknot.yml @@ -22,7 +22,7 @@ - role: openshift/object app: asknot - file: buildconfig.yml + template: buildconfig.yml objectname: buildconfig.yml - role: openshift/start-build diff --git a/roles/openshift-apps/asknot/files/buildconfig.yml b/roles/openshift-apps/asknot/files/buildconfig.yml deleted file mode 100644 index cd696d9787..0000000000 --- a/roles/openshift-apps/asknot/files/buildconfig.yml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: BuildConfig -metadata: - name: asknot-build - labels: - environment: "asknot" -spec: - source: - git: - uri: https://github.com/fedora-infra/asknot-ng.git - ref: "os-staging" - strategy: - type: Docker - triggers: - - type: ImageChange - output: - to: - kind: ImageStreamTag - name: asknot:latest diff --git a/roles/openshift-apps/asknot/templates/buildconfig.yml b/roles/openshift-apps/asknot/templates/buildconfig.yml new file mode 100644 index 0000000000..62e881a2e2 --- /dev/null +++ b/roles/openshift-apps/asknot/templates/buildconfig.yml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: BuildConfig +metadata: + name: asknot-build + labels: + environment: "asknot" +spec: + source: + git: + uri: https://github.com/fedora-infra/asknot-ng.git +{% if env == 'staging' %} + ref: "staging" +{% else %} + ref: "production" +{% endif %} + strategy: + type: Docker + triggers: +{% if stg_asknot_github_secret is defined and env == 'staging' %} + - type: GitHub + github: + secret: "{{ stg_asknot_github_secret }}" +{% elif asknot_github_secret is defined and env == 'production' %} + - type: GitHub + github: + secret: "{{ asknot_github_secret }}" +{% endif %} + - type: ConfigChange + - type: ImageChange + output: + to: + kind: ImageStreamTag + name: asknot:latest