| | |
| | | run_once: true |
| | | vars: |
| | | project_name: coolstore-image-builds |
| | | github_account: jbossdemocentral |
| | | github_ref: ocp-3.7 |
| | | maven_mirror_url: https://mirror.openshift.com/nexus/content/groups/public/ |
| | | pipeline_template: https://raw.githubusercontent.com/{{ github_account }}/coolstore-microservice/{{ github_ref }}/openshift/templates/imagebuild-pipeline-template.yaml |
| | | tasks: |
| | | - include_role: |
| | |
| | | vars: |
| | | set_hostname_suffix: false |
| | | |
| | | - name: check if {{ project_name }} exists |
| | | - name: check if image builder project exists |
| | | shell: "{{ openshift_cli }} get project {{ project_name }}" |
| | | register: result |
| | | ignore_errors: true |
| | | changed_when: false |
| | | |
| | | - name: create project {{ project_name }} |
| | | - name: create image builder project {{ project_name }} |
| | | shell: "{{ openshift_cli }} new-project {{ project_name }} --description='DO NOT REMOVE THIS PROJECT. NEEDED FOR COOLSTORE DEMO'" |
| | | ignore_errors: true |
| | | |
| | | - name: check if image builder project exists |
| | | shell: "{{ openshift_cli }} get project -n {{ project_name }}" |
| | | register: result |
| | | ignore_errors: true |
| | | changed_when: false |
| | | |
| | | - name: create image builder project {{ project_name }} |
| | | shell: "{{ openshift_cli }} new-project {{ project_name }} --description='{{ project_desc }}'" |
| | | ignore_errors: true |
| | | when: result|failed |
| | | |
| | | - import_role: |
| | | name: openshift_jenkins |
| | | vars: |
| | | project_name: "{{ project_name }}" |
| | | jenkins_image_tag: "v3.7" |
| | | jenkins_image_force_import: "true" |
| | | jenkins_max_cpu: 2 |
| | | |
| | | - name: create coolstore image build pipeline |
| | | shell: "{{ openshift_cli }} process -f {{ pipeline_template }} --param=GITHUB_ACCOUNT={{ github_account }} --param=GITHUB_REF={{ github_ref }} --param=MAVEN_MIRROR_URL={{ maven_mirror_url }} -n {{ project_name }} | {{ openshift_cli }} create -f - -n {{ project_name }}" |
| | | ignore_errors: true |