carvel-dev / carvel-dev/vendir

Provide me with a machine parsable version in the vendir.lock.yml when githubRelease is used

Open
#113 1 comment 0 reactions 0 assignees View on GitHub
carvel-accepted enhancement
Dominant language
Go
Stars
399
Forks
73
Avg merge
2h 53m
Merged PRs (30d)
2

Description

**Describe the problem/challenge you have**
I really love the `tagSelection` capability in vendir for `githubRelease`, it's the best and support for conditionals is really stellar. I've started using it instead of `tag` after playing around with it for `imgpkgBundle`. For `imgpkgBundle` I'll get what the semver resolved to in the lock file:

```
apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
- image:
tag: v1.4.0
url: projects.registry.vmware.com/tkg/tanzu_core/provider/provider-templates@sha256:6f48690e6e7ff5c81443134581cb4c80320767b345b347ef83038c74cc0ec549
path: .
path: bundle/config/upstream
- contents:
- directory: {}
path: .
path: bundle/config/overlay
kind: LockConfig

```

But then with `githubRelease` I don't get anything that is easily machine parsable for follow-on scripts:

```
apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
- githubRelease:
url: https://api.github.com/repos/kubernetes-sigs/cluster-api-provider-aws/releases/47009918
path: .
path: bundle/config/upstream
- contents:
- directory: {}
path: .
path: bundle/config/overlay
kind: LockConfig
```

**Describe the solution you'd like**
I'm telling vendir what to check against, like this example:
```
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
minimumRequiredVersion: 0.12.0
directories:
- path: bundle/config/upstream
contents:
- path: .
githubRelease:
slug: kubernetes-sigs/cluster-api-provider-aws
tagSelection:
semver:
constraints: ">0.6.5 <0.7.0"
assetNames: ["infrastructure-components.yaml"]
disableAutoChecksumValidation: true
- path: bundle/config/overlay
contents:
- path: .
directory:
path: manifests
```
I want to know what release I ended up with in such a way I can just run through:

```
yq eval '.. | select(has("tag")).tag' vendir.lock.yml vendir.yml
```

to get the tag that was resolved.

I am doing this already with `imgpkgBundle` and `githubRelease` when I explicitly set the tag, but this capability stops working if I move to `tagSelection`. I can do something similar with `helmChart` (just change to version instead of tag)

**Anything else you would like to add:**
I am happy to change up my process if there's a more robust solution here, maybe some kind of aggregate "version collector" or similar for vendir that can help establish a "lock versioning" based on what was fetched.

---
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

Research direction

Start by tracing how githubRelease writes vendir.lock.yml, then compare that output with the existing imgpkgBundle and helmChart lock entries described in the issue. The change is done when a tag selected by tagSelection is recorded in a machine-parsable lock entry and the provided yq query can retrieve it.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.