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

Add --sync-git-dir flag to odo dev #6910

Merged

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Jun 19, 2023

What type of PR is this:

/kind feature

What does this PR do / why we need it:

Which issue(s) this PR fixes:

Fixes #6893

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jun 19, 2023
@netlify
Copy link

netlify bot commented Jun 19, 2023

🔨 Deploy Preview deleted from internal cluster!

Name Link
🔨 Latest commit a8c8c35
😎 Deploy Preview https://odo-dev-pr-6910.odo-test-kubernetes-clust-49529fc6e6a4a9fe7ebba9a3db5b55c4-0000.eu-de.containers.appdomain.cloud/

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Jun 19, 2023
@openshift-ci openshift-ci bot requested review from kadel and valaparthvi June 19, 2023 08:21
@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

NoCluster Tests on commit c67a124 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

Windows Tests (OCP) on commit c67a124 finished with errors.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jun 19, 2023

OpenShift Tests on commit c67a124 finished with errors.
View logs: TXT HTML

@feloy feloy changed the title [wip] Add --sync-git-dir flag to odo dev Add --sync-git-dir flag to odo dev Jun 19, 2023
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jun 19, 2023
@feloy feloy requested review from rm3l and removed request for kadel June 19, 2023 11:02
@feloy feloy temporarily deployed to internal June 19, 2023 13:30 — with GitHub Actions Inactive
Copy link
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

One question that came to mind after quickly testing this: we might need to handle the case where a file matches a rule in .gitignore (or .odoignore) but is also present in the .git folder. For example:

$ odo init --name go-app --devfile go --starter go-starter
$ echo ".odo" >> .gitignore
$ git init && git add -A . && git commit -m "initial commit"

At this point, I have a local branch named 'main' with a single commit, but the .gitignore file also contains an entry matching 'main' as a file name:

$ cat .gitignore
.odo/env
.odo/odo-file-index.json
main
main.exe
.odo

$ find . -name main
./.git/refs/heads/main
./.git/logs/refs/heads/main

$ git log --oneline
4ca3c66 (HEAD -> main) initial commit

Now if I run odo dev --sync-git-dir, the .git folder is synchronized, but not its whole content, because of the rule in .gitignore, I guess:

$ odo dev --sync-git-dir --platform podman
...
$ podman container exec -it go-app-app-runtime git -C /projects log --oneline
fatal: your current branch 'main' does not have any commits yet

$ podman container exec -it go-app-app-runtime find /projects -name main
/projects/main

$ podman container exec -it go-app-app-runtime ls -lhrta /projects/.git/refs
total 0
drwxr-xr-x 1 default root   0 Jun 19 13:49 tags
drwxr-xr-x 1 default root   8 Jun 19 13:52 .
drwxr-xr-x 1 default root 144 Jun 19 13:53 ..

So I think we need to forcibly sync the whole content of the .git folder; otherwise, we might have inconsistent behavior with tools relying on Git.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 19, 2023
@feloy feloy temporarily deployed to internal June 20, 2023 07:47 — with GitHub Actions Inactive
@feloy feloy force-pushed the feature-6893/sync-git-dir branch from ac999a6 to c458d59 Compare June 20, 2023 07:51
@feloy feloy temporarily deployed to internal June 20, 2023 07:52 — with GitHub Actions Inactive
@feloy feloy force-pushed the feature-6893/sync-git-dir branch from c458d59 to a8c8c35 Compare June 20, 2023 07:53
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 20, 2023
@feloy feloy temporarily deployed to internal June 20, 2023 07:54 — with GitHub Actions Inactive
@sonarcloud
Copy link

sonarcloud bot commented Jun 20, 2023

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@feloy feloy requested a review from rm3l June 20, 2023 07:55
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jun 20, 2023
@feloy
Copy link
Contributor Author

feloy commented Jun 20, 2023

/override OpenShift-Integration-tests/OpenShift-Integration-tests

[FAILED] [423.110 seconds]
odo dev command tests when a component is bootstrapped when odo dev is executed and Ephemeral is set to false [BeforeEach] when killing odo dev and running odo delete component --wait should have deleted all resources before returning
  [BeforeEach] /go/odo_1/tests/integration/cmd_dev_test.go:561
  [It] /go/odo_1/tests/integration/cmd_dev_test.go:578
[...]
  [odo]  âš   AttachVolume.Attach failed for volume "pvc-10e113eb-35a1-40f8-af26-802958d7effb" : timed out waiting for external-attacher of vpc.block.csi.ibm.io CSI driver to attach volume r010-4f385e4e-e981-40a7-bcc7-18c24576249c

@openshift-ci
Copy link

openshift-ci bot commented Jun 20, 2023

@feloy: Overrode contexts on behalf of feloy: OpenShift-Integration-tests/OpenShift-Integration-tests

In response to this:

/override OpenShift-Integration-tests/OpenShift-Integration-tests

[FAILED] [423.110 seconds]
odo dev command tests when a component is bootstrapped when odo dev is executed and Ephemeral is set to false [BeforeEach] when killing odo dev and running odo delete component --wait should have deleted all resources before returning
 [BeforeEach] /go/odo_1/tests/integration/cmd_dev_test.go:561
 [It] /go/odo_1/tests/integration/cmd_dev_test.go:578
[...]
 [odo]  âš   AttachVolume.Attach failed for volume "pvc-10e113eb-35a1-40f8-af26-802958d7effb" : timed out waiting for external-attacher of vpc.block.csi.ibm.io CSI driver to attach volume r010-4f385e4e-e981-40a7-bcc7-18c24576249c

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 Jun 20, 2023

/override windows-integration-test/Windows-test

 [FAILED] [90.202 seconds]
odo describe/list binding command tests when creating a component with a binding as environment variables (service in namespace "binding-thl") when Starting a Pg service when running dev session [It] should list the binding - command: [list binding]
C:/Users/Administrator.ANSIBLE-TEST-VS/4191/tests/integration/cmd_describe_list_binding_test.go:765

  [odo] 	"message": "unable to access the cluster: Get \"https://c114-e.eu-de.containers.cloud.ibm.com:30329/apis/binding.operators.coreos.com/v1alpha1/namespaces/cmd-describe-list-binding-test765zox/servicebindings/my-nodejs-app-cluster-sample-k8s\": dial tcp 149.81.180.114:30329: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."
[FAILED] [549.337 seconds]
odo dev command tests when a component is bootstrapped when Automount volumes are present in the namespace when odo dev is executed [BeforeEach] should mount the volumes
  [BeforeEach] C:/Users/Administrator.ANSIBLE-TEST-VS/4191/tests/integration/cmd_dev_test.go:793
  [It] C:/Users/Administrator.ANSIBLE-TEST-VS/4191/tests/integration/cmd_dev_test.go:804

  [odo]  !  Unable to attach or mount volumes: unmounted volumes=[auto-pvc-automount-default-pvc], unattached volumes=[auto-secret-automount-default-secret auto-cm-automount-access-mode-configmap-decimal auto-secret-automount-mount-path-secret auto-pvc-automount-mount-path-pvc auto-secret-automount-subpath-secret auto-cm-automount-mount-path-configmap auto-pvc-automount-default-pvc kube-api-access-7mf45 auto-secret-automount-access-mode-subpath-secret odo-projects auto-cm-automount-subpath-configmap odo-shared-data auto-pvc-automount-readonly-pvc auto-cm-automount-access-mode-subpath-configmap auto-cm-automount-default-configmap auto-secret-automount-access-mode-secret auto-cm-automount-access-mode-configmap]: timed out waiting for the condition

@openshift-ci
Copy link

openshift-ci bot commented Jun 20, 2023

@feloy: Overrode contexts on behalf of feloy: windows-integration-test/Windows-test

In response to this:

/override windows-integration-test/Windows-test

[FAILED] [90.202 seconds]
odo describe/list binding command tests when creating a component with a binding as environment variables (service in namespace "binding-thl") when Starting a Pg service when running dev session [It] should list the binding - command: [list binding]
C:/Users/Administrator.ANSIBLE-TEST-VS/4191/tests/integration/cmd_describe_list_binding_test.go:765

 [odo] 	"message": "unable to access the cluster: Get \"https://c114-e.eu-de.containers.cloud.ibm.com:30329/apis/binding.operators.coreos.com/v1alpha1/namespaces/cmd-describe-list-binding-test765zox/servicebindings/my-nodejs-app-cluster-sample-k8s\": dial tcp 149.81.180.114:30329: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."
[FAILED] [549.337 seconds]
odo dev command tests when a component is bootstrapped when Automount volumes are present in the namespace when odo dev is executed [BeforeEach] should mount the volumes
 [BeforeEach] C:/Users/Administrator.ANSIBLE-TEST-VS/4191/tests/integration/cmd_dev_test.go:793
 [It] C:/Users/Administrator.ANSIBLE-TEST-VS/4191/tests/integration/cmd_dev_test.go:804

 [odo]  !  Unable to attach or mount volumes: unmounted volumes=[auto-pvc-automount-default-pvc], unattached volumes=[auto-secret-automount-default-secret auto-cm-automount-access-mode-configmap-decimal auto-secret-automount-mount-path-secret auto-pvc-automount-mount-path-pvc auto-secret-automount-subpath-secret auto-cm-automount-mount-path-configmap auto-pvc-automount-default-pvc kube-api-access-7mf45 auto-secret-automount-access-mode-subpath-secret odo-projects auto-cm-automount-subpath-configmap odo-shared-data auto-pvc-automount-readonly-pvc auto-cm-automount-access-mode-subpath-configmap auto-cm-automount-default-configmap auto-secret-automount-access-mode-secret auto-cm-automount-access-mode-configmap]: timed out waiting for the condition

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 50ba386 into redhat-developer:main Jun 20, 2023
23 checks passed
@openshift-merge-robot openshift-merge-robot temporarily deployed to internal June 20, 2023 14:26 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation 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.

include .git in syncing process
3 participants