File tree Expand file tree Collapse file tree 10 files changed +128
-19
lines changed Expand file tree Collapse file tree 10 files changed +128
-19
lines changed Original file line number Diff line number Diff line change 3
3
# A simple deployment script for OpenShift.
4
4
# It is assumed that your OpenShift Squonk application has been deployed
5
5
# and that you are running this from the Squonk project/namespace
6
- # and have logged in as an appropriate user and have run `source setenv.sh`
6
+ # and have logged in as an appropriate user and have run `source setenv.sh`.
7
+ #
8
+ # You will need to first delete any prior job (or look at the related
9
+ # Ansible playbook/role in this project - which does =things a little better)
7
10
8
11
set -e pipefail
9
12
10
13
oc login -u $OC_ADMIN
11
14
oc project $OC_PROJECT
12
- oc create -f post-service-descriptors.yaml
15
+ oc process -f post-service-descriptors.yaml | oc create -f -
13
16
14
17
echo " Squonk pipelines deployment is underway..."
Original file line number Diff line number Diff line change
1
+ # Squonk Ansible OpenShift Pipelines Deployment
2
+ A simple way to (re)deploy the pipelines to OpenShift: -
3
+
4
+ ansible-playbook playbooks/pipelines/deploy.yaml
5
+
6
+ > Remember to first ` source ` an appropriately crafted
7
+ `setenv.sh` script first! (see below)
8
+
9
+ ## Prerequisites
10
+ Before running the playbook: -
11
+
12
+ 1 . You're on the bastion node
13
+ 1 . You have installed Ansible (any version from 2.5)
14
+ 1 . The ` oc ` command-set is available to you as a user
15
+ 1 . An OpenShift cluster has been installed
16
+ 1 . There is an ` admin ` user known to the cluster
17
+ 1 . You have setup your own ` setenv.sh `
18
+ (typically in Squonk's ` openshift/templates ` )
19
+ and you have run ` source setenv.sh ` using it.
20
+
21
+ ## MiniShift considerations
22
+ While it's a work-in-progress, it should also work on MiniShift.
Original file line number Diff line number Diff line change
1
+ [defaults]
2
+ inventory = inventory
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ oc_admin : " {{ ansible_env.OC_ADMIN }}"
4
+ oc_admin_password : " {{ ansible_env.OC_ADMIN_PASSWORD }}"
5
+ oc_master_hostname : " {{ ansible_env.OC_MASTER_HOSTNAME }}"
6
+ oc_project : " {{ ansible_env.OC_PROJECT }}"
7
+ oc_pipelines_sd_poster_image_tag : " {{ ansible_env.OC_PIPELINES_SD_POSTER_IMAGE_TAG }}"
8
+
9
+ # Various retry timeouts (seconds)...
10
+ pod_ready_timeout : 600
11
+
12
+ # Our template directory
13
+ # (relative to the role_path directory)
14
+ t_dir : ../../../..
Original file line number Diff line number Diff line change
1
+ [localhost]
2
+ 127.0.0.1 ansible_connection=local
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - hosts : localhost
4
+
5
+ roles :
6
+ - pipelines
Original file line number Diff line number Diff line change
1
+ ../../roles/
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ job_name : pipelines-sd-poster
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ # Login and move to the Squonk project
4
+ # and then remove any existing poster job
5
+ # before deploying a new one (and waiting for completion).
6
+
7
+ - name : Login (admin)
8
+ shell : oc login {{ oc_master_hostname }} -u {{ oc_admin }} -p {{ oc_admin_password }}
9
+ changed_when : False
10
+
11
+ - name : Move to Squonk Project
12
+ shell : oc project {{ oc_project }}
13
+ changed_when : False
14
+
15
+ - name : Get jobs
16
+ shell : oc get jobs
17
+ register : jobs_result
18
+ changed_when : False
19
+
20
+ - name : Delete existing SD poster job
21
+ shell : oc delete jobs/{{ job_name }}
22
+ when : jobs_result.stdout | regex_search('^%s' % job_name, multiline=True)
23
+
24
+ - name : Run SD poster job (always)
25
+ shell : >
26
+ oc process
27
+ -f {{ role_path }}/{{ t_dir }}/post-service-descriptors.yaml
28
+ -p POSTER_IMAGE_TAG={{ oc_pipelines_sd_poster_image_tag }}
29
+ | oc create -f -
30
+
31
+ - name : Wait for SD poster success
32
+ shell : oc describe jobs/{{ job_name }} | grep '1 Succeeded' | grep 1
33
+ delay : 10
34
+ retries : " {{ (pod_ready_timeout | int / 10) | int }}"
35
+ register : result
36
+ until : result.rc == 0
37
+ changed_when : False
Original file line number Diff line number Diff line change 2
2
3
3
# The OpenShift Job definition for the Squonk Pipelines SD-Loader image.
4
4
# With Squonk running you can execute this in the Squonk project namespace
5
- # to enable the defined pipelines.
5
+ # to enable the defined pipelines
6
+ # (by using the Ansible playbook 'pipelines/deploy.yaml')
6
7
#
7
- # oc create -f post-service-descriptors.yaml
8
+ # oc process -f post-service-descriptors.yaml | oc create -f -
9
+ # oc delete job --selector template=pipelines-sd-poster
8
10
9
- kind : Job
10
- apiVersion : batch/ v1
11
+ kind : Template
12
+ apiVersion : v1
11
13
metadata :
12
- generateName : pipelines-sd-poster-
13
- spec :
14
- template :
15
- spec :
16
- initContainers :
17
- - image : yauritux/busybox-curl
18
- name : wait-for-core-before-pipelines-post
19
- command : ['sh', '-c',
20
- ' until (( curl http://coreservices:8080/rest/ping --connect-timeout 5 )); do sleep 2; done' ]
21
- containers :
22
- - image : squonk/rdkit-pipelines-sdposter:latest
23
- name : pipelines-sd-poster
24
- restartPolicy : Never
14
+ name : pipelines-sd-poster
15
+ labels :
16
+ template : pipelines-sd-poster
17
+
18
+ parameters :
19
+
20
+ - name : POSTER_IMAGE_TAG
21
+ value : latest
22
+
23
+ objects :
24
+
25
+ - kind : Job
26
+ apiVersion : batch/v1
27
+ metadata :
28
+ name : pipelines-sd-poster
29
+ spec :
30
+ template :
31
+ spec :
32
+
33
+ initContainers :
34
+ - image : yauritux/busybox-curl
35
+ name : wait-for-core-before-pipelines-post
36
+ command : ['sh', '-c',
37
+ ' until (( curl http://coreservices:8080/rest/ping --connect-timeout 5 )); do sleep 2; done' ]
38
+
39
+ containers :
40
+ - image : squonk/rdkit-pipelines-sdposter:${POSTER_IMAGE_TAG}
41
+ name : pipelines-sd-poster
42
+
43
+ restartPolicy : Never
You can’t perform that action at this time.
0 commit comments