# Thank you for installing GitLab! # GitLab was unable to detect a valid hostname for your instance. # Please configure a URL for your GitLab instance by setting `external_url`
# configuration in /etc/gitlab/gitlab.rb file. # Then, you can start your GitLab instance by running the following command: # sudo gitlab-ctl reconfigure
# USAGE help [global options] command [command options] [arguments...]
# GLOBAL OPTIONS: --server-url value The base URL of the GitLab instance, including protocol and port, for example https://gitlab.example.com:8080 [$CI_SERVER_URL] --job-token value Job token used for authenticating with the GitLab Releases API [$CI_JOB_TOKEN] --project-id value The current project unique ID; used by GitLab CI internally [$CI_PROJECT_ID] --timeout value HTTP client timeout in Go duration format https://golang.org/pkg/time/#ParseDuration (default: 30s) [$RELEASE_CLI_TIMEOUT] --private-token value Private token used for authenticating with the GitLab Releases API, requires api scope https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html, overrides job-token [$GITLAB_PRIVATE_TOKEN] --help, -h Show help (default: false) --version, -v Print the version (default: false)
基本命令 - COMMANDS
1 2 3 4 5 6 7 8 9 10 11 12 13 14
create: Create a Release using GitLab Releases API https://docs.gitlab.com/ee/api/releases/#create-a-release USAGE: help create [command options] [arguments...] OPTIONS: --name value # 发布名称例如 app_Version-1.14 --description value # 用来读取描述内容的文件,必须存在于工作目录内;如果它包含任何空格,它将被视为字符串 --tag-name value # 发布版本将从中创建的标记[$CI_COMMIT_TAG] 例如v1.14 --ref value # 它可以是一个提交SHA、另一个标记名或一个分支名 [$CI_COMMIT_SHA] --assets-links-name value # DEPRECATED --assets-links-url value # DEPRECATEDe.g. --assets-links-name "asset 1" --assets-links-url "https://example.com/url/1" --assets-links-name "asset 2" --assets-links-url "https://example.com/url/2") --assets-link value # JSON字符串表示的资产链接用于替代--assets-links-name/url ( e.g. --assets-link='{"name": "Asset1", "url":"https://<domain>/some/location/1", "type": "other", "filepath": "xzy" }' --milestone value # 与发行版相关的每个里程碑的标题列表 (里程碑必须存在) --released-at value # 他标明了发行的日期;默认为当前时间;期望ISO 8601格式 (2019-03-15T08:00:00Z) --help, -h Show help (default: false)
# 方式1.命令行发布 release-cli --server-url https://gitlab.com --job-token=SOME_JOB_TOKEN --project-id 12345 create help release-cli --server-url https://gitlab.mydomain.com --private-token "my-private-token" create --name "My Release" --description "This is a new release for my amazing tool"
# 方式2.Gitlab-CI 发布 release-branch: stage: release image: registry.gitlab.com/gitlab-org/release-cli when: manual # We recommend the use of `rules` to prevent these pipelines # from running. See the notes section below for details. rules: - if: $CI_COMMIT_TAG when: never script: - > release-cli create --name release-branch-$CI_JOB_ID --description release-branch-$CI_COMMIT_REF_NAME-$CI_JOB_ID --tag-name job-$CI_JOB_ID --ref $CI_COMMIT_SHA --assets-link '{"name":"Asset1","url":"https://<domain>/some/location/1","link_type":"other","filepath":"xzy"}' --assets-link '{"name":"Asset2","url":"https://<domain>/some/location/2"}' --milestone "v1.0.0" --milestone "v1.0.0-rc" --released-at "2020-06-30T07:00:00Z"
# (1) 描述信息 ~ $ release-cli --server-url http://gitlab.weiyigeek.top --private-token "fYyHzos-zEPPP8PDsxLa" --project-id 45 create create --name "My Release" --description "This is a new release for my amazing tool"
# (2) 指定版本 ~ $ release-cli --server-url http://gitlab.weiyigeek.top --private-token "fYyHzos-zEPPP8PDsxLa" --project-id 45 create --tag-name "v1.15" --name "My Release" --description "This is a new release for my amazing tool" # INFO[0000] Creating Release... # cli=release-cli command=create name="My Release" project-id=45 ref= server-url="http://gitlab.weiyigeek.top" tag-name=v1.15 version=0.6.0 # Tag: v1.15 # Name: My Release # Description: This is a new release for my amazing tool # Created At: 2021-02-10 14:52:17.08 +0800 CST # Released At: 2021-02-10 14:52:17.08 +0800 CST # See all available releases here: /-/releases # INFO[0001] release created successfully!
# (3)指定RELEASE的外部URL ~ $ release-cli --server-url http://gitlab.weiyigeek.top --private-token "fYyHzos-zEPPP8PDsxLa" --project-id 45 create --tag-name "v1.14" --name "v1.15" --description "This is a new release for my amazing tool" --assets-link '{"name": "info-student-rebuid","url":"http://192.168.12.107:30001/job/HelloWorld/19/artifact/target/info-student-rebuild-0.0.2-SNAPSHOT.jar","link_type":"other","filepath":"/binaries/linux-amd64"}'
# Tag: v1.14 # Name: v1.15 # Description: This is a new release for my amazing tool # Created At: 2021-02-10 14:57:07.358 +0800 CST # Released At: 2021-02-10 14:57:07.358 +0800 CST # Asset::Link::Name: info-student-rebuid # Asset::Link::URL: http://192.168.12.107:30001/job/HelloWorld/19/artifact/target/info-student-rebuild-0.0.2-SNAPSHOT.jar
# See all available releases here: /-/releases # INFO[0002] release created successfully!
# (4) 指定RELEASE的多个外部URL ~ $ /usr/local/bin/release-cli --server-url http://gitlab.weiyigeek.top --private-token "fYyHzos-zEPPP8PDsxLa" --project-id 45 create --tag-name "v1.12" --name "v1.12" --description "This is a new release for my amazing tool" --assets-link '{"name": "info-student-rebuid","url":"http://192.168.12.107:30001/job/HelloWorld/19/artifact/target/info-student-rebuild-0.0.2-SNAPSHOT.jar","link_type":"other"}' --assets-link '{"name":"Asset2","url":"http://192.168.12.107:30001/job/HelloWor ld/19/artifact/target/info-student-rebuild-0.0.1-SNAPSHOT.jar"}'
# INFO[0000] Creating Release
# Tag: v1.12 # Name: v1.12 # Description: This is a new release for my amazing tool # Created At: 2021-02-10 15:06:23.059 +0800 CST # Released At: 2021-02-10 15:06:23.059 +0800 CST
# 修改前 $ curl -s --header "PRIVATE-TOKEN: fYyHzos-zEPPP8PDsxLa""http://gitlab.weiyigeek.top/api/v4/projects/45/releases/v1.12" | jq ."description" "This is a new release for my amazing tool"
Project Name -> Memebers-> 用户成员与Choose a role permission -> 以及失效日期设置 参考官方文档网站列出了Guest,Reporter,Developer,Maintainer(Master),Owner对应的权限,比如上面我们设置的Dev默认对保护分支是没有push权限的;
9) 广播信息设置 描述: 广播信息会显示给全部用户,可以用于通知用户系统定期维护、近期计划升级等信息,在用户登陆界面以及用户提交代码的时候会有显示。 Area Admin -> Messages -> Broadcast Information (设置即可)
(2) 值得注意的是由于gitlab.rb and gitlab-secrets.json包含敏感数据,采用上面备份的形式不能将它们进行备份,只能通过手动备份的方式;
1 2 3
Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data and are not included in this backup. You will need these files to restore a backup. Please back them up manually.
#2.Gitlab服务器生成rsa公钥并将证书上传到备份服务器(实际环境中建议最小权限用户) $ssh-keygen -t rsa -C "gitlab@weiyigeek.top" # Enter file in which to save the key (/root/.ssh/id_rsa): 报错路径 # Enter passphrase (empty for no passphrase): 公钥密码 # Enter same passphrase again: 验证密码 # Your public key has been saved in /root/.ssh/id_rsa.pub. #保存路径 # The key fingerprint is: # SHA256:YahioDs7XZ9No********RS9jWX1NNXo04i4ZHOLY WeiyiGeek@weiyigeek.top # The key's randomart image is: # +---[RSA 2048]----+ # | . . ++| # | .+ . o o.+| # |. o.oo= . + .| # |.. ..=.E.+ + | # |o o..+ oS= . . | # |.=+.+ o . . | # |+*.. = + | # |oo= o o . | # |.o.+ | # +----[SHA256]-----+
To gitlab.weiyigeek.top:newproject/secopsdev.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@gitlab.weiyigeek.top:newproject/secopsdev.git'
原因:由于上传代码的gitlab用户权限为开发者而默认创建的是私有的项目,默认是对master分支开启了保护机制,需要对其项目的Branch分支设置 Allowed to merge | Allowed to push为Development+Maintiner;
1 2 3 4 5
#最终主分支以及dev分支都测试上次成功 remote: To gitlab.weiyigeek.top:newproject/secopsdev.git * [new branch] dev -> dev Branch 'dev'set up to track remote branch 'dev' from 'origin'.
# (4) 利用postfix自带的工具查看邮件的内容,找到修改密码的地 $postcat /var/spool/postfix/deferred/9/908DCCAC62 *** ENVELOPE RECORDS /var/spool/postfix/deferred/9/908DCCAC62 *** message_size: 6871 274 1 0 6871 0 message_arrival_time: Wed Apr 15 19:54:32 2020 create_time: Wed Apr 15 19:54:32 2020 named_attribute: rewrite_context=local sender: gitlab@gitlab.weiyigeek.top named_attribute: dsn_orig_rcpt=rfc822;admin@example.com original_recipient: admin@example.com ..... If you did not perform this request, you can safely ignore this email. Otherwise, click the link below to complete the process: #找到如下密码修改连接,并将其复制出来到浏览器中重置密码 http://gitlab.weiyigeek.top/users/password/edit?reset_password_token=gd9MyL7FaSt5R2F3_qA_
#gitlab-ctl reconfigure Running handlers: There was an error running gitlab-ctl reconfigure:
bash[migrate gitlab-rails database] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of "bash""/tmp/chef-script20190308-65247-12ck9rp" ---- STDOUT: rake aborted! PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"? /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:52:in `block (3 levels) in <top (required)> /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `<main>' Tasks: TOP => gitlab:db:configure (See full trace by running task with --trace) STDERR: ---- End output of "bash""/tmp/chef-script20190308-65247-12ck9rp" ---- Ran "bash""/tmp/chef-script20190308-65247-12ck9rp" returned 1
Running handlers: There was an error running gitlab-ctl reconfigure:
bash[migrate gitlab-rails database] (gitlab::database_migrations line 49) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of "bash""/tmp/chef-script20190628-7065-vx17en" ---- STDOUT: rake aborted! PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"? /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:49:in `block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `<main>' Tasks: TOP => gitlab:db:configure (See full trace by running task with --trace) STDERR: ---- End output of "bash" "/tmp/chef-script20190628-7065-vx17en" ---- Ran "bash" "/tmp/chef-script20190628-7065-vx17en" returned 1
#1.修改配置文件添加最后两行 egrep -v "^#|^$" /var/opt/gitlab/postgresql/data/pg_hba.conf local all all peer map=gitlab host all all 127.0.0.1/32 trust host all all 0.0.0.0/0 trust
(6) sidekiq_cluster has been deprecated since 13.6 and will be removed in 14.0
1 2
Deprecations: * sidekiq_cluster['experimental_queue_selector'] has been deprecated since 13.6 and will be removed in 14.0. The experimental_queue_selector option is now called queue_selector.
方式1.请访问本博主的B站【WeiyiGeek】首页关注UP主, 将自动随机获取解锁验证码。
Method 2.Please visit 【My Twitter】. There is an article verification code in the homepage.
方式3.扫一扫下方二维码,关注本站官方公众号
回复:验证码
将获取解锁(有效期7天)本站所有技术文章哟!