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

Resource "File" correctly uses scmID #564

Merged
merged 6 commits into from
Mar 12, 2022
Merged

Conversation

olblak
Copy link
Member

@olblak olblak commented Mar 10, 2022

Fix #558

If a relative file path is provided with a scmID, then like for condition and target, we want to use the git repository directory as the file root directory

Test

To test this pull request, I used the following updatecli configuration:

.updatecli.yaml

---
title: "Test Git scm"

scms:
  scenario-1:
    kind: git 
    spec:
      username: '{{ requiredEnv "UPDATECLI_GITHUB_ACTOR" }}'
      password: '{{ requiredEnv "UPDATECLI_GITHUB_TOKEN" }}'
      url: "https://github.com/updatecli/experiment.git"
      branch: "main"

sources:
  scenario-1:
    name: "Scenario 1"
    kind: file
    scmID: scenario-1
    spec:
      file: README.md
      line: 1
updatecli diff --config updatecli.yaml

Additional Information

Tradeoff

/

Potential improvement

/

@olblak olblak added bug Something isn't working resource-file Resource of kind File labels Mar 10, 2022
@olblak olblak requested a review from dduportal March 10, 2022 23:06
Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

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

Good catch!

Can you:

  • rebase against master (to only embed the commits related to this PR). easier to review.
  • Add unit test(s) to cover the new code block
    ?

pkg/plugins/resources/file/source.go Show resolved Hide resolved
pkg/plugins/resources/file/source.go Show resolved Hide resolved
Signed-off-by: Olblak <me@olblak.com>
Co-authored-by: Damien Duportal <damien.duportal@gmail.com>
olblak and others added 3 commits March 11, 2022 19:51
Co-authored-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak
Copy link
Member Author

olblak commented Mar 11, 2022

@dduportal I had to slightly modify the test struct

Signed-off-by: Olblak <me@olblak.com>
@olblak olblak enabled auto-merge (squash) March 11, 2022 19:21
@olblak olblak merged commit d1db18e into updatecli:main Mar 12, 2022
Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

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

@olblak you did not "slightly change" the test struct: you fixed it as it was incorrect (I don't know how did I mess it up, but it's fix with your change). Thanks!

@olblak
Copy link
Member Author

olblak commented Mar 12, 2022

@olblak you did not "slightly change" the test struct: you fixed it as it was incorrect (I don't know how did I mess it up, but it's fix with your change). Thanks!

Well, you did a great job for those UT, that was just a minor mistake which to be honest confused me initially :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resource-file Resource of kind File
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resource File is failing when used with scmID
2 participants