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

Fix ignores files during sync #5689

Merged

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Apr 25, 2022

What type of PR is this:

/kind bug

What does this PR do / why we need it:

Which issue(s) this PR fixes:

Fixes #4389

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

@netlify
Copy link

netlify bot commented Apr 25, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit b8d1f18
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/626684088a7e0000083ad8b5

@feloy feloy requested a review from dharmit April 25, 2022 11:20
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 25, 2022
@feloy feloy requested a review from valaparthvi April 25, 2022 11:20
@openshift-ci openshift-ci bot requested review from rm3l and rnapoles-rh April 25, 2022 11:20
@feloy feloy removed the request for review from rnapoles-rh April 25, 2022 11:20
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@feloy feloy mentioned this pull request Apr 25, 2022
3 tasks
@odo-robot
Copy link

odo-robot bot commented Apr 25, 2022

Unit Tests on commit finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 25, 2022

Windows Tests (OCP) on commit finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 25, 2022

Kubernetes Tests on commit finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 25, 2022

OpenShift Tests on commit finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 25, 2022

Validate Tests on commit finished successfully.
View logs: TXT HTML

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 25, 2022
@feloy feloy changed the title Fix ignores files during watch + sync Fix ignores files during sync Apr 26, 2022
@rm3l
Copy link
Member

rm3l commented Apr 26, 2022

I noticed that while the changes here worked great for sync'ing, we were still unnecessarily watching files that were supposed to be ignored. For example, I saw these logs while testing on a simple multi-module Maven project:

I0426 10:57:01.415897  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target
I0426 10:57:01.415905  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target/classes
I0426 10:57:01.415913  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target/classes/io
I0426 10:57:01.415920  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target/classes/io/jitpack
I0426 10:57:01.415929  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target/generated-sources
I0426 10:57:01.415938  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target/generated-sources/annotations
I0426 10:57:01.415946  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target/generated-test-sources
I0426 10:57:01.415955  907437 watch.go:176] adding watch on path /home/asoro/work/tmp/maven-modular/module2/target/generated-test-sources/test-annotations

As discussed together, the "watch" part will be fixed in a separate issue/PR.

LGTM so far, but I'll let other reviewers (@dharmit , @valaparthvi ) review and approve.

/lgtm

EDIT: Created #5698 to keep track of this

@dharmit
Copy link
Member

dharmit commented Apr 26, 2022

I tried a scenario where odo dev was running on one hand and on the other hand, I executed the following:

$ echo -e "\nb.txt" >> .gitignore 
$ echo hello > b.txt 

The odo dev still triggered a push when b.txt was created. Is this expected behaviour?

@feloy
Copy link
Contributor Author

feloy commented Apr 26, 2022

I tried a scenario where odo dev was running on one hand and on the other hand, I executed the following:

$ echo -e "\nb.txt" >> .gitignore 
$ echo hello > b.txt 

The odo dev still triggered a push when b.txt was created. Is this expected behaviour?

Is the b.txt synced to the container?

As noted by @rm3l, this PR fixes the files that are synced to the container, but not particularly which files are triggering the sync.
But if this is a regression, I will try and fix it as part of this PR

@dharmit
Copy link
Member

dharmit commented Apr 26, 2022

Is the b.txt synced to the container?

Yes.

$ kubectl exec nodejs-app-9964cc475-94ct6 -c runtime -- cat /projects/b.txt
hello

As noted by @rm3l, this PR fixes the files that are synced to the container, but not particularly which files are triggering the sync.

OK, this makes a lot more sense now.

But if this is a regression, I will try and fix it as part of this PR

I don't know/remember how it behaved in the past. But I think it was buggier in the past than what you are proposing in this PR. So, maybe, we should let this in and see if the scenario I discussed is a problem to someone for real.

/approve

@openshift-ci
Copy link

openshift-ci bot commented Apr 26, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharmit

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Apr 26, 2022
@feloy
Copy link
Contributor Author

feloy commented Apr 26, 2022

Is the b.txt synced to the container?

Yes.

$ kubectl exec nodejs-app-9964cc475-94ct6 -c runtime -- cat /projects/b.txt
hello

As noted by @rm3l, this PR fixes the files that are synced to the container, but not particularly which files are triggering the sync.

OK, this makes a lot more sense now.

But if this is a regression, I will try and fix it as part of this PR

I don't know/remember how it behaved in the past. But I think it was buggier in the past than what you are proposing in this PR. So, maybe, we should let this in and see if the scenario I discussed is a problem to someone for real.

/approve

After some more tests, I think that modifying the .gitignore file is not supported during a dev session: the initial content will be used during all the session.

@rm3l
Copy link
Member

rm3l commented Apr 26, 2022

Is the b.txt synced to the container?

Yes.

$ kubectl exec nodejs-app-9964cc475-94ct6 -c runtime -- cat /projects/b.txt
hello

As noted by @rm3l, this PR fixes the files that are synced to the container, but not particularly which files are triggering the sync.

OK, this makes a lot more sense now.

But if this is a regression, I will try and fix it as part of this PR

I don't know/remember how it behaved in the past. But I think it was buggier in the past than what you are proposing in this PR. So, maybe, we should let this in and see if the scenario I discussed is a problem to someone for real.
/approve

After some more tests, I think that modifying the .gitignore file is not supported during a dev session: the initial content will be used during all the session.

I remember commenting about this issue in this other PR about odo dev and .gitignore files: #5572 (review)
Maybe we should create an issue to keep track of this, or document it somewhere as a known issue.

@feloy
Copy link
Contributor Author

feloy commented Apr 26, 2022

/override ci/prow/v4.10-integration-e2e

@openshift-ci
Copy link

openshift-ci bot commented Apr 26, 2022

@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.10-integration-e2e

In response to this:

/override ci/prow/v4.10-integration-e2e

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@feloy
Copy link
Contributor Author

feloy commented Apr 26, 2022

/override ci/prow/unit
Infra errors, IBM cloud tests pass

@openshift-ci
Copy link

openshift-ci bot commented Apr 26, 2022

@feloy: Overrode contexts on behalf of feloy: ci/prow/unit

In response to this:

/override ci/prow/unit
Infra errors, IBM cloud tests pass

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-merge-robot openshift-merge-robot merged commit e42d657 into redhat-developer:main Apr 26, 2022
cdrage pushed a commit to cdrage/odo that referenced this pull request Aug 31, 2022
* fix ignore files

* Add tests for synced files

* Use go-gitignore library

* rename topPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

odo doesn't honor directory .gitignore entries like /target
4 participants