Get artifact version registered at commit
- Dominant language
- Python
- Stars
- 162
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
From [discord](https://discord.com/channels/485586884165107732/903647230655881226/1050436722296619108):
> is there a way for gto to output the current tag for HEAD? (edited)
> well, I know it's redundant because gto keeps the models registered in git tags, but let's say I am saving predictions of a model to a database. I need those predictions to be associated with the model that produced them - so ideally I'd save the predictions together with the model tag.
so whenever I'd do gto register ideally I'd be able to save the resulting simplified tag @v1.2.3 to a text file that I can later use to associate predictions with a model (edited)
Now it can be achieved with something like:
```
$ export NAME="churn"
$ git --no-pager tag --points-at HEAD | xargs -I {} sh -c '
if [ $(gto check-ref {} --name) = $NAME ] && [ $(gto check-ref {} --event) = "registration" ]; then
gto check-ref {} --version
fi
'
```
We can add a command to GTO, but I need to better understand how it should work first.
Specifically for this case:
- Input: revision, artifact name
- Output: artifact version
If we try to generalize a bit:
- Input: revision, [artifact name] optionally, [version or stage] optionally
- Output: artifact version or stages
Then it can look like
```bash
$ gto find HEAD nn --version
v0.0.1
$ gto find HEAD nn --stage
dev
$ gto find HEAD nn
v0.0.1 in dev
$ gto find HEAD
nn v0.0.1 in dev
mymodel v1.2.3 in stage and prod
```
WDYT? Maybe there are some simpler options or this can be included in existing commands (like `gto show` or `gto check-ref`?)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.