Skip to content

feat(file): implement spec.files for kind: file#490

Merged
dduportal merged 70 commits into
updatecli:mainfrom
lemeurherve:is-435
Apr 6, 2022
Merged

feat(file): implement spec.files for kind: file#490
dduportal merged 70 commits into
updatecli:mainfrom
lemeurherve:is-435

Conversation

@lemeurherve

@lemeurherve lemeurherve commented Jan 26, 2022

Copy link
Copy Markdown
Member

Ability to specify more than one file for kind: file

Fixes #435

Additional validations

General:

  • allow only one file if spec.Line is specified

For sources & conditions

  • allow only one file

For targets:

  • allow multiple files if no spec.Line is specified

Test

To test this pull request, you can run the following commands:

cp <to_package_directory>
go test

Additional Information

spec.file should be deprecated in the following version.

Potential improvements

  • do the same for kind: dockerfile and kind: yaml
  • Add tests with "file://..."
  • Rename the package file to files

@lemeurherve lemeurherve changed the title [wip] feat(file): implement spec.files for kind: file (first part: targets block) [wip] feat(file): implement spec.files for kind: file Jan 30, 2022
@lemeurherve

Copy link
Copy Markdown
Member Author

file.yaml: success :)

Comment thread pkg/plugins/file/main_test.go Outdated
@lemeurherve lemeurherve changed the title [wip] feat(file): implement spec.files for kind: file feat(file): implement spec.files for kind: file Jan 30, 2022
@lemeurherve lemeurherve marked this pull request as ready for review January 31, 2022 00:41
@lemeurherve

Copy link
Copy Markdown
Member Author

I didn't found the report of CodeQL:
image

Comment thread .golangci.yml
@lemeurherve lemeurherve marked this pull request as draft January 31, 2022 10:49
Comment thread pkg/core/text/mocks.go Outdated
@olblak

olblak commented Mar 30, 2022

Copy link
Copy Markdown
Member

I think I spot an error with the following manifest when using the line from a source

Well it can't reproduce it :/

@olblak

olblak commented Mar 30, 2022

Copy link
Copy Markdown
Member

I think I spot an error with the following manifest when using the line from a source

Well it can't reproduce it :/

Well I can randomly reproduce it

@olblak

olblak commented Mar 30, 2022

Copy link
Copy Markdown
Member

The result of my experimentation
https://gist.github.com/olblak/88351cf2047520abe44eefb65380abdf

@lemeurherve

Copy link
Copy Markdown
Member Author

I've got this error with your manifest: https://gist.github.com/lemeurherve/4d00d36115c170a40899f8d699abbb91

@lemeurherve

lemeurherve commented Apr 2, 2022

Copy link
Copy Markdown
Member Author

@olblak reproduced and fixed :)

Please also review lemeurherve#18 cf this comment ;)

@olblak

olblak commented Apr 4, 2022

Copy link
Copy Markdown
Member

Thanks @lemeurherve it works great.
I am waiting for @dduportal to provide a final feedback before merging this pullrequest.

Also so, would you have some time to add a manifest to test the different "file" usecases in the e2e directory?

Configuration cannot have WARNING or Error as defined in the venom test here

@olblak

olblak commented Apr 5, 2022

Copy link
Copy Markdown
Member

@lemeurherve linting test are failing :)

@lemeurherve

Copy link
Copy Markdown
Member Author

Looking into e2e errors

Comment thread pkg/plugins/resources/dockerfile/condition_test.go Outdated
Co-authored-by: Olivier Vernin <olivier@vernin.me>
@lemeurherve

Copy link
Copy Markdown
Member Author

The e2e error comes from udpatecli version:

$ dist/updatecli_darwin_amd64/updatecli version

VERSION

Application:

Build Time :

$ updatecli version

VERSION

Application:    0.22.3
Golang     :    1.17.8 linux/amd64
Build Time :    2022-03-22T09:52:05Z

Not sure why though

@olblak

olblak commented Apr 6, 2022

Copy link
Copy Markdown
Member

The e2e error comes from udpatecli version:

$ dist/updatecli_darwin_amd64/updatecli version

VERSION

Application:

Build Time :

$ updatecli version

VERSION

Application:    0.22.3
Golang     :    1.17.8 linux/amd64
Build Time :    2022-03-22T09:52:05Z

Not sure why though

It depends who you build updatecli locally, because you may not have set the flag that define the different version information

@lemeurherve

Copy link
Copy Markdown
Member Author

OK. Do the e2e tests pass locally for you?

@olblak

olblak commented Apr 6, 2022

Copy link
Copy Markdown
Member

OK. Do the e2e tests pass locally for you?

Yes it does

 • Updatecli Version TestSuite (e2e/venom.d/test_version.yaml)
 	• Test-updatecli-version-return-code-is-0 SUCCESS

@olblak

olblak commented Apr 6, 2022

Copy link
Copy Markdown
Member

Maybe @dduportal can help you in case of something specific on mac which I am missing

@olblak

olblak commented Apr 6, 2022

Copy link
Copy Markdown
Member

Anyway e2e test are executed for each pullrequest in the build workflow so you'll know very quickly if something goes wrong. :D

@dduportal dduportal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚀

@dduportal dduportal merged commit aeacb2f into updatecli:main Apr 6, 2022
lemeurherve pushed a commit to lemeurherve/updatecli that referenced this pull request Apr 11, 2022
lemeurherve pushed a commit to lemeurherve/updatecli that referenced this pull request Apr 14, 2022
lemeurherve pushed a commit to lemeurherve/updatecli that referenced this pull request Apr 14, 2022
lemeurherve pushed a commit to lemeurherve/updatecli that referenced this pull request Sep 10, 2022
olblak added a commit that referenced this pull request Feb 1, 2023
* feat(yaml): implement spec.files for kind: yaml

Follow-up of #490
Ref #435

* Add e2e test for yaml (#43)

* Apply suggestions from code review

Co-authored-by: Olivier Vernin <olivier@vernin.me>

* chore: move test to e2e success folder

* wip: first stab at files for condition too

* Revert "wip: first stab at files for condition too"

This reverts commit 957f21e.

* restore comment, will be done in #729

* chore: replace deprecated sourceID field by sourceid

* fix: e2e tests

* breaking?: no error if the target content hasn't changed

* Remove broken test file

Signed-off-by: Olblak <me@olblak.com>

* patch from main (with #846 included and adapted)

* fix tests

* Add missing jsonschema annotations

Co-authored-by: Olivier Vernin <olivier@vernin.me>

* fix: remove files field from expected autodiscovery tests results
Omited if empty since previous commit

* cleanup: remove non mandatory empty files field from chart examples

* chore: more complete debug log with initial filePath

* chore: add debug logs

* Update pkg/plugins/resources/yaml/main.go

* chore: add missing Test_TargetFromSCM test

* Update pkg/plugins/resources/yaml/source.go

Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com>

* Update pkg/plugins/resources/yaml/main.go

Co-authored-by: Olivier Vernin <olivier@vernin.me>

* allow multiples files for 'condition'

* update example with a condition checking multiple files

* remove TODOs

* remove unrelated changes

* replace example by e2e test

* correct check for s.file

* Update pkg/plugins/resources/yaml/main.go

---------

Signed-off-by: Olblak <me@olblak.com>
Co-authored-by: Olivier Vernin <olivier@vernin.me>
Co-authored-by: Olblak <me@olblak.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request resource-file Resource of kind File ux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: ability to specify more than one target file

4 participants