Gitlab 11新特性:
一键 • CI/CD
自动执行整个交付流程,Auto DevOps 涵盖了端到端的整个生命周期,只需将代码提交给 GitLab,并进行少量的配置,接着 Auto DevOps 可以完成其余工作,包括对应用的构建、测试、代码质量扫描、安全扫描、许可证扫描、打包、性能测试、部署和监控。
工作流
据介绍,它可以将交付速度提高 4 倍,让开发人员专注于编写代码和业务价值,使团队协作更加高效。
自动识别License • 依赖
License Management 让程序的许可依赖不再复杂混乱。现代化的开发有很多情况下不再需要重复造轮子,软件通常由库、框架和实用程序等外部组件代码复合而成,而被引用的组件通常都包含特定的许可权限和限制。
不同的 License 需要区别对待,以免引起版权等法律问题,因此开发者需要跟踪和管理这些组件的依赖关系。GitLab 11.0 带来了 License Management 功能,它内置于代码控制的 Merge Request 中,可以分析软件的组成,自动检测项目许可证的依赖关系,使开发者跟踪和管理包含的许可证更加方便快捷。
如果已经启用 Auto DevOps,那么系统会自动为项目开启 License Management,否则可以手动通过 .gitlab-ci.yml 开启。
Kubernetes 集成功能
Web IDE 增强:
全新的用户 • 个人信息页面
代码审查
安全仪表板,在仪表板中,安全团队可以调整漏洞的关键性权重,创建问题以修复关键项目,同时取消其他项目,这样它们就不会反复显示在报告中。
增强代码搜索能力,通过对高级搜索语法的增强,现在可以按文件名、路径和扩展名进行过滤,从而可以更快地找到正确的文件。
升级步骤
/etc/init.d/gitlab stop
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/10.8-to-11.0.md
1. Stop server
sudo service gitlab stop
2. Backup
NOTE: If you installed GitLab from source, make sure rsync is installed.
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
3. Update Ruby
mkdir /tmp/ruby && cd /tmp/ruby && curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.gz && echo 'f919a9fbcdb7abecd887157b49833663c5c15fda ruby-2.5.3.tar.gz' | shasum -c - && tar xzf ruby-2.5.3.tar.gz && cd ruby-2.5.3 && ./configure --disable-install-rdoc && make && sudo make install && sudo gem install bundler --no-document
1. Get latest code
sudo -u git -H git fetch --all --prune
sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically
sudo -u git -H git checkout -- locale
sudo -u git -H git checkout -f 11-0-stable
2. Update gitlab-shell
cd /home/git/gitlab-shell/
sudo -u git -H git fetch --all --tags --prune
sudo -u git -H git checkout v$(</home/git/git/GITLAB_SHELL_VERSION)
sudo -u git -H bin/compile
7.1.4
3. Update gitlab-workhorse
cd /home/git/gitlab-workhorse/
sudo -u git -H git fetch --all --tags --prune
sudo -u git -H git checkout v$(</home/git/git/GITLAB_WORKHORSE_VERSION)
sudo -u git -H make
4.3.1
4. Update Gitaly
cd /home/git/gitaly/
sudo -u git -H git fetch --all --tags --prune
sudo -u git -H git checkout v$(</home/git/git/GITALY_SERVER_VERSION)
sudo -u git -H make
cd ruby && bundle config # for debugging
Traceback (most recent call last):
2: from /usr/local/bin/bundle:23:in `<main>'
1: from /usr/local/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/usr/local/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
make: *** [.ruby-bundle] Error 1
# 装低版本的bundler,ruby2.5装的是bundler 2.0.1
gem uninstall bundler
gem update --system && gem install bundler -v 1.16.1
0.105.0
比对一下各组件的配置,有变化的作相应的更改
MySQL permissions授权语句之前已经执行过了,这里就过了没执行可以看官方文档
mysql -u root -p -e "GRANT TRIGGER ON `gitlabhq_production`.* TO 'git'@'localhost';"
mysql -u root -p -e "SET GLOBAL log_bin_trust_function_creators = 1;"
5. Update configuration files
编译前端报错
/home/git/git/node_modules/.bin/webpack --config /home/git/git/config/webpack.config.js --bail
/home/git/git/node_modules/monaco-editor-webpack-plugin/index.js:40
[id, ...(language.alias || [])].map((label) => [label, { label, ...language }])
^^^
SyntaxError: Unexpected token ...
at NativeCompileCache._moduleCompile (/home/git/git/node_modules/v8-compile-cache/v8-compile-cache.js:226:18)
https://gitlab.com/gitlab-org/gitlab-ce/issues/48502
https://gitlab.com/gitlab-org/gitlab-ce/issues/48484
解决:node版本过低导致,但我看我安装的node版本是v11.6.0
安装yarn时依赖安装了nodejs-6.14.3-1.el7.x86_64,将/usr/bin/node换成高版本的node执行文件即可。
docker pull gitlab/gitlab-ce:11.0.6-ce.0
docker run --detach --publish 443:443 --publish 80:80 --name gitlab --restart unless-stopped --volume ~/gitlabdata/etc:/etc/gitlab --volume ~/gitlabdata/log:/var/log/gitlab --volume ~/gitlabdata/data:/var/opt/gitlab gitlab/gitlab-ce:11.0.6-ce.0
gitlab登陆500报错
ActionView::Template::Error (uninitialized constant ActionView::CompiledTemplates::EXPR_ARG):
1: %ul.nav-links.new-session-tabs.nav-tabs.nav{ role: 'tablist' }
2: %li.nav-item{ role: 'presentation' }
3: %a.nav-link.active{ href: '#login-pane', data: { toggle: 'tab' }, role: 'tab' } Sign in
4: - if allow_signup?
app/views/devise/shared/_tabs_normal.html.haml:1:in `_app_views_devise_shared__tabs_normal_html_haml__4406782408659215353_69837729441580'
app/views/devise/sessions/new.html.haml:7:in `_app_views_devise_sessions_new_html_haml__4092845639069478356_69837736332320'
app/controllers/sessions_controller.rb:28:in `new'
参考:https://gitlab.com/gitlab-org/gitlab-ce/issues/42045#note_73010232
解决方法:升级 gems
- haml to (5.0.4)
- hamlit to (2.8.8)
- temple to (>= 0.8.0)
http://appblog.cn/2018/06/18/Gitlab%E6%8A%A5%E9%94%99%20ActionView%20Template%20Error%20uninitialized%20constant%20ActionView%20CompiledTemplates%20EXPR_ARG/
# gem 'haml_lint', '~> 0.26.0', require: false
gem 'haml_lint', '~> 0.28.0', require: false
https://gitlab.com/gitlab-org/gitlab-ce/issues/46319
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19006
sudo -u git -H bundle lock --update=hamlit
sudo -u git -H bundle lock --update=haml
sudo -u git -H bundle install --deployment --without development test postgres aws kerberos
/etc/init.d/gitlab restart
数据库变更
== 20180521162137 MigrateRemainingMrMetricsPopulatingBackgroundMigration: migrating•
时长:0.5小时
需升级ruby,否则gitaly会起不来:
mkdir /tmp/ruby && cd /tmp/ruby && curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.gz && echo 'f919a9fbcdb7abecd887157b49833663c5c15fda ruby-2.5.3.tar.gz' | shasum -c - && tar xzf ruby-2.5.3.tar.gz && cd ruby-2.5.3 && ./configure --disable-install-rdoc && make && sudo make install && sudo gem install bundler --no-document
cd ruby-2.5.3 && ./configure --disable-install-rdoc && make && sudo make install && sudo gem install bundler --no-document
gem uninstall bundler-2.0.1
gem install bundler-1.16.1
前端资源模块
{
"private": true,
"scripts": {
"clean": "rm -rf public/assets tmp/cache/*-loader",
"dev-server": "nodemon -w 'config/webpack.config.js' --exec 'webpack-dev-server --config config/webpack.config.js'",
"eslint": "eslint --max-warnings 0 --ext .js,.vue .",
"eslint-fix": "eslint --max-warnings 0 --ext .js,.vue --fix .",
"eslint-report": "eslint --max-warnings 0 --ext .js,.vue --format html --output-file ./eslint-report.html .",
"karma": "BABEL_ENV=${BABEL_ENV:=karma} karma start --single-run true config/karma.config.js",
"karma-coverage": "BABEL_ENV=coverage karma start --single-run true config/karma.config.js",
"karma-start": "BABEL_ENV=karma karma start config/karma.config.js",
"prettier-staged": "node ./scripts/frontend/prettier.js",
"prettier-staged-save": "node ./scripts/frontend/prettier.js save",
"prettier-all": "node ./scripts/frontend/prettier.js check-all",
"prettier-all-save": "node ./scripts/frontend/prettier.js save-all",
"webpack": "webpack --config config/webpack.config.js",
"webpack-prod": "NODE_ENV=production webpack --config config/webpack.config.js"
},
"dependencies": {
"@gitlab-org/gitlab-svgs": "^1.23.0",
"autosize": "^4.0.0",
"axios": "^0.17.1",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-define": "^1.3.0",
"babel-preset-latest": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"blackst0ne-mermaid": "^7.1.0-fixed",
"bootstrap": "~4.1.1",
"brace-expansion": "^1.1.8",
"cache-loader": "^1.2.2",
"chart.js": "1.0.2",
"classlist-polyfill": "^1.2.0",
"clipboard": "^1.7.1",
"compression-webpack-plugin": "^1.1.11",
"core-js": "^2.4.1",
"cropper": "^2.3.0",
"css-loader": "^0.28.11",
"d3-array": "^1.2.1",
"d3-axis": "^1.0.8",
"d3-brush": "^1.0.4",
"d3-scale": "^1.0.7",
"d3-selection": "^1.2.0",
"d3-shape": "^1.2.0",
"d3-time": "^1.0.8",
"d3-time-format": "^2.1.1",
"deckar01-task_list": "^2.0.0",
"diff": "^3.4.0",
"document-register-element": "1.3.0",
"dropzone": "^4.2.0",
"emoji-unicode-version": "^0.2.1",
"exports-loader": "^0.7.0",
"file-loader": "^1.1.11",
"fuzzaldrin-plus": "^0.5.0",
"glob": "^7.1.2",
"imports-loader": "^0.8.0",
"jed": "^1.1.1",
"jquery": "^3.2.1",
"jquery-ujs": "1.2.2",
"jquery.waitforimages": "^2.2.0",
"js-cookie": "^2.1.3",
"jszip": "^3.1.3",
"jszip-utils": "^0.0.2",
"katex": "^0.8.3",
"marked": "^0.3.12",
"monaco-editor": "0.13.1",
"monaco-editor-webpack-plugin": "^1.2.1",
"mousetrap": "^1.4.6",
"pikaday": "^1.6.1",
"popper.js": "^1.14.3",
"prismjs": "^1.6.0",
"raphael": "^2.2.7",
"raven-js": "^3.22.1",
"raw-loader": "^0.5.1",
"sanitize-html": "^1.16.1",
"select2": "3.5.2-browserify",
"sha1": "^1.1.1",
"sortablejs": "^1.7.0",
"sql.js": "^0.4.0",
"stickyfilljs": "^2.0.5",
"style-loader": "^0.21.0",
"svg4everybody": "2.1.9",
"three": "^0.84.0",
"three-orbit-controls": "^82.1.0",
"three-stl-loader": "^1.0.4",
"timeago.js": "^3.0.2",
"underscore": "^1.9.0",
"url-loader": "^1.0.1",
"visibilityjs": "^1.2.4",
"vue": "^2.5.16",
"vue-loader": "^15.2.0",
"vue-resource": "^1.5.0",
"vue-router": "^3.0.1",
"vue-template-compiler": "^2.5.16",
"vue-virtual-scroll-list": "^1.2.5",
"vuex": "^3.0.1",
"webpack": "^4.11.1",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^3.0.2",
"webpack-stats-plugin": "^0.2.1",
"worker-loader": "^2.0.0"
},
"devDependencies": {
"axios-mock-adapter": "^1.15.0",
"babel-eslint": "^8.2.3",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-rewire": "^1.1.0",
"babel-template": "^6.26.0",
"babel-types": "^6.26.0",
"chalk": "^2.4.1",
"commander": "^2.15.1",
"eslint": "~4.12.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-import-resolver-webpack": "^0.10.0",
"eslint-plugin-filenames": "^1.2.0",
"eslint-plugin-html": "4.0.3",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jasmine": "^2.1.0",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-vue": "^4.0.1",
"ignore": "^3.3.7",
"istanbul": "^0.4.5",
"jasmine-core": "^2.9.0",
"jasmine-jquery": "^2.1.1",
"karma": "^2.0.2",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "^1.1.1",
"karma-mocha-reporter": "^2.2.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "3.0.0",
"nodemon": "^1.17.3",
"prettier": "1.11.1",
"webpack-dev-server": "^3.1.4"
}
}
升级后验证