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

Getting an 'empty' output with Vue.js as part of Jenkins build #34

Open
jaw111 opened this issue Nov 3, 2023 · 3 comments
Open

Getting an 'empty' output with Vue.js as part of Jenkins build #34

jaw111 opened this issue Nov 3, 2023 · 3 comments

Comments

@jaw111
Copy link

jaw111 commented Nov 3, 2023

I'm following the approach mentioned on https://stackoverflow.com/a/59951577/21503085

When I run my application locally, it works OK.
However, when the build is run with vue-cli-service build in our Jenkins CI/CD process then the commit hash is not picked up.

To help debug, I logged the output from gitDescribeSync() call:

{"dirty":false,"raw":"","hash":"","distance":null,"tag":null,"semver":null,"suffix":"","semverString":null}

I tried variations like gitDescribeSync(__dirname) and gitDescribeSync(__dirname, { match: '[0-9]*' }) without success.

I assume this is not a bug in this project, more something to do with how vue-cli-service works, but hoping someone can give some help/guidance how to make it work.

@TimothyJones
Copy link
Collaborator

Are you doing a full checkout on your CI? Most CI does a shallow checkout of a single commit by default

@jaw111
Copy link
Author

jaw111 commented Nov 3, 2023

I guess that is it. I see the git fetch has the --no-tags option.

@jaw111
Copy link
Author

jaw111 commented Nov 3, 2023

Seems to be a bit more subtle than I thought.

We're running Jenkins in AWS EKS and there is some issue JENKINS-30600 whereby the git checkout is run in the remoting container, not the build container.

When we try to run git describe inside the build container, we then see the following:

+ git describe --match [0-9]*
fatal: detected dubious ownership in repository at '/home/jenkins/agent/workspace/_my-project_develop'
To add an exception for this directory, call:

	git config --global --add safe.directory /home/jenkins/agent/workspace/_my-project_develop

Which seems to be a feature where Git now checks for ownership of the folder.

If I add the exception, then everything works OK, but I'm puzzled why gitDescribeSync() doesn't crash and burn if the underlying command is throwing a fatal error.

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

No branches or pull requests

2 participants