Open maba2402 opened 3 weeks ago
Hi @maba2402 ,
could you please post your .gitlab-ci.yml
?
Without knowing your configuration, I can only speculate:
Example (pseudocode):
# .gitlab-ci.yml
variables:
GIT_DEPTH: 0
I looked a bit more into the details of my .gitlab-ci.yml and tried your proposal. Unfortunately, the situation is still the same. Here are the details.
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
GIT_DEPTH: 0
build-mkdocs:
stage: test
script:
- poetry run mkdocs build ${CI_MERGE_REQUEST_IID+--no-directory-urls}
artifacts:
expire_in: 3h
paths:
- site/
tags:
- DOCKER
Perhaps you could force a git pull
of your branch?:
# .gitlab-ci.yml
variables:
GIT_DEPTH: 0
build-mkdocs:
stage: test
script:
- git pull origin <insertyourbranch>
- git switch <insertyourbranch>
- git pull
- poetry run mkdocs build ${CI_MERGE_REQUEST_IID+--no-directory-urls}
Thanks a lot. That works.
Unfortunately, the proposed solution does not work with a Merge-Request based approach. I need to further investigate this issue.
It would be nice if you could detail the steps that lead to this error here.
The plugin is not working if executed by a gitlab runner. It crashes with the following exception:
ERROR - An exception of type TypeError occurred. Arguments: ("HEAD is a detached symbolic reference as it points to '26a5edb2cdae0a1b02f701cd6b2bc6cf5ef0cbff'",)
The problem can be traced back to the method get_recent_changes.
The line
branch = repo.active_branch
raises the exception.The problem is that in my case gitlab does not checkout a branch but works rather on a defined commit.
This problem has been discussed here #633