如何查看服务器上安装了哪个版本的GitLab ?

我是关于GitLab更新日志中指定的版本: https://gitlab.com/gitlab-org/gitlab-foss/blob/master/CHANGELOG.md

例如:“6.5.0”,“6.4.3”等。

Сan这只能通过终端吗? 有没有办法远程(用浏览器而不是终端)做到这一点?


获取有关GitLab及其运行系统的信息:

bundle exec rake gitlab:env:info RAILS_ENV=production

gitlab:env:info输出示例

System information
System:     Arch Linux
Current User:   git
Using RVM:  yes
RVM Version:    1.20.3
Ruby Version:   2.0.0p0
Gem Version:    2.0.0
Bundler Version:1.3.5
Rake Version:   10.0.4

GitLab information
Version:    5.2.0.pre
Revision:   4353bab
Directory:  /home/git/gitlab
DB Adapter: mysql2
URL:        http://gitlab.arch
HTTP Clone URL: http://gitlab.arch/some-project.git
SSH Clone URL:  git@gitlab.arch:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    1.4.0
Repositories:   /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/bin/git

阅读这篇文章,它将帮助你。

我已经将我的服务器更新到GitLab 6.6.4,最终找到了在没有SSH访问服务器的情况下远程获取GitLab版本的方法。

您应该登录进入以下页面: https://your.domain.name/help

它显示了类似于:

GitLab 6.6.4 42e34ae GitLab是用于代码协作的开源软件。 ... 等。

对于综合版本:

sudo gitlab-rake gitlab:env:info

例子:

System information
System:     Ubuntu 12.04
Current User:   git
Using RVM:  no
Ruby Version:   2.1.7p400
Gem Version:    2.2.5
Bundler Version:1.10.6
Rake Version:   10.4.2
Sidekiq Version:3.3.0

GitLab information
Version:    8.2.2
Revision:   08fae2f
Directory:  /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL:        https://your.hostname
HTTP Clone URL: https://your.hostname/some-group/some-project.git
SSH Clone URL:  git@your.hostname:some-group/some-project.git
Using LDAP: yes
Using Omniauth: no

GitLab Shell
Version:    2.6.8
Repositories:   /var/opt/gitlab/git-data/repositories
Hooks:      /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:        /opt/gitlab/embedded/bin/git

您可以通过URL、web GUI和ReST API访问该版本。

通过URL

可以在https://your-gitlab-url/help的浏览器中显示显示版本的HTML页面。只有登录时才会显示版本。

通过web GUI中的菜单

如果你不介意输入这个URL,你也可以从GitLab web GUI的菜单中访问相同的HTML页面:

在GitLab 11及以后的版本中

登录GitLab 单击右上角的下拉菜单。选择有帮助。 GitLab版本出现在页面顶部

在早期版本中,比如GitLab 9

登录GitLab 点击左上方的下拉菜单。选择有帮助。 然后版本就会出现在页面的顶部

通过ReST API

以任意用户身份登录,选择屏幕右上方的用户图标。选择“设置>访问令牌”。创建个人访问令牌并将其复制到剪贴板。

在Linux shell中,使用curl访问GitLab版本:

curl --header "PRIVATE-TOKEN: personal-access-token" your-gitlab-url/api/v4/version

如果你是一个管理员,如果你想看到Gitlab版本(以及更多你不知道的),点击扳手/管理菜单图标,在Components下面,你可以看到很多,特别是如果你正在使用Omnibus。

CD /opt/gitlab

猫version-manifest.txt

例子:

gitlab-ctl 6.8.2-omnibus gitlab-rails v6.8.2

当前gitlab版本为6.8.2

cat /opt/gitlab/version-manifest.txt |grep gitlab-ce|awk '{print $2}'

它可以使用REST检索,参见版本API:

curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/version

有关身份验证,请参阅个人访问令牌文档。

您有两个选择(登录后)。

使用API url https://gitlab.example.com/api/v4/version(你可以使用私有令牌从命令行使用它),它返回{"version":"10.1.0","revision":"5a695c4"} 在浏览器https://gitlab.example.com/help中使用HELP url,您将看到GitLab的版本,即GitLab社区版10.1.0 5a695c4

如果你使用的是自托管版本的GitLab,那么你可以考虑运行这个命令。

grep gitlab /opt/gitlab/version-manifest.txt

除了http://domain-name/help,您还可以在浏览器中以Admin身份登录来检查您的Gitlab版本名

访问http://domain-name 以管理员(Root)身份登录Gitlab 进入管理区域 在右侧的“组”标签下,您可以找到“组件”标签

在那里,你不仅可以找到Gitlab版本,还可以找到不同的组件,如Gitlab Shell、Gitlab workhorse、Gitlab API等,以及版本号 您还可以在那里找到更新版本的建议

如果使用Gitlab Docker镜像:

sudo cat /srv/gitlab/data/gitlab-rails/VERSION

示例输出:

12.1.3

我有版本:12.2.0-ee,我尝试了URL通过(https://yourgitlab/help),但我没有得到这个信息。 另一方面,我用gitlab-rake成功地进入命令行:

sudo gitlab-rake gitlab:env:info

... GitLab信息 版本:12.2.0-ee ...

最简单的方法是粘贴以下命令:

cat /opt/gitlab/version-manifest.txt | head -n 1

这样就安装好了版本。:)

你可以在https://your.domain.name/help上查看GitLab的版本

或者通过终端:gitlab-rake gitlab:env:info

您可以使用包管理器查询已安装的gitlab-ce版本。如果它恰好是debian或ubuntu,就像这样:

dpkg -l | grep gitlab-ce | tr -s [:space:] | cut -d" " -f3

应该与其他发行版类似地工作,假设您使用包管理器进行安装。

在centos上检查gitlab的版本

rpm -qa | grep gitlab-ce

这个命令行可以了解gitlab安装的所有数据

gitlab-rake gitlab:env:info

和这个命令行来了解是否有新的Gitlab版本,因为你可以更新Gitlab

yum --showduplicates list gitlab-ce

一旦知道了当前版本和最新的gitlab更新,就可以使用下面的命令行进行更新

yum install gitlab-ce-15.2.2-ce.0.el7

以下信息可以从CI管道中获得(GitLab >= 11.4):

Variable Value
CI_SERVER_VERSION_MAJOR The major version of the GitLab instance.
CI_SERVER_VERSION_MINOR The minor version of the GitLab instance.
CI_SERVER_VERSION_PATCH The patch version of the GitLab instance.
CI_SERVER_VERSION The full version of the GitLab instance.