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

Adds dev.odo.push.path attribute support for pushing only mentioned files #4588

Merged
merged 2 commits into from
May 11, 2021

Conversation

mik-dass
Copy link
Contributor

@mik-dass mik-dass commented Apr 6, 2021

What type of PR is this?

/kind feature

What does does this PR do / why we need it:

It uses the dev.odo.push.path attribute to push only the mentioned files.

Which issue(s) this PR fixes:

Fixes #3132

PR acceptance criteria:

How to test changes / Special notes to the reviewer:

  • Use the attribute dev.odo.push.path:<local-path>:<remote-path> in the run command to mark the files/folders which should be pushed inside the container.
  • Execute odo push
  • Use to kubectl exec to check if the required file/folders are present inside the container and their location.

@openshift-ci-robot openshift-ci-robot 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 Apr 6, 2021
@openshift-ci-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Apr 6, 2021
@mik-dass mik-dass changed the title Adds dev.odo.push.file attribute support for pushing only mentioned f… Adds dev.odo.push.file attribute support for pushing only mentioned files Apr 6, 2021
@mik-dass mik-dass force-pushed the odo_push_dev branch 2 times, most recently from 074cfc7 to f9ee1de Compare April 9, 2021 16:38
@mik-dass mik-dass changed the title Adds dev.odo.push.file attribute support for pushing only mentioned files [WIP] Adds dev.odo.push.file attribute support for pushing only mentioned files Apr 9, 2021
@mik-dass mik-dass marked this pull request as ready for review April 9, 2021 16:40
@mik-dass mik-dass force-pushed the odo_push_dev branch 2 times, most recently from 455dec1 to c3b6667 Compare April 14, 2021 15:10
@@ -173,6 +170,37 @@ func (a Adapter) SyncFiles(syncParameters common.SyncParameters) (isPushRequired
return true, nil
}

// TODO remove if no required
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant if not required. Currently the PR is WIP so I am testing out certain things.

@@ -302,3 +307,311 @@ func WriteFile(newFileMap map[string]FileData, resolvedPath string) error {

return err
}

func RunIndexWithRemote(directory string, ignoreRules []string, remoteDirectories map[string]string) (ret IndexerRet, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see common things between RunIndex and this function, can we consider writing a nice struct and follow a design pattern? maybe extract some functions from this..?

Copy link
Contributor

Choose a reason for hiding this comment

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

I can suggest a structure, but tomorrow. Need to understand a bit of this code 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Current the PR is WIP and I am trying out certain things. Once ready, I will probably remove RunIndex.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you planning to remove the RunIndex function? because still there seem to be common code between the functions?

Copy link
Contributor Author

@mik-dass mik-dass May 7, 2021

Choose a reason for hiding this comment

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

No, I am currently not planning to remove the RunIndex function. I was thinking of leaving it untouched for s2i components for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

/hold cancel

return ret, nil
}

func recursive(directory, srcBase, srcFile, destBase, destFile string, ignoreRules []string, remoteDirectories map[string]string, existingFileIndex FileIndex, fs filesystem.Filesystem) (IndexerRet, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

comments for this function? and also too many arguments passed, can we reduce them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I will reduce them.

@@ -243,3 +245,736 @@ func TestGenerateNewFileDataEntry(t *testing.T) {
})
}
}

func Test_recursive(t *testing.T) {
fs := filesystem.DefaultFs{}
Copy link
Contributor

Choose a reason for hiding this comment

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

why not consider using the memory mapped Fs here? afero one.

Copy link
Contributor Author

@mik-dass mik-dass Apr 14, 2021

Choose a reason for hiding this comment

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

The function currently uses filepath.Glob() which uses os.Lstat() internally. The library afero doesn't provide an implementation for filepath.Glob() as of now. Thus using the DefaultFs for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool

@mik-dass mik-dass force-pushed the odo_push_dev branch 3 times, most recently from 89d4226 to aefc708 Compare April 15, 2021 16:38
@mik-dass mik-dass force-pushed the odo_push_dev branch 3 times, most recently from 90bd5f1 to 5e71e7e Compare April 23, 2021 13:12
@mohammedzee1000 mohammedzee1000 changed the base branch from master to main April 28, 2021 08:44
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mik-dass

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

@mik-dass mik-dass changed the title [WIP] Adds dev.odo.push.file attribute support for pushing only mentioned files Adds dev.odo.push.file attribute support for pushing only mentioned files Apr 28, 2021
@openshift-ci-robot openshift-ci-robot 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 Apr 28, 2021
@prietyc123
Copy link
Contributor

/test psi-kubernetes-integration-e2e

@mik-dass mik-dass changed the title Adds dev.odo.push.file attribute support for pushing only mentioned files Adds dev.odo.push.path attribute support for pushing only mentioned files Apr 28, 2021
@mik-dass mik-dass removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label May 3, 2021
@kadel
Copy link
Member

kadel commented May 4, 2021

I have done some testing with quarkus and it works great.

I just noticed that if the local directory or file specified in annotation doesn't exist odo doesn't error out.
It should probably do that. I made this mistake, and it took me a while to until I figured out what was happening.

@mik-dass
Copy link
Contributor Author

mik-dass commented May 5, 2021

I just noticed that if the local directory or file specified in annotation doesn't exist odo doesn't error out.

I have changed the code to return an error in such an scenario.

@mik-dass
Copy link
Contributor Author

mik-dass commented May 6, 2021

ERRO[2021-05-05T14:44:24Z]   * could not run steps: step integration-e2e failed: "integration-e2e" post steps failed: "integration-e2e" pod "integration-e2e-ipi-deprovision-deprovision" failed: the pod ci-op-yhxhtbdc/integration-e2e-ipi-deprovision-deprovision failed after 31m33s (failed containers: test): ContainerFailed one or more containers exited 
ERRO[2021-05-05T14:44:24Z] Container test exited with code 1, reason Error 

/retest

@girishramnani
Copy link
Contributor

/hold

need to get this comment addressed #4588 (comment)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label May 6, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mik-dass

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 removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label May 10, 2021
@girishramnani
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label May 10, 2021
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci
Copy link

openshift-ci bot commented May 10, 2021

@mik-dass: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/psi-openshift-integration-e2e 455dec1 link /test psi-openshift-integration-e2e
ci/prow/psi-minishift-integration-e2e 455dec1 link /test psi-minishift-integration-e2e

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

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. 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.

control over how rsync and start/stop happens
7 participants