dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

Update lib-injection docker image tags

Open andrewlock opened this issue 1 year ago • 0 comments

What Does This Do

Adds vMAJOR and vMAJOR.MINOR lib-injection images (in addition to vMAJOR.MINOR.PATCH and latest)

Motivation

We want to enable customers to be able to pin to a major version. We were also incorrectly tagging images as latest when they weren't (only would have happened on hotfixes, so hasn't actually occurred).

We are following (this doc's suggestions), but in summary:

  • Prerelease versions are not tagged
  • Every non-prerelease release gets the vMajor.Minor.Patch version tag
    • 2.5.0 gets v2.5.0
    • 2.2.3 gets v2.2.3
    • 1.2.1 gets v1.2.1
  • Every non-prerelease release gets the vMajor.Minor version tag initially (which assumes we never "go back" in release values)
    • 2.5.0 gets v2.5
    • 2.2.3 gets v2.2
    • 1.2.1 gets v1.2
  • Some releases get the vMajor version tag. Only releases for which this is the highest version in the major get the tag.
    • 2.5.0 gets v2 (if there's no higher 2.x.x release)
    • 1.2.1 gets v1 (if there's no higher 1.x.x release)
  • Some releases get the latest tag. Only releases for which this is the highest version ever get the tag.
    • 2.5.0 gets latest if it's the highest release so far
    • 1.2.1 will not get latest if there's already 2.x.x releases

The logic is now more complicated and requires knowing the state of the git repository. The script shown here mirrors the one added for .NET.

Note we're taking advantage of the Datadog/public-images support for passing multiple csv values in the IMG_DESTINATIONS variable. You can see an example of this used in "the wild" here.

Additional Notes

The generation stage is quite verbose about printing out all the variables, but overall this is obviously very hard to test so I set up a dummy GitHub repository and GitLab YAML, which just echoes the values it receives, to confirm they're sent across to the child pipeline correctly.

If it is safe to do so, we can test this by reverting the revert "TESTING" commit

I don't know how backporting or the extra -rc commit tags work, so hopefully someone else could pick that up 😅

andrewlock avatar May 22 '24 08:05 andrewlock