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

[ISSUE 199] Log commit hash while describing checkout/merge #202

Closed
wants to merge 2 commits into from

Conversation

Ginxo
Copy link
Contributor

@Ginxo Ginxo commented Nov 17, 2021

Thank you for submitting this pull request

fix #199

Note: Please, do not check dist/index.js changes. It is automatically generated.

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}'`
Copy link
Contributor Author

@Ginxo Ginxo Nov 18, 2021

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);
Copy link
Contributor Author

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!

Copy link
Member

@danielezonca danielezonca left a 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",
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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/

Copy link
Contributor Author

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);
Copy link
Member

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.

Copy link
Contributor Author

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.

@Ginxo
Copy link
Contributor Author

Ginxo commented Feb 22, 2023

out of date

@Ginxo Ginxo closed this Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log commit hash while describing checkout/merge
2 participants