-
Notifications
You must be signed in to change notification settings - Fork 24
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
[ISSUE 199] Log commit hash while describing checkout/merge #202
Conversation
logger.info( | ||
`[${node.project}] Merging ${context.config.github.serverUrl}/${node.project}:${checkoutInfo.targetBranch} into ${context.config.github.serverUrl}/${checkoutInfo.group}/${checkoutInfo.project}:${checkoutInfo.branch}` | ||
`[${node.project}] Checking out ${context.config.github.serverUrl}/${node.project}:${checkoutInfo.targetBranch} ${targetHash} and merging ${context.config.github.serverUrl}/${checkoutInfo.group}/${checkoutInfo.project}:${checkoutInfo.branch} ${sourceHash} into '${dir}'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielezonca if you don't want to check the whole thing just check the log information is the one expected. Be aware getRemoteSha
prefixes the hash with a @
Thanks
* @param {string} branch the branch to get the hash from | ||
*/ | ||
async function remoteSha(repositoryUrl, branch) { | ||
return await git(".", "ls-remote", repositoryUrl, branch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@almope do you think there is a better way to get hash from a remote repository? 🤔 thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, few minor comments :)
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@kie/build-chain-action", | |||
"version": "2.3.25", | |||
"version": "2.3.26", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the changelog mentions 2.6.2 while here is 2.3.26? Is it because the disalignment we discussed between branch/tag and actual version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is!
* | ||
* @param {string} repositoryUrl the repository URL | ||
* @param {string} branch the branch to get the hash from | ||
* @param {number} hashLength the length of hash to return back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to get the full hash without knowing the length? I quickly checked git documentation and it seems there are different ways to configure git hashing so I assume this can lead to different hash size
https://git-scm.com/docs/hash-function-transition/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me check the documentation
*/ | ||
async function getRemoteSha(repositoryUrl, branch, hashLength = 7) { | ||
try { | ||
const remoteHashValue = await git.remoteSha(repositoryUrl, branch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this code so I don't know if the question makes sense but is this invoking normal git CLI command or is it a GitHub remote API call?
I remember in the past we had failures related to the number of API call so I want to double check if this is increasing the number of calls we do or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is actually a very good question. This is executing the remoteSha
method from git.js
file which basically at the end executes the git CLI tool from the filesystem.
out of date |
Thank you for submitting this pull request
fix #199