Not running from a Git Repository
Describe the bug
Sometimes when the semantic-release job is triggered I have an error saying that I'm not running the semantic-release command from a Git repository. Restarting the job (may be multiple times) solve the issue.
Expected behavior
The semantic-release should work without this issue each run
Logs and/or screenshots
[0KRunning with gitlab-runner 15.8.1 (f86890c6)[0;m
[0K on dt-gitlabext-runstd01n-prod gUxv-ice, system ID: s_93ad3813ab71[0;m
[0K feature flags: FF_NETWORK_PER_BUILD:true[0;m
section_start:1677148300:prepare_executor
[0K[0K[36;1mPreparing the "docker" executor[0;m[0;m
[0KUsing Docker executor with image node:19.6.1 ...[0;m
[0KPulling docker image node:19.6.1 ...[0;m
[0KUsing docker image sha256:b2604a913772e2b73b0e8b3078a388410e5e05b2f61c3aa71fecbafe013b71d7 for node:19.6.1 with digest node@sha256:d82f1c3ab27a01bd49f963ff4d24ef868852da6d3780d9d42e93b03f4fa3f62a ...[0;m
section_end:1677148302:prepare_executor
[0Ksection_start:1677148302:prepare_script
[0K[0K[36;1mPreparing environment[0;m[0;m
Running on runner-guxv-ice-project-1412-concurrent-0 via dt-gitlabext-runstd01n-prod.dtgep.cloud-lab.620nm.net...
section_end:1677148303:prepare_script
[0Ksection_start:1677148303:get_sources
[0K[0K[36;1mGetting source from Git repository[0;m[0;m
[32;1mFetching changes...[0;m
Reinitialized existing Git repository in /builds/networkLocation/network-location-batch/.git/
[32;1mChecking out 1681d811 as master...[0;m
Removing .releaserc
Removing install-man-page.sh
Removing yq.1
[32;1mSkipping Git submodules setup[0;m
section_end:1677148304:get_sources
[0Ksection_start:1677148304:restore_cache
[0K[0K[36;1mRestoring cache[0;m[0;m
[32;1mChecking cache for master-SEMREL-protected...[0;m
cache.zip is up to date [0;m
[32;1mSuccessfully extracted cache[0;m
section_end:1677148305:restore_cache
[0Ksection_start:1677148305:step_script
[0K[0K[36;1mExecuting "step_script" stage of the job script[0;m[0;m
[0KUsing docker image sha256:b2604a913772e2b73b0e8b3078a388410e5e05b2f61c3aa71fecbafe013b71d7 for node:19.6.1 with digest node@sha256:d82f1c3ab27a01bd49f963ff4d24ef868852da6d3780d9d42e93b03f4fa3f62a ...[0;m
[32;1m$ # BEGSCRIPT # collapsed multi-line command[0;m
[32;1m$ install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"[0;m
[32;1m$ cd "${SEMREL_CONFIG_DIR}"[0;m
[32;1m$ install_yd "yq_linux_amd64" "v4.21.1"[0;m
--2023-02-23 10:31:46-- https://github.com/mikefarah/yq/releases/download/v4.21.1/yq_linux_amd64.tar.gz
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/43225113/289e050e-7dba-4cc9-a2b9-3d5352db2b97?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230223%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230223T103146Z&X-Amz-Expires=300&X-Amz-Signature=2a2b8e1538d996506d584e031a745544322d3dfa7da25b011dd16d46d453cd0a&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=43225113&response-content-disposition=attachment%3B%20filename%3Dyq_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2023-02-23 10:31:46-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/43225113/289e050e-7dba-4cc9-a2b9-3d5352db2b97?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230223%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230223T103146Z&X-Amz-Expires=300&X-Amz-Signature=2a2b8e1538d996506d584e031a745544322d3dfa7da25b011dd16d46d453cd0a&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=43225113&response-content-disposition=attachment%3B%20filename%3Dyq_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5162373 (4.9M) [application/octet-stream]
Saving to: 'STDOUT'
0K .......... .......... .......... .......... .......... 0% 5.24M 1s
50K .......... .......... .......... .......... .......... 1% 4.76M 1s
100K .......... .......... .......... .......... .......... 2% 11.6M 1s
150K .......... .......... .......... .......... .......... 3% 6.27M 1s
200K .......... .......... .......... .......... .......... 4% 28.7M 1s
250K .......... .......... .......... .......... .......... 5% 6.03M 1s
300K .......... .......... .......... .......... .......... 6% 9.70M 1s
350K .......... .......... .......... .......... .......... 7% 12.6M 1s
400K .......... .......... .......... .......... .......... 8% 7.91M 1s
450K .......... .......... .......... .......... .......... 9% 16.6M 1s
500K .......... .......... .......... .......... .......... 10% 8.48M 1s
550K .......... .......... .......... .......... .......... 11% 12.4M 1s
600K .......... .......... .......... .......... .......... 12% 9.13M 1s
650K .......... .......... .......... .......... .......... 13% 9.76M 0s
700K .......... .......... .......... .......... .......... 14% 23.2M 0s
750K .......... .......... .......... .......... .......... 15% 21.3M 0s
800K .......... .......... .......... .......... .......... 16% 5.40M 0s
850K .......... .......... .......... .......... .......... 17% 22.7M 0s
900K .......... .......... .......... .......... .......... 18% 5.56M 0s
950K .......... .......... .......... .......... .......... 19% 16.9M 0s
1000K .......... .......... .......... .......... .......... 20% 29.9M 0s
1050K .......... .......... .......... .......... .......... 21% 3.90M 0s
1100K .......... .......... .......... .......... .......... 22% 4.90M 0s
1150K .......... .......... .......... .......... .......... 23% 194M 0s
1200K .......... .......... .......... .......... .......... 24% 22.3M 0s
1250K .......... .......... .......... .......... .......... 25% 4.40M 0s
1300K .......... .......... .......... .......... .......... 26% 9.65M 0s
1350K .......... .......... .......... .......... .......... 27% 77.8M 0s
1400K .......... .......... .......... .......... .......... 28% 8.94M 0s
1450K .......... .......... .......... .......... .......... 29% 22.2M 0s
1500K .......... .......... .......... .......... .......... 30% 10.6M 0s
1550K .......... .......... .......... .......... .......... 31% 10.7M 0s
1600K .......... .......... .......... .......... .......... 32% 9.95M 0s
1650K .......... .......... .......... .......... .......... 33% 15.3M 0s
1700K .......... .......... .......... .......... .......... 34% 8.08M 0s
1750K .......... .......... .......... .......... .......... 35% 31.8M 0s
1800K .......... .......... .......... .......... .......... 36% 8.95M 0s
1850K .......... .......... .......... .......... .......... 37% 21.2M 0s
1900K .......... .......... .......... .......... .......... 38% 24.6M 0s
1950K .......... .......... .......... .......... .......... 39% 9.70M 0s
2000K .......... .......... .......... .......... .......... 40% 28.4M 0s
2050K .......... .......... .......... .......... .......... 41% 14.8M 0s
2100K .......... .......... .......... .......... .......... 42% 29.3M 0s
2150K .......... .......... .......... .......... .......... 43% 12.5M 0s
2200K .......... .......... .......... .......... .......... 44% 2.65M 0s
2250K .......... .......... .......... .......... .......... 45% 7.59M 0s
2300K .......... .......... .......... .......... .......... 46% 9.42M 0s
2350K .......... .......... .......... .......... .......... 47% 26.0M 0s
2400K .......... .......... .......... .......... .......... 48% 278M 0s
2450K .......... .......... .......... .......... .......... 49% 7.97M 0s
2500K .......... .......... .......... .......... .......... 50% 3.37M 0s
2550K .......... .......... .......... .......... .......... 51% 8.29M 0s
2600K .......... .......... .......... .......... .......... 52% 7.60M 0s
2650K .......... .......... .......... .......... .......... 53% 9.48M 0s
2700K .......... .......... .......... .......... .......... 54% 10.9M 0s
2750K .......... .......... .......... .......... .......... 55% 12.5M 0s
2800K .......... .......... .......... .......... .......... 56% 4.26M 0s
2850K .......... .......... .......... .......... .......... 57% 16.8M 0s
2900K .......... .......... .......... .......... .......... 58% 18.3M 0s
2950K .......... .......... .......... .......... .......... 59% 26.8M 0s
3000K .......... .......... .......... .......... .......... 60% 6.17M 0s
3050K .......... .......... .......... .......... .......... 61% 5.46M 0s
3100K .......... .......... .......... .......... .......... 62% 18.8M 0s
3150K .......... .......... .......... .......... .......... 63% 4.25M 0s
3200K .......... .......... .......... .......... .......... 64% 4.98M 0s
3250K .......... .......... .......... .......... .......... 65% 4.95M 0s
3300K .......... .......... .......... .......... .......... 66% 6.77M 0s
3350K .......... .......... .......... .......... .......... 67% 5.11M 0s
3400K .......... .......... .......... .......... .......... 68% 41.4M 0s
3450K .......... .......... .......... .......... .......... 69% 5.70M 0s
3500K .......... .......... .......... .......... .......... 70% 5.68M 0s
3550K .......... .......... .......... .......... .......... 71% 16.6M 0s
3600K .......... .......... .......... .......... .......... 72% 6.60M 0s
3650K .......... .......... .......... .......... .......... 73% 12.4M 0s
3700K .......... .......... .......... .......... .......... 74% 7.52M 0s
3750K .......... .......... .......... .......... .......... 75% 8.49M 0s
3800K .......... .......... .......... .......... .......... 76% 8.63M 0s
3850K .......... .......... .......... .......... .......... 77% 18.7M 0s
3900K .......... .......... .......... .......... .......... 78% 11.7M 0s
3950K .......... .......... .......... .......... .......... 79% 14.4M 0s
4000K .......... .......... .......... .......... .......... 80% 16.8M 0s
4050K .......... .......... .......... .......... .......... 81% 13.0M 0s
4100K .......... .......... .......... .......... .......... 82% 20.5M 0s
4150K .......... .......... .......... .......... .......... 83% 27.7M 0s
4200K .......... .......... .......... .......... .......... 84% 14.5M 0s
4250K .......... .......... .......... .......... .......... 85% 14.8M 0s
4300K .......... .......... .......... .......... .......... 86% 21.3M 0s
4350K .......... .......... .......... .......... .......... 87% 11.5M 0s
4400K .......... .......... .......... .......... .......... 88% 52.6M 0s
4450K .......... .......... .......... .......... .......... 89% 13.4M 0s
4500K .......... .......... .......... .......... .......... 90% 19.4M 0s
4550K .......... .......... .......... .......... .......... 91% 12.3M 0s
4600K .......... .......... .......... .......... .......... 92% 24.3M 0s
4650K .......... .......... .......... .......... .......... 93% 16.6M 0s
4700K .......... .......... .......... .......... .......... 94% 33.4M 0s
4750K .......... .......... .......... .......... .......... 95% 14.6M 0s
4800K .......... .......... .......... .......... .......... 96% 16.5M 0s
4850K .......... .......... .......... .......... .......... 97% 32.3M 0s
4900K .......... .......... .......... .......... .......... 98% 18.5M 0s
4950K .......... .......... .......... .......... .......... 99% 21.2M 0s
5000K .......... .......... .......... .......... . 100% 11.1M=0.5s
2023-02-23 10:31:47 (10.0 MB/s) - written to stdout [5162373/5162373]
[32;1m$ prepare_semantic_release[0;m
[[1;94mINFO[0m] semantic release configuration file not found, generating default [33;1m.releaserc[0m
debug: false
tagFormat: 'network-location-batch-${version}'
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
- '@semantic-release/gitlab'
- '@semantic-release/changelog'
- '@semantic-release/git'
branches:
- 'master'
- 'main'
[32;1m$ configure_commit_signing[0;m
[[1;94mINFO[0m] No GPG key provided.
[32;1m$ install_semantic_release_plugins[0;m
[[1;94mINFO[0m] installing required plugins
added 609 packages in 26s
79 packages are looking for funding
run `npm fund` for details
[32;1m$ semantic-release --ci ${SEMREL_DRY_RUN+-d}[0;m
[10:32:14 AM] [semantic-release] › ℹ Running semantic-release version 20.1.0
(node:62) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/git"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/git"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/gitlab"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/gitlab"
[10:32:15 AM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/gitlab"
[10:32:15 AM] [semantic-release] › ℹ Start step "fail" of plugin "@semantic-release/gitlab"
[10:32:15 AM] [semantic-release] [@semantic-release/gitlab] › ℹ Verify GitLab authentication (https://sourcehub.orange-business.com/api/v4)
[10:32:16 AM] [semantic-release] › ✘ Failed step "fail" of plugin "@semantic-release/gitlab"
[10:32:16 AM] [semantic-release] › ✘ An error occurred while running semantic-release: TypeError: Cannot read properties of undefined (reading 'name')
at default (file:///usr/local/lib/node_modules/@semantic-release/gitlab/lib/get-fail-comment.js:20:10)
at default (file:///usr/local/lib/node_modules/@semantic-release/gitlab/lib/fail.js:29:83)
at fail (file:///usr/local/lib/node_modules/@semantic-release/gitlab/index.js:39:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async validator (file:///usr/local/lib/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
at async file:///usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
at async file:///usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:31:3
at async pluginsConfigAccumulator.<computed> [as fail] (file:///usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:87:11)
at async callFail (file:///usr/local/lib/node_modules/semantic-release/index.js:249:7)
at async Module.default (file:///usr/local/lib/node_modules/semantic-release/index.js:279:7) {
pluginName: '@semantic-release/gitlab'
}
[10:32:16 AM] [semantic-release] › ✘ ENOGITREPO Not running from a git repository.
The semantic-release command must be executed from a Git repository.
The current working directory is /builds/networkLocation/network-location-batch.
Please verify your CI configuration to make sure the semantic-release command is executed from the root of the cloned repository.
AggregateError:
SemanticReleaseError: Not running from a git repository.
at default (file:///usr/local/lib/node_modules/semantic-release/lib/get-error.js:6:10)
at default (file:///usr/local/lib/node_modules/semantic-release/lib/verify.js:15:17)
at async run (file:///usr/local/lib/node_modules/semantic-release/index.js:65:3)
at async Module.default (file:///usr/local/lib/node_modules/semantic-release/index.js:275:22)
at async default (file:///usr/local/lib/node_modules/semantic-release/cli.js:55:5)
at default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/lib/verify.js:41:11)
[90m at process.processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
at async run (file:///usr/local/lib/node_modules/[4msemantic-release[24m/index.js:65:3)
at async Module.default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/index.js:275:22)
at async default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/cli.js:55:5) {
errors: [
SemanticReleaseError: Not running from a git repository.
at default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/lib/get-error.js:6:10)
at default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/lib/verify.js:15:17)
[90m at process.processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
at async run (file:///usr/local/lib/node_modules/[4msemantic-release[24m/index.js:65:3)
at async Module.default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/index.js:275:22)
at async default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/cli.js:55:5) {
code: [32m'ENOGITREPO'[39m,
details: [32m'The `semantic-release` command must be executed from a Git repository.\n'[39m +
[32m'\n'[39m +
[32m'The current working directory is `/builds/networkLocation/network-location-batch`.\n'[39m +
[32m'\n'[39m +
[32m'Please verify your CI configuration to make sure the `semantic-release` command is executed from the root of the cloned repository.'[39m,
semanticRelease: [33mtrue[39m
}
]
}section_end:1677148336:step_script
[0Ksection_start:1677148336:cleanup_file_variables
[0K[0K[36;1mCleaning up project directory and file based variables[0;m[0;m
section_end:1677148337:cleanup_file_variables
[0K[31;1mERROR: Job failed: exit code 1
[0;m
Context & Configuration
I think the issue may have appeared recently (in recent semantic-release versions), but we can't specify the semantic-release version (see this issue) so we can't realy confirm or deny this hypothesis.
This issue has been recently talked on semantic-release github repository here and specifically here about to-be-continuous.
The issue was reproduced using:
- Version of the template: 3.2.1
- GitLab server(s): (Orange instance)
- GitLab runner(s): (15.8.1)
Here is the .gitlab-ci.yml
file:
variables:
#SEMANTIC-RELEASE
SEMREL_IMAGE: "node:19.6.1"
SEMREL_TAG_FORMAT: "$CI_PROJECT_NAME-$${version}"
SEMREL_CHANGELOG_ENABLED: 'true'
SEMREL_AUTO_RELEASE_ENABLED: 'true'
SEMREL_INFO_ON: 'prod'
Edited by Xavier FRANCOIS