Gitlab notes
From raju
dummy
repository url
Sample repository url
https://gitlab.com/<user>/<project>.git git@gitlab.com:<user>/<project>.git
password less cloning of repository only works with SSH. For example
git clone git@gitlab.com:<user>/<project>.git
If the repository is already checked out via HTTPS and you want to change it to SSH
git remote set-url origin git@gitlab.com:<user>/<project>.git
tips
- To disable markup formatting in the issue tracker, enclose the text in <pre> and </pre> tags
generate new recovery codes with an ssh key
ssh git@gitlab.com 2fa_recovery_codes
See (2) in https://about.gitlab.com/2018/08/09/keeping-your-account-safe/
test ssh connection
ssh -T git@gitlab.com
highlight variable names in merge request discussions
Enclosing the variable names with ` ` will highlight them.
which gitlab version am I running
login into gitlab -> click the help button on top right -> help
you can also go directly to https://gitlab.com/help
As of 2020-07-06, I am on GitLab Enterprise Edition 13.2.0-pre
gitlab-runner
gitlab-runner status
The status command has to be run in a unix-y terminal (ex:- git bash) with admin privileges.
On a windows command prompt with admin privileges, I get warnings such as
time="2019-10-09T17:49:59+01:00" level=info msg="Failed to set console mode for cli" error="The parameter is incorrect."
On a windows command prompt with no admin privileges, I get the following error (along with the above warnings)
gitlab-runner: Access is denied.
But if I use git bash with admin privileges, then there are no errors.
tested on | windows server 2012R2
documentation links
gitlab CI
useful links
- https://docs.gitlab.com/ce/ci/quick_start/README.html - getting started with Gitlab CI/CD
- https://docs.gitlab.com/ee/ci/README.html - high level page on gitlab CI/CD documentation
enable CI
To enable CI on a per project basis
Settings > General > Visibility, project features, permissions -> Repository -> Pipelines -> Enable -> Save changes
Ref:- https://docs.gitlab.com/ee/ci/enable_or_disable_ci.html
build directory
Issue: gitlab CI does not create a new build directory on the next CI runs?
Explanation: The name of the build directory may be the same. But it is created fresh before initiating the new run.
Design question: Is it better to delete the build directory yourself once the CI pipeline completes (say in after_script)?
Decision: No, do not do it. If the build were to fail for some reason, this directory can help debug and identify the issue. Gitlab anyway cleans it up before starting a new CI pipeline. So the space gain in between is not worth it.
only except
https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-advanced
Run only on some branches
job: only: - branch1 - branch2