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

ability to update a dependency ref from command line #276

Closed
schmurfy opened this issue Aug 2, 2023 · 3 comments
Closed

ability to update a dependency ref from command line #276

schmurfy opened this issue Aug 2, 2023 · 3 comments
Labels
enhancement This issue is a feature request

Comments

@schmurfy
Copy link

schmurfy commented Aug 2, 2023

Describe the problem/challenge you have
[A description of the current challenge that you are experiencing.]

starting from this config:

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: mylib
    contents:
      - path: .
        git:
          url: https://github.com/schmurfy/mylib
          ref: master

I would like to be able to do something similar to go get mylib@v1.0.2.

Describe the solution you'd like
[A clear and concise description of what you want to happen. If applicable a visual representation of the UX.]

here are some ideas how it might look like:

envdir pull mylib@v1.0.2
envdir get https://github.com/schmurfy/mylib@v1.0.2

after that envdir.yaml would contain ref: v1.0.2 and the lockfile would contains the sha1/revision pulled.

Anything else you would like to add:
[Additional information that will assist in solving the issue.]

it would not work for every backend but it would be a great addition for faster workflow.

One usecase is pull-request, when doing pull-requests involving multiple repositories we have one pr & branch for each repository and need to switch to that branch, I would prefer a simple command line than having to edit a file. Worst case scenario I can script the file edit but it would not be my first choice.


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.

@schmurfy schmurfy added carvel-triage This issue has not yet been reviewed for validity enhancement This issue is a feature request labels Aug 2, 2023
@kumaritanushree
Copy link
Contributor

kumaritanushree commented Aug 22, 2023

@schmurfy thank you for creating issue. What I could understand about the requirement is:

You have vendir.yaml

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: mylib
    contents:
      - path: .
        git:
          url: https://github.com/schmurfy/mylib
          ref: master

now second time you want to fetch https://github.com/schmurfy/mylib for tag v1.0.2.
-> With the current logic in vendir you have to update vendir.yam to

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: mylib
    contents:
      - path: .
        git:
          url: https://github.com/schmurfy/mylib
          tag: v1.0.2

and then run vendir sync to fetch new changes.

Instead of editing vendir.yaml and then run vendir sync you want to just run vendir pull mylib@v1.0.2 or vendir get https://github.com/schmurfy/mylib@v1.0.2 and you expect vendir should do rest of the job for you. And new changes should get updated in both vendir.yaml and vendir.lock.yaml.

It seems we want to two separate commands vendir sync and vendir get/pull to do same jobs with just one change, in second command we do not need to edit vendir.yaml manually.

I feel if just editing vendir.yaml is problem then we can either use some bash script to do that or we may have a vendir flag to update vendir.yaml with new requirement and then run vendir sync.

In above example we have only one directory but could have multiple and then flag will be complicated to update for multiple contents.

@schmurfy
Copy link
Author

I solved the problem by using ytt with an overlay which does the job well so this might be a non issue. I agree it is far easier to do this that way than having a commands which works in all cases for everyone.

@github-actions github-actions bot removed the carvel-triage This issue has not yet been reviewed for validity label Aug 24, 2023
@schmurfy
Copy link
Author

if someone else needs it, here is my ytt template:

#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")

#@overlay/match by=overlay.subset({"kind": "Config"})
---
directories:
  #@overlay/match by=overlay.subset({"path": "mylib"})
  - contents:
      #@overlay/match by=overlay.index(0)
      - git:
          ref: #@ data.values.ref

and it can be used with:

ytt -v ref=$(REV) -f vendir.yml -f vendir-change-ref.yaml

@github-actions github-actions bot added the carvel-triage This issue has not yet been reviewed for validity label Aug 24, 2023
@joaopapereira joaopapereira removed the carvel-triage This issue has not yet been reviewed for validity label Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a feature request
Projects
Archived in project
Development

No branches or pull requests

3 participants