How to upgrade service in multiple stacks via API

Hello,

We have a build pipeline made out of GitLab, Jenkins 2 and Rancher. Our current issue is that we cannot trigger Rancher using the API from Jenkins, to pull the updated service from the registry (the Gitlab registry) and update it. Also, we need to do it in multiple stacks. We used the API to trigger complete environment upgrades, but that is not stable somehow, the services are not upgraded every time and the API is very fiddly. We tried upgrading each service, but then we have to set up Jenkins so it knows each of the services in all stacks. We tried with the io.rancher.container.pull_image label, no luck. We tried with specifying the rancher-compose.yml with all kinds of parameters (although the .yml is poorly documented), also not much results.

So to sum up:

  1. How to properly make Rancher pull and upgrade all of the services in the one stack through the API (we only managed to trigger the upgrade, not the pull)?

  2. How to upgrade a service in multiple stack using the API?

We are not using any plugin for Rancher, since obviously it does not exist, only pure REST API calls.

Best regards,

If you have the label io.rancher.container.pull_image as part of your service, it should automatically pull the image before deploying a new container.

In the API, if you click on “View in API” on the stack, you will be able to see the actions for the stack. You can click on upgrade and it will take a rancher-compose/docker-compose files. If the label is part of the service, it should automatically pull.

Is your second question about how to upgrade services with the same name that are in multiple stacks? If so, this doesn’t exist.

Edit: It does not really work actually, although I first wrote it works. It works from time to time. Once it pulls, and then it does not pull the next several times and so on…

However, is there any way to reuse the previous docker-compose file when upgrading. It seems a bit redundant to provide a file every time an upgrade is requested?