How to embed src file in a wiki in Gitlab/Github? - gitlab

I have a doc folder in my project (in Gitlab) which contains documentation generated using jsdoc. This documentation is generated at build time.
What I want to do now is to embed the resulting index.html file in a wiki, so that on each build, the wiki is automatically updated.
Is there a way to do this?

You can clone your GLitab wiki locally.
That means, after each local build, you can add one step to your build in order to modify and embed the content of the generate files (here the resulting index.html), then add, commit and push back to your GitLab wiki.
As the OP tigermarques adds in the comments:
The only extra thing I had to do was to rename the .html file to either .md or .txt so that Gitlab would show it on the Wiki page list.

Related

Link to project's GitLab pages from README

I'd like to insert into the README.md file a link to the project's GitLab pages URL without hardcoding it.
Something like:
Visit the project's [pages site]($PROJECT_NAME_PAGES_URL)
instead of
Visit the project's [pages site](https://namespace.gitlab.io/project-name)
Is it possible?
No, GitLab-flavored markdown does not support any variables/substitutions like this. There are some cases where special gitlab references are allowed, but the GitLab pages URL is not one of them.
The only workaround might be to have a CI job that parses a readme template and updates the README.md on changes, obtaining the pages url from the predefined CI variable $CI_PAGES_URL -- something like what is described in this answer to a similar question.

Linking Doxygen files that are generated by Gitlab pipeline to adoc file

What I am trying to do is to link a documentation made by Doxygen to a file written in adoc format. I was able to do so when everything was on my Desktop. I used:
link:path/to/documentation/_my_file_name_8c.html[link name to appear]
But now since the adoc file is on Gitlab and also the Doxygen documentation is generated in the pipeline (I am not fully aware of this process). I can't find a way to refer to the Doxygen documentation.
Is there a known way to do so? I need to be able to click on a link in adoc to go to the doxygen HTML file.

How to connect asciidoc with source code in gitlab?

I manage my Spring Boot project with Gitlab. (git#gitlab.com:user/project.git).
I keep the documentation in the separate wiki project provided by Gitlab. (so git#gitlab.com:user/project.wiki.git).
Now I want to refer directly from the documentation to the source code in the project and list code snippets for explanation. This way the code would always be up-to-date and you would only have to adapt the explanation if necessary. But how can I link from the wiki project to a remote file? To give an example, this is how it should look later on.
[source,java]
----
include:: https://gitlab.com/user/project/-/raw/master/src/main/java/de/mycompany/project/ProjectApp.java[]
----
asciidoctor doesn't provide a way to perform remote includes: all include content has to be in the local filesystem.
If you use asciidoctor.js, you could use this extension: https://github.com/feelpp/asciidoctor-remote-include-processor
Otherwise, you could use some form of build coordination, such as make, Ant, etc. to fetch the remote content to a known local location, update your Asciidoc document(s) to include the now-local location, and then run asciidoctor.

How do I get all files (paths) of a specific commit from gitlab api?

I want to load the file contents from the gitlab api using a specific tag.
This can be achieved by using the blob for each file (https://docs.gitlab.com/ee/api/repository_files.html).
The problem I am facing is that I do not see the way to find out what file paths are available for a given commit (a tag in my case).
I am looking for something similar to github's tree object.
How do I get all the files and their respective paths with a given commit hash from the gitlab api to load their contents?
Thanks :)
You can get a list of repository files and directories in a project by calling this API:
GET /projects/:id/repository/tree
See here for more information such as optional parameters.

Could not push .dll file into GitLab

I have faced the error
remote: Hello there! We have restricted the binary files (.exe, .dll, .zip, .7z, .deb, .cab, .gz, .pkg, .iso) that are pushed into GitLab.
while try to push the .dll file into GitLab.
I tried to remove the .dll file type from the git ignore file list but i could not find the document gitignore_global.txt which is directory was represented in,
Gitlab: Tools->Options->Git tab->Edit file.
Kindly let me know If the document was not present then where from the ignore-able list was get and how can i skip .dll files from those list.
Unless you are running your own server (and the admins, if not you, change the push rules), you won't be able to push any of those file types. Those 9 are selected since generally those are very large files and shouldn't be stored in git.
If you run your own Gitlab server though, and absolutely need to store the .dll file in git, you can adjust the push rules in the Admin area. See the docs here: https://docs.gitlab.com/ee/push_rules/push_rules.html#enabling-push-rules

Resources