carvel-dev / carvel-dev/kapp-controller

Cannot release repository with build metadata

Open
#1,409 2 comments 0 reactions 0 assignees View on GitHub
bug carvel-accepted priority/awaiting-more-evidence
Dominant language
Go
Stars
323
Forks
127
Avg merge
2d 16h
Merged PRs (30d)
4

Description

**What steps did you take:**

I tried to release a package repository with build metadata:

```
kctrl package repository release --version 2.6.0-0+git.a65d891.dirty.user.mbrauer --yes --chdir build
```

**What happened:**

`kctrl` error'd with:

```
kctrl: Error: imgpkg:
Error:
Parsing ':2.6.0-0+git.a65d891.dirty.user.mbrauer': tag can only contain the characters `abcdefghijklmnopqrstuvwxyz0123456789_-.ABCDEFGHIJKLMNOPQRSTUVWXYZ`: 2.6.0-0+git.a65d891.dirty.user.mbrauer
```

In detail:

```
❯ make repository
kctrl package repository release --version 2.6.0-0+git.a65d891.dirty.user.mbrauer --yes --chdir build

Prerequisites
1. `packages` directory containing Package and PackageMetadata files present in
the working directory.
2. Host is authorized to push images to a registry (can be set up using `docker
login`)

Basic Information
Registry URL
The bundle created needs to be pushed to an OCI registry (format:
) e.g. index.docker.io/k8slt/sample-bundlekbld ensures that all image references are resolved to an immutable reference.
Lock image references using kbld
| $ kbld -f packages --imgpkg-lock-output .imgpkg/images.yml

An imgpkg bundle consists of all required YAML configuration bundled into an OCI
image that can be pushed to an image registry and consumed by the package.
Pushing imgpkg bundle
| $ imgpkg push -b :2.6.0-0+git.a65d891.dirty.user.mbrauer -f ./bundle-:2.6.0-0+git.a65d891.dirty.user.mbrauer-3288778765 --tty=true

kctrl: Error: imgpkg:
Error:
Parsing ':2.6.0-0+git.a65d891.dirty.user.mbrauer': tag can only contain the characters `abcdefghijklmnopqrstuvwxyz0123456789_-.ABCDEFGHIJKLMNOPQRSTUVWXYZ`: 2.6.0-0+git.a65d891.dirty.user.mbrauer
```

**What did you expect:**

As per [semver#10](https://semver.org/#spec-item-10) a version can have build metadata which is delimited with a `+`. I would expect that `--version` can receive any valid semver. Unfortunately, an OCI image tag cannot contain a `+` character. I am aware that presents a challenge, but I would expect that a user of `kctrl package (repository) release` need not be concerned with that issue.

**Anything else you would like to add:**

Maybe `kctrl` could map `+` to `_` under the hood and reverse the mapping when inferring a version from a tag. In my case:
* version: `2.6.0-0+git.a65d891.dirty.user.mbrauer`
* tag: `2.6.0-0_git.a65d891.dirty.user.mbrauer`

**Environment:**

```
❯ kctrl -v
kctrl version 0.48.2

Succeeded
```

---
Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.