Release tag set via Resin Python SDK misbehave

Use case:

Set ‘version’ tag for each release, hence write a ‘version’ tag per release with a unique string value.

Issue:

The release tag called version is not updated correctly. An update of one release tag affect other release tags.

The below image show the version tag before update

before_set_release_tag

Then I call a script using resin.models.tag.release.set( release_id, 'Version', git_describe )

The release_id is the value of the latest release. See output from the script:

Add release tag Version=b’v0.0.0-1-g99c9f1b\n’ to commit_id ‘8ec786ab87f472f5f518485f875c65c7’ with release id ‘589716’
b’OK’

The result of script call produce the bellow image:

Both release are affected even though only one of the two was requested to be changed. Is this the expected behaviour?

Hi @aliasbits, thanks for the report. I have asked @nghiant2710 to look into it, it definitely doesn’t look like the correct behaviour.

I have idenitifed that the issue relates to the PATCH on https://api.resin.io/v4/release_tag. The PATCH call is used in the python SDK producing the above behaviour.

Until fixed, I will use the endpoint https://api.resin.io/v4/release_tag to set a tag for a given release by below code:

      url = "https://api.resin.io/v4/release_tag"

      response = requests.post( 
        url,
        json={
          "release": release_id,
          "tag_key": "Version",
          "value": git_describe
        },
        headers={
          "Authorization": "Bearer %s" % ( token ),
          "Content-Type": "application/json"
        },
        cookies={},
      )

201 will be reported on success and 404 if called twice on the same release

hi @aliasbits, we just released python sdk v5.1.0 that has the fix for this issue. Can you upgrade the sdk to the latest version and try again?

Thanks again for the report.

Hi nghiant, I was not able to reproduce the initial error when using python sdk v5.1.0