Upgrading whole stack via API

I’am using the 1.4.1 version of rancher and its v2-beta API.

I try to use the stack upgrade action. In the documentation, all fields are optional, so I send this request :

HTTP/1.1 POST /v2-beta/stacks/1st6/?action=upgrade
Host: rancher-server.atclouddev.net
Accept: application/json
Content-Type: application/json
Content-Length: 56

    "dockerCompose": "",
    "rancherCompose": "",
    "externalId": ""

But nothing seems to happen exept this :

My stack is in “upgraded” state with a “Template version not found” message.

I’d like to force all my services in my stack to “refresh” (downloading the last version of images …etc) in a single API request. Is it possible to do that via the API ?

What does mean my “Template version not found” message?

Thank you

They are “optional”, but not to do what you want. The upgrade action on Stack essentially calls rancher-compose with the input given. Sol by pushing empty strings you are telling it to do nothing. You need to either get the current yaml from another call, already have it somehow else, offer enumerate and upgrade individual services.

External ID is used to keep track of items deployed through the catalog and what version they’re on; was this from the catalog before? Because your upgrade is clearing that ID.

I tried to send the docker-compose.yaml of my stack. Each image is tagged with “:latest” so I expected to see the upgrade of each service of the stack, but nothing happened.

There’s no item from catalog. My images are stored in ECR.

So, do I need to give the docker-compose and the rancher-compose to do what I want? (and leaving externalId empty)

Thank you for your help

There is no equivalent of force upgrade on Stack upgrade since it’s meant mostly for updating catalog items. The image and everything else about the service are the same so they’re not upgraded.

You can upgrade individual services or use the actual rancher-compose CLI (which does that for you). Or there’s always using actual versions on the images.