rivy
January 24, 2021, 2:24am
1
I’m re/cross-posting this into GitLab CI/CD as it’s not seen any activity in the original HowTo...
location for the last two weeks.
I’m attempting a build on a repository with a private submodule, but I’m unable to get the runner to clone the repository.
Submodule 'source' (git@gitlab.com:rivy/blog.content.git) registered for path 'source'
Cloning into '/builds/rivy-t/blog._hexo_/source'...
error: cannot run ssh: No such file or directory
fatal: unable to fork
fatal: clone of 'git@gitlab.com:rivy/blog.content.git' into submodule path '/builds/rivy-t/blog._hexo_/source' failed
The other submodules seem to be cloning without issue.
I read the docs and tried various suggested methods even though the suggestion from the most recent docs is that since I own both repositories, it should “just work”. The repositories are under different organizations, so I added the original/builder repository organization (“rivy-t”) as a “developer” (and then “maintainer”) on the private submodule repository. But it’s still failing with the same error messages.
# .gitmodules
[submodule "source"]
path = source
url = git@gitlab.com:rivy/blog.content.git
[submodule "themes/landscape"]
path = themes/landscape
url = https://github.com/hexojs/hexo-theme-landscape
[submodule "themes/next"]
path = themes/next
url = https://github.com/theme-next/hexo-theme-next
[submodule "themes/octo"]
path = themes/octo
url = https://github.com/rivy/hexo-theme.octo.git
It does pull correctly for local machines.
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/hexo
image: node:12
variables:
# ref: <https://docs.gitlab.com/ee/ci/git_submodules.html#using-git-submodules-in-your-ci-jobs>
GIT_SUBMODULE_STRATEGY: recursive
# # gitlab to firebase
# # * see <https://medium.com/evenbit/automatically-deploy-to-firebase-with-gitlab-ci-546f194c44d8> @@ <https://archive.is/kFgZz>
# # * see <https://medium.com/@rambabusaravanan/firebase-hosting-deployment-automation-with-gitlab-ci-f3fad9130d62> @@ <http://archive.is/P670x>
# firebase:
# stage: deploy
# cache:
# key: "$CI_PROJECT_NAME;firebase"
# paths:
# - node_modules
# script:
# - npm install
# - ./node_modules/hexo/bin/hexo config criticalcss.enable false
# # firebase
# - ./node_modules/hexo/bin/hexo clean
# - ./node_modules/hexo/bin/hexo config root "/"
# - ./node_modules/hexo/bin/hexo generate
# - ./node_modules/hexo/bin/hexo gzip
# - ./node_modules/firebase-tools/lib/bin/firebase.js use t-hexo --token $FIREBASE_TOKEN
# - ./node_modules/firebase-tools/lib/bin/firebase.js deploy -m "$CI_PROJECT_PATH; pipeline $CI_PIPELINE_ID ($CI_PIPELINE_URL)" --non-interactive --token "$FIREBASE_TOKEN"
# artifacts:
# paths:
# - public
# only:
# - master
pages:
stage: deploy
cache:
key: "$CI_PROJECT_NAME;pages"
paths:
- node_modules
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
script:
- npm install
- ./node_modules/hexo/bin/hexo config criticalcss.enable false
# GitLab Pages
# * enable draft publishing (should only be enabled if GitLab Pages private-access-only is also enabled)
- ./node_modules/hexo/bin/hexo config render_drafts true
- ./node_modules/hexo/bin/hexo clean
- ./node_modules/hexo/bin/hexo config root "/${CI_PROJECT_NAME}/"
- ./node_modules/hexo/bin/hexo generate
- ./node_modules/hexo/bin/hexo gzip
artifacts:
paths:
- public
only:
- master
- x
I used this config successfully when the repository was a single unit previously. (The “firebase” deployment is planned to be tested and re-enabled once I can get the deployment to “pages” working correctly again.)
I’m not sure how to proceed. Advice on configuration changes?
Thanks for taking the time to look at this.
Any suggestions?
Hey @rivy ,
It seems that you have no ssh
executable on your runner (but you should be able to install it via a simple command). I assume that you are using gitlab.com runners. Per default the gitlab runners clone via https, not ssh. Maybe you can try to clone your source repo via https (like all the other submodules you have), so no ssh is required.
This would also explain why it works locally on your machine.
Did you try to run locally via the docker image?
Greetings
Michael
rivy
February 3, 2021, 10:46pm
3
Thanks for the reply…
I’ll work through your post suggestions and get back to you.
rivy
February 7, 2021, 8:30pm
4
I’ve had some time to look back into this and realized that I had already tried the suggested solutions.
Unfortunately, ssh
and the needed key installation is not particularly easy, and it’s a big security risk. HTTPS also doesn’t work well as it requires login information for private respositories, again difficult setup and a security risk.
I appreciate the suggestions.
I’m currently investigating access tokens.
Hey Rivy,
Did you end up resolving this issue with access tokens?
+1 Did anyone end up solving this?