question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: OpenSearch Dashboards register git hook failure due to git version

See original GitHub issue

Describe the bug

While adding a Jenkins file and attempting to run a pipeline, the build is failing.

What is happening is that the build script will yarn osd bootstrap into the OpenSearch Dashboards repo. This will call node scripts/osd with the arg bootstrapthis will eventually run node ./preinstall_check which then succeeds. But will then it will iterate through all the packages attempting to bootstrap. While iterating through each package it checks the package.json file for a script osd:bootstrap and executes that script.

However, when it gets to doing [opensearch-dashboards] it attempts to run the [osd:bootstrap] script, which actually is node scripts/build_ts_refs && node scripts/register_git_hook, and fails on the register_git_hook script.

It is failing on the register_git_hook script because the script calls packages/osd-dev-utils/src/precommit_hook/cli.ts and in that script there is a call to packages/osd-dev-utils/src/precommit_hook/get_git_dir.ts. Here a git command is executed: git rev-parse --get-common-dir. This is where the failure occurs.

Locally and other Jenkins environments, git rev-parse --git-common-dir would return .git in the current staging Jenkins environment. git rev-parse --git-common-dir is not returning anything besides just --git-common-dir. Then the buid script attempts to find OpenSearch-Dashboards/--git-common-dir/hooks/pre-commit' when it should be looking for OpenSearch-Dashboards/.git/hooks/pre-commit’ and fails on a file not found exception.

To reproduce

Run build script on Jenkins.

Expected behavior

Even though this register git hook is pointless in our build process, it should succeed on accessing the git-common-dir and thus allow registering git hook and successfully building.

Screenshots

n/a

Host / Environment

git version of working local environment: 2.25.1 git version of working Jenkins environment: 2.17.1 git version of NON-working Jenkins environment: 2.32.0

Additional context

Although git hooks have no place in the build process removing the register git hook from osd:bootstrap will have significant impact on the developer experience. So I don’t recommend just removing it.

We can also create a new build script but it will require code updates and I believe the correct decision is to figure out why --git-common-dir fails in the current Jenkins environment so we can keep most of the code intact.

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kavillacommented, Oct 6, 2021

Update: this is a git related issue.

Dashboards requires a specific versions of git otherwise it will fail. I don’t think it’s appropriate to fail hard because of git version so this should be handled in the Dashboards repo and I believe it should succeed with error messages.

@opensearch-project/admin can you transfer this to https://github.com/opensearch-project/OpenSearch-Dashboards

0reactions
peterzhuamazoncommented, Oct 6, 2021

check bundle-workflow/Jenkinsfile for reference there. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Search - GitLab Docs
You can use Advanced Search for faster, more efficient search across the entire GitLab instance. Advanced Search is based on Elasticsearch, a purpose-built ......
Read more >
Source Code - OpenSearch
Open source distributed and RESTful search engine. Contributing Developer Guide · OpenSearch Dashboards. Open source visualization dashboards for OpenSearch.
Read more >
Miscellaneous | Bitbucket Data Center and Server KB
Bitbucket fails to start with UnsatisfiedLinkError, failed to map segment from shared object. Bitbucket Mesh - Sideband channel died · Bitbucket Server: Cannot ......
Read more >
How we use Git and GitHub | Kibana Guide [8.5] - Elastic
! [rejected] name-of-your-branch -> name-of-your-branch (non-fast-forward) error: failed to push some refs to 'https://github.com/YourGitHubHandle/kibana.git' ...
Read more >
GIT: error: pathspec 'xxx did not match any file(s) known to git
I often have this problem if something has changed, added files to gitignore or something else. Maybe you have to rebuild the index....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found