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

feat: added support for custom tags #175

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

pcanilho
Copy link
Contributor

@pcanilho pcanilho commented Jul 4, 2024

Goal

This PR is aimed at adding support for publishing multiple image tags. This makes use of the existing feature-set provided by upstream ko-build/ko through the usage of the --tags flag.
cf. https://github.com/ko-build/ko/blob/0dcace336cc5f723150d77487dbaf56f849cc361/docs/reference/ko_build.md?plain=1#L62

By adding this functionality one is then able to avoid having to collide with an existing stable tag which is always named latest. This also opens the door for the usage of semver.

What changed?

  • Added an optional tags schema field that takes a list of strings. If not provided, backwards compatibility is maintained by defaulting to the usage of the latest tag.
  • Added new test suite TestAccResourceKoBuild_Tags to assert that new functionality works as expected and backwards compatibility is maintained.

Tests

image

Example usage

resource "ko_build" "this" {
  sbom        = "<your_sbom>"
  tags        = ["develop"]
  importpath  = "<your_importpath>"
  repo        = "<your_repo>"
  working_dir = "<your_work_dir>"
}

Copy link
Member

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

This looks good! Can you add a simple test that creating a resource with tags produces an image with those tags?

@pcanilho pcanilho force-pushed the feature/ko-build-tags branch from 9444fa0 to 22bb997 Compare July 4, 2024 19:19
@pcanilho
Copy link
Contributor Author

pcanilho commented Jul 4, 2024

This looks good! Can you add a simple test that creating a resource with tags produces an image with those tags?

@imjasonh I have added a new test suite called TestAccResourceKoBuild_Tags that I believe covers the changes proposed in this PR. I have retroactively updated the first comment. :-)

@pcanilho pcanilho requested review from imjasonh and isometry July 4, 2024 19:25
@pcanilho pcanilho force-pushed the feature/ko-build-tags branch from 22bb997 to ff8613b Compare July 4, 2024 19:30
@pcanilho pcanilho force-pushed the feature/ko-build-tags branch from ff8613b to 671d1aa Compare July 5, 2024 07:05
@imjasonh imjasonh enabled auto-merge July 6, 2024 02:00
Signed-off-by: Jason Hall <jason@chainguard.dev>
@imjasonh imjasonh merged commit 0feedf9 into ko-build:main Jul 6, 2024
6 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.

3 participants