Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add stacker version as annotation to images #602

Conversation

mikemccracken
Copy link
Contributor

It can be useful to know which version of stacker created an image. Let's put it in there.

Moves some things around to avoid multiple definitions & import loops.

@hallyn
Copy link
Contributor

hallyn commented Mar 18, 2024

Looks good to me, but would also like to see the oci annotation.

@mikemccracken mikemccracken force-pushed the 2024.03.18/main/add-stacker-version-annotation branch from 8ff13ae to 5303764 Compare March 18, 2024 22:22
@mikemccracken
Copy link
Contributor Author

here's an example of a manifest with the annotation we get from this change:

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "config": {
    "mediaType": "application/vnd.oci.image.config.v1+json",
    "digest": "sha256:8234d3f66d0841bdaf46c406fa657ff0c8656a140cc9644169f6437268668ff1",
    "size": 709
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
      "digest": "sha256:6d7944e47a2816085f3558cbd8f8b1c9ab7ea946908701dc86e824d41316daf4",
      "size": 1916744
    },
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
      "digest": "sha256:8f8602a5f876184701dc7aff30b2401f8cd6b1cf80153ec560c9b6b1927041aa",
      "size": 209
    }
  ],
  "annotations": {
    "io.stackeroci.stacker.stacker_version": "v1.0.0-rc12-3-gef4e4be-dirty",
    "io.stackeroci.stacker.stacker_yaml": "\nminbasebase:\n  build_only: true\n  from:\n    type: tar\n    url: minrfs-w-resolvconf-and-dirs.tgz\n\nminbase:\n  from:\n    type: built\n    tag: minbasebase\n  run: |\n    echo \"foo\" > \"/usr/local/bin/foo\"\n    echo \"$(</etc/resolv.conf)\"\n    echo done.\n"
  }
}

It can be useful to know which version of stacker created an image.
Let's put it in there.

Moves some things around to avoid multiple definitions & import loops.

Signed-off-by: Michael McCracken <[email protected]>
Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.46%. Comparing base (b585bfb) to head (b9452c3).
Report is 1 commits behind head on main.

❗ Current head b9452c3 differs from pull request most recent head 5303764. Consider uploading reports for the commit 5303764 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #602      +/-   ##
==========================================
+ Coverage   57.38%   57.46%   +0.07%     
==========================================
  Files          64       65       +1     
  Lines        7566     7709     +143     
==========================================
+ Hits         4342     4430      +88     
- Misses       2481     2522      +41     
- Partials      743      757      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@raharper raharper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 -- maybe a quick pkg/lib/version_test.go to make codecov happy?

@mikemccracken
Copy link
Contributor Author

+1 -- maybe a quick pkg/lib/version_test.go to make codecov happy?

I'm not too familiar with codecov, having a hard time making sense of its view. I don't think it's referring to pkg/lib/version.go - it claims the lines added in api.go don't have tests associated, but there are no unit tests for anything in there (and there shouldn't be, it is just wrappers around Sprintf)... I assume it's getting coverage from the integration bats tests too, but when I look in codecov to see how the other funcs in api.go are being covered, it now says all the lines in that file are covered - in this view of the PR on codecov https://app.codecov.io/gh/project-stacker/stacker/pull/602 it says the PR's changes have 100% coverage. Not sure how to satisfy it

@raharper
Copy link
Contributor

+1 -- maybe a quick pkg/lib/version_test.go to make codecov happy?

I'm not too familiar with codecov, having a hard time making sense of its view.

I'm not quite sure either, but most files in pkg/lib/ have _test.go` files -- could write one and see if that' makes it happy?

@mikemccracken mikemccracken force-pushed the 2024.03.18/main/add-stacker-version-annotation branch from b9452c3 to 5303764 Compare March 20, 2024 21:31
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all this should be part of in-toto metadata in the long-term

@rchincha rchincha merged commit fe13853 into project-stacker:main Mar 20, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants