# Update OCP versions on Assisted Installer Stage
Slide: https://hackmd.io/@vrutkovs/demo-assisted-service-stage
---
`openshift-edge-bot` is periodically creates PRs to update [assisted-service](https://github.com/openshift/assisted-service) metadata after parsing Cincinnati endpoint to find new stable updates
Example: https://github.com/openshift/assisted-service/pull/3699

---
### Stage instance
[Stage instance](https://qaprodauth.cloud.redhat.com/openshift/assisted-installer/clusters/~new) needs to be updated separately.
Process:
* Fork https://gitlab.cee.redhat.com/service/app-interface/
* Update `data/services/assisted-installer/cicd/saas.yaml`
---
### Stage instance
`saas.yml` contains stage/production settings:
* Change `OS_RELEASE`/`RELEASE_IMAGES` env vars:
* Config contains both prod and stage service settings
* Release images are a mix of "4.x" and "4.x.y" definitions
* Contains several `maintained` releases
---
### Stage instance
* Create a merge request with updates, needs `/lgtm` from Edge group members
* Once MR is merged AppSRE automation updates stage instance
---
### Automating updates
https://gitlab.cee.redhat.com/vrutkovs/assisted-installer-ocp-bump/
Two main parts:
* Python script to create a commit with proposed changes
* Gitlab CI to automate periodic script runs
---
### Automating updates - script
* Clone app-interface, parse SaaS file definition
* Clone assisted-service and parse OS_IMAGES/RELEASE_IMAGES
* If stage settings need updates a new commit is created and pushed to the branch
* Only "4.x" refs updates (preserving maintenance releases like 4.7.24 etc)
* Notification is sent to `#assisted-deployment-ci` Slack channel
* Notification link lets you customize the MR
---
### Automating updates - Gitlab CI
* Installs dependencies and runs the script with secret slack credentials
* Runs periodically - 8 hours atm
* Ensures that the bot doesn't re-trigger if the branch already exists
---
### Gitlab CI job output

---
### Slack notification
https://coreos.slack.com/archives/C014N2VLTQE/p1650819665223219

---
### Example MR
https://gitlab.cee.redhat.com/service/app-interface/-/merge_requests/37756

---
### Further improvements
* [ ] Finalize the MR template and create the MR automatically
* [ ] `cc` people in Slack notification to draw attention to it
* [ ] Monitoring the Gitlab CI to ensure errors are not being ignored
{"metaMigratedAt":"2023-06-16T23:46:03.989Z","metaMigratedFrom":"YAML","title":"Automatic stage version updates","breaks":true,"description":"View the slide with \"Slide Mode\".","slideOptions":"{\"transition\":\"slide\",\"theme\":\"league\"}","contributors":"[{\"id\":\"633335f1-f632-499a-a512-214d62aa9b09\",\"add\":5225,\"del\":2483}]"}