SF initial configurator | a26c41e | 2022-10-06 13:33:13 +0300 | [diff] [blame] | 1 | # This file is managed by ansible, do not edit directly |
| 2 | --- |
| 3 | - name: prepare dumb bare clone of future state |
| 4 | git: |
| 5 | repo: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}" |
| 6 | dest: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}.git" |
| 7 | bare: yes |
| 8 | |
| 9 | - name: update server info for dumb http transport |
| 10 | command: git update-server-info |
| 11 | args: |
| 12 | chdir: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}.git" |
| 13 | |
| 14 | - name: create project dir on http server |
| 15 | command: > |
| 16 | {{ oc_command }} exec {{ zm_name }} -- mkdir -p {{ zuul.project.src_dir }}.git |
| 17 | |
| 18 | - name: copy project to http server |
| 19 | command: > |
| 20 | {{ oc_command }} rsync -q --progress=false |
| 21 | {{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}.git/ |
| 22 | {{ zm_name }}:/opt/app-root/src/{{ zuul.project.src_dir }}.git/ |
| 23 | no_log: true |
| 24 | |
| 25 | - name: create project ImageStream spec |
| 26 | openshift_raw: |
| 27 | state: present |
| 28 | namespace: "{{ zuul.resources['project'].namespace }}" |
| 29 | context: "{{ zuul.resources['project'].context }}" |
| 30 | definition: |
| 31 | apiVersion: v1 |
| 32 | kind: ImageStream |
| 33 | metadata: |
| 34 | generation: 1 |
| 35 | labels: |
| 36 | app: "{{ zuul.project.short_name }}" |
| 37 | name: "{{ zuul.project.short_name }}" |
| 38 | spec: |
| 39 | lookupPolicy: |
| 40 | local: false |
| 41 | register: _image_stream |
| 42 | |
| 43 | - name: create project BuildConfig spec |
| 44 | openshift_raw: |
| 45 | state: present |
| 46 | namespace: "{{ zuul.resources['project'].namespace }}" |
| 47 | context: "{{ zuul.resources['project'].context }}" |
| 48 | definition: |
| 49 | apiVersion: v1 |
| 50 | kind: BuildConfig |
| 51 | metadata: |
| 52 | labels: |
| 53 | app: "{{ zuul.project.short_name }}" |
| 54 | name: "{{ zuul.project.short_name }}" |
| 55 | spec: |
| 56 | output: |
| 57 | to: |
| 58 | kind: ImageStreamTag |
| 59 | name: '{{ zuul.project.short_name }}:latest' |
| 60 | runPolicy: Serial |
| 61 | source: |
| 62 | git: |
| 63 | ref: master |
| 64 | uri: 'http://staging-http-server:8080/{{ zuul.project.src_dir }}.git' |
| 65 | type: Git |
| 66 | strategy: |
| 67 | sourceStrategy: |
| 68 | from: |
| 69 | kind: ImageStreamTag |
| 70 | name: '{{ base_image }}' |
| 71 | namespace: openshift |
| 72 | type: Source |
| 73 | triggers: |
| 74 | - type: ImageChange |
| 75 | - type: ConfigChange |
| 76 | |
| 77 | - name: wait for project image built |
| 78 | command: > |
| 79 | {{ oc_command }} get builds |
| 80 | -o "jsonpath={.items[?(@.metadata.labels.buildconfig!='staging-http-server')].status.phase}" |
| 81 | register: _project_build |
| 82 | retries: 600 |
| 83 | delay: 1 |
| 84 | until: "'Complete' in _project_build.stdout" |