screwdriver icon indicating copy to clipboard operation
screwdriver copied to clipboard

Template version delete caused accident config parser behavior

Open adong opened this issue 1 year ago • 1 comments

What happened: When users delete a template version that has a tag associated with it.

Say template namespace-test/name-deploy which has versions:

  • 1.0.3
  • 1.0.4,
  • 1.0.5 with latest tag

Since the template owner deleted version 1.0.5, and resulting latest tag also be deleted (which ought to happen by user intention).

So, the config parser will raise issues such as

Error: Template namespace-test/name-deploy@latest does not exist

What you expected to happen:

  1. There should be a better way to allow users to add tags on the template UI
  2. Relax rules that instead of scoping to the template pipeline build, the sd admin and repo owner can also change the tag
  3. When latest tag is removed, preserve deleted tags and defaults to the previous version (does not make sense to me, only list here for exploring options)

How to reproduce it: Create two pipelines

  1. pipeline 1 publishes a template with tag, say latest
  2. pipeline 2 uses that template with the latest tag
  3. Remove the template version which has latest tag
  4. Kick off pipeline 2, one will see config parser error mentioned previously

adong avatar Oct 25 '23 18:10 adong

The immediate resolution is to update the DB by executing:

INSERT INTO "templateTags" (name, tag, version, namespace, "templateType")
VALUES ('name-deploy', 'latest', '1.0.3', 'namespace-test', 'JOB');

Verification

SELECT * from "templateTags" WHERE namespace = 'namespace-test'

adong avatar Oct 25 '23 18:10 adong