github.com/redhat-appstudio/e2e-tests@v0.0.0-20240520140907-9709f6f59323/pipelines/interrupt_catcher/README.md (about) 1 # IC rotation Cron triggered pipeline 2 3 This pipeline triggers an Appstudio QE Interrupt catcher rotation. It's scheduled to run every Thursday at 10 AM. 4 5 This jobs rotates IC responsibility through the list defined in cm_people_list.yaml. It will shift the two IC people by one (a.k.a. last week's Primary IC is next week's backup IC). 6 The job also sends a message to #forum-stonesoup-qe slack channel with info who is current primary and backup IC. 7 It also sends a message to the same channel, when the pipeline fails. 8 9 ## Prerequisites 10 * Cluster with Openshift Pipelines installed (tested with Pipelines 1.7.2). 11 * Existing `appstudio-qe` namespace 12 * Slack App OAuth token with at least `usergroups:read` and `usergroups:write` scopes. 13 * Opaque secret `slack-token` in `appstudio-qe` namespace with `token` data. This is slack app OAuth token with at least `usergroups:read` and `usergroups:write` scopes. 14 ``` 15 oc create secret generic slack-token --from-literal="token=<TOKEN>" 16 ``` 17 18 ## Deployment 19 * Create secret in `appstudio-qe` namespace with Slack token: 20 ``` 21 oc create secret generic slack-token --from-literal="token=<TOKEN>" 22 ``` 23 * Deploy rest of the resources: 24 ``` 25 cd pipelines/interrupt_catcher 26 kubectl apply -f . 27 ``` 28 This should create all the remaining resources. 29 ## How to add/remove user to rotation 30 Users in rotation and their order is defined in configmap `cm_people_list.yaml` in form of `base64` encoded json. 31 To obtain the json run 32 ``` 33 yq ".binaryData.people-list" cm_people_list.yaml |base64 -d 34 ``` 35 Json is in format 36 ``` 37 [ 38 {"username": "USER1", "id": "USER1_SLACK_ID"}, 39 {"username": "USER2", "id": "USER2_SLACK_ID"} 40 ] 41 ``` 42 After you've made your changes, encode json back (`cat myJson.json |base64 -w 0`) and replace `binaryData` in `cm_people_list.yaml` 43 ## How to manually trigger another run of the pipeline 44 Sometimes we would like to skip somebody in rotation. To do that we might run the pipeline again manually. We can do this by creating `Job` from our `CronJob` 45 ``` 46 oc create job --from=cronjob/interrupt-catcher ic-manual-1 47 ``` 48 After the pipeline has run, you can delete the job: 49 ``` 50 oc delete job/ic-manual-1 51 ``` 52 ## Slack API call to change directly 53 ``` 54 curl -X POST -H "Authorization: Bearer $TOKEN" "https://slack.com/api/usergroups.users.update?usergroup=${USERGROUP_ID}&users=${id}" 55 ``` 56 Where `${id}` is slack user ID and `${USERGROUP_ID}` is our IC usergroup's ID (`S03PD4MV58W`)