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

CachingProjectLoader should respect clone parameters #797

Merged
merged 12 commits into from
Feb 13, 2020

Conversation

timothysparg
Copy link
Contributor

Resolves #729

@timothysparg
Copy link
Contributor Author

@ddgenome Is this in line with what you were thinking?

@cdupuis
Copy link
Member

cdupuis commented Jan 3, 2020

I think what’s missing here is the entire set of loading parameters to be considered when using the cache key. Right now only a subset of parameters gets used when caching.

@timothysparg
Copy link
Contributor Author

ok, that makes sense. Let me rework this.

@cdupuis cdupuis added the auto-branch-delete:on-close Delete branch when pull request gets closed label Jan 22, 2020
@dansmithy dansmithy closed this Feb 10, 2020
@cdupuis cdupuis reopened this Feb 10, 2020
@cdupuis
Copy link
Member

cdupuis commented Feb 10, 2020

@timothysparg any chance to get his rebased?

@timothysparg
Copy link
Contributor Author

@cdupuis no problem, will do

@timothysparg
Copy link
Contributor Author

@cdupuis should be up to date with master again

@ddgenome
Copy link
Contributor

@timothysparg the manual edit of the package.json made it out of sync with the package-lock.json. You can verify by running npm ci.

$ npm ci
npm WARN prepare removing existing node_modules/ before installation
npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR!
npm ERR!
npm ERR! Invalid: lock file's @atomist/[email protected] does not satisfy @atomist/[email protected]
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /XXX/YY/.npm/_logs/2020-02-11T22_21_13_358Z-debug.log

Copy link
Contributor

@ddgenome ddgenome left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

The package-lock.json issue needs to be addressed. We may want to consider optimizing undefined/null clone option properties.

https://github.com/atomist/automation-client/blob/master/lib/spi/clone/DirectoryManager.ts

params.id.repo,
params.id.branch,
params.id.sha,
params.cloneOptions.keep,
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these are optional, we may have erroneous cache misses because this approach does not recognize, for example, that alwaysDeep having a value undefined or false is equivalent. This should only be a performance issue, so it could perhaps be addressed later.

Copy link
Contributor

@ddgenome ddgenome left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes, one issue remains.

Comment on lines 35 to 39
coerceUndefined(params?.cloneOptions?.keep),
coerceUndefined(params?.cloneOptions?.alwaysDeep),
coerceUndefined(params?.cloneOptions?.noSingleBranch),
coerceUndefined(params?.cloneOptions?.depth),
coerceUndefined(params?.cloneOptions?.detachHead),
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach would work for the boolean properties, but not for depth. Perhaps something more direct would be better:

params.cloneOptions?.keep || false,
params.cloneOptions?.alwaysDeep || false,
params.cloneOptions?.noSingleBranch || false,
params.cloneOptions?.depth || 1,
params.cloneOptions?.detachHead || false,

With defaults derived from the 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.

works for me, will update and revert.

Sanity check - It seems like we can assume in this context that cloneOptions will always be defined?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it isn't, the ?. will handle it.

Copy link
Contributor

@ddgenome ddgenome left a comment

Choose a reason for hiding this comment

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

Thanks!

@ddgenome ddgenome added the changelog:fixed Add this issue or pull request to fixed changelog section label Feb 13, 2020
@ddgenome ddgenome merged commit 16cc941 into atomist:master Feb 13, 2020
atomist bot pushed a commit that referenced this pull request Feb 13, 2020
[atomist:generated]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-branch-delete:on-close Delete branch when pull request gets closed changelog:fixed Add this issue or pull request to fixed changelog section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CloneOptions ignored when doWithProject reuses cloned project
4 participants