AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[gitlab](server)

Martin Hope
mschau
Asked: 2024-01-21 16:24:55 +0800 CST

Bitbucket 到 Gitlab Webhook 来触发管道

  • 5

我们有以下本地场景:开发人员在 Bitbucket 中从事应用程序工作,运维人员在 Gitlab 中从事“Gtops”工作。我们希望通过 Gitlab 管道自动化构建和部署,并寻找实施方法。构建部分已经可以工作了。但我们想区分分支 - 并非每个分支都应该部署 - 特别是生产将手动部署。

由于 webhook 包含我尝试在部署阶段设置的分支:

only:
  - dev

也

  rules:
    - if: '$TOKEN_BRANCH != $PROD_BRANCH'

但在这两种方式中,部署管道仍然会被触发。

我想到了两个解决方法:

一种选择是通过“提交后钩子”镜像 bitbucket 存储库 - 但一方面这个插件是有成本的,另一方面你需要第二个插件来进行镜像 - 而且我能找到的唯一一个没有维护任何插件更长。

第二种选择是授权 Gitlab Ultimate 能够使用“拉取镜像”,这也可以通过 Bitbucket webhook 触发。

由于我们没有使用存储库镜像,唯一的用例是能够在“本地存储库”上使用 Gitlab 管道,其中所有上述区分部署分支的方法都应该有效 - 我更愿意找到一个与现有资源的方式。

很高兴听到您对此的想法!

编辑: 管道的部分:

variables:
  PROD_BRANCH: main

before_script:
  - TOKEN_BRANCH=$(cat $TRIGGER_PAYLOAD | jq -r '.changes[0].ref.displayId')

deploy:
  stage: deploy
  tags:
    - openshift
  rules:
    - if: $TOKEN_BRANCH != $PROD_BRANCH
  • echo $TOKEN_BRANCH 返回“main”。
  • 在规则中:仅当以下语句为真时才会触发管道的这一部分。
  • 由于“main == main”而不是“!=”,因此不应执行管道的“部署”阶段。但它是...

几种变体

rules:
  - if: '$TOKEN_BRANCH !~ $PROD_BRANCH'

rules:
  - if: '$TOKEN_BRANCH =~ $PROD_BRANCH'
    when: never

在这些情况下,会发生相反的情况 - 管道永远不会有部署阶段 - 它甚至不会在 Gitlab 的“管道”视图中显示该阶段。

gitlab
  • 1 个回答
  • 56 Views
Martin Hope
sunnyboy
Asked: 2023-11-10 16:30:31 +0800 CST

为什么 gitlab url 的主机显示为已编码

  • 5

为什么我的本地 gitlab 按以下方式生成项目克隆 url:

http://84fdf6ccc7dc/test/testproject.git

我怎样才能

  1. 使用此 url 克隆存储库并使用用户名和密码对其进行身份验证或
  2. 更改 url 主机以使用我用来使用浏览器访问它的主机 PC IP 地址; http://10.240.1.2/test/testproject.git

我使用以下命令来创建 docker 映像。

sudo docker run --detach \
  --publish 8803:443 --publish 8800:80 --publish 8822:22 \
  --name gitlab1 \
  --restart always \
  --volume $GITLAB_HOME_TEST1/config:/etc/gitlab \
  --volume $GITLAB_HOME_TEST1/logs:/var/log/gitlab \
  --volume $GITLAB_HOME_TEST1/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest

gitlab
  • 1 个回答
  • 91 Views
Martin Hope
Stefan NovakDev
Asked: 2022-02-23 13:11:28 +0800 CST

为 Gitlab 重写 NGINX 位置

  • 0

我试图让 Gitlab 在 Nginx 后面工作。我的配置:

Nginx:

upstream gitlab-workhorse {
    server unix:/var/opt/gitlab/gitlab-workhorse/sockets/socket fail_timeout=0;
}

location /gitlab/ {
       rewrite ^/gitlab(/.*)$ $1 break;
       client_max_body_size 0;
       gzip off;
       proxy_read_timeout      300;
       proxy_connect_timeout   300;
       proxy_redirect          off;
       proxy_http_version 1.1;
       proxy_set_header    Host                $http_host;
       proxy_set_header    X-Real-IP           $remote_addr;
       proxy_set_header    X-Forwarded-Ssl     on;
       proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
       proxy_set_header    X-Forwarded-Proto   $scheme;
       proxy_pass http://gitlab-workhorse;
}

/etc/gitlab/gitlab.rb:

external_url "https://myhostname.com/gitlab"
web_server['external_users'] = ['www-data']
nginx['enable'] = false
gitlab_workhorse['enable'] = true
gitlab_workhorse['listen_network'] = "unix"
gitlab_workhorse['listen_addr'] = "/var/opt/gitlab/gitlab-workhorse/sockets/socket"

应 myhost.com/gitlab/users/sign_in 的请求,我得到“/users/sign_in”未找到

如果我更改 gitlab 配置

external_url "https://myhostname.com/"

(最后没有/gitlab路径)它开始工作,但它总是重定向到服务器的 / 而不是 /gitlab

nginx gitlab
  • 1 个回答
  • 255 Views
Martin Hope
Goural
Asked: 2022-02-22 23:16:18 +0800 CST

Terraform 源 Gitlab 模块

  • 0

我需要帮助从 gitlab 存储库中获取 terraform 模块,其中包含多个模块,如 ec2、vpc 等。我在模块 repo 中有两个分支 - 开发和主。我尝试了以下所有方法,但出现错误。我正在采购类似下面的东西。我只需要 ssh,不需要 https。

source = "git::ssh://[email protected]:repo_name/modules.git//ec2?ref=develop"
"git::ssh://[email protected]:repo_name/modules.git//ec2?ref=develop"
"git::ssh://[email protected]:repo_name/modules.git/ec2?ref=develop"
"git::ssh://[email protected]:repo_name/modules/ec2?ref=develop"
"git::ssh://[email protected]:repo_name/modules//ec2?ref=develop"
"git::ssh://[email protected]/repo_name/modules//ec2?ref=develop"
"git::ssh://[email protected]:repo_name/modules.git//ec2"
"git::ssh://[email protected]:repo_name/modules.git?ref=ec2"
"git::ssh://[email protected]:repo_name/modules.git?ref=develop//ec2"
"git::ssh://[email protected]:repo_name/modules.git/develop/ec2"
"git::ssh://[email protected]:repo_name/modules.git//ec2?ref=develop"
"git::ssh://[email protected]:repo_name/modules.git/develop/ec2"
"git::ssh://[email protected]:repo_name/modules/ec2?ref=develop"
"git::ssh://[email protected]:repo_name/modules//ec2"

这是我得到的错误

│ 
│ Module "ec2" (declared at compute/main.tf line 1)
│ has invalid source address
│ "git::ssh://[email protected]:repo_name/modules//ec2": Terraform
│ cannot detect a supported external module source type for
terraform gitlab
  • 1 个回答
  • 803 Views
Martin Hope
Przemyslaw Wojda
Asked: 2021-11-19 00:19:29 +0800 CST

部署问题

  • 0

我在部署到服务器时遇到以下错误(屏幕 1)。机器重启后我无法安装 gitlab-runner。知道问题出在哪里吗?

屏幕一

在此处输入图像描述

deployment docker gitlab
  • 1 个回答
  • 27 Views
Martin Hope
tio oit
Asked: 2021-11-16 03:41:21 +0800 CST

curl 表示有效证书已过期

  • 1

我有一个托管在服务器上的 gitlab 社区版,当在此服务器上使用 curl 获取此本地 gitlab 网站时,即使日期有效,我也会收到过期证书错误:

curl --insecure -vvI https://gitlab.mysite.com 2>&1 | awk 'BEGIN { cert=0 } /^\* Server certificate:/ { cert=1 } /^\*/ { if (cert) print }'
* Server certificate:
*  subject: CN=gitlab.mysite.com
*  start date: Nov 12 14:36:12 2021 GMT
*  expire date: Feb 10 14:36:11 2022 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify result: certificate has expired (10), continuing anyway.

但是从浏览器加载站点或在另一台服务器上使用 curl 时,我没有收到此过期证书错误。该错误仅在托管 gitlab ce 实例的服务器上本地使用 curl 时出现。

这是在另一台服务器上使用 curl 时的结果:

* Server certificate:
*  subject: CN=gitlab.mysite.com
*  start date: Nov 12 14:36:12 2021 GMT
*  expire date: Feb 10 14:36:11 2022 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.

由于 curl 正在解析到本地网站(已解析 ip = 127.0.1.1),是否可能存在问题?

certificate curl gitlab
  • 1 个回答
  • 3183 Views
Martin Hope
NBajanca
Asked: 2021-09-11 14:30:08 +0800 CST

带有 CA 签名证书的 GitLab 服务器的 GitLab Runner 失败:证书链中的自签名证书

  • 0

我的公司更改了证书颁发机构(它是一个单一的 CA,现在我们有一个根 CA 和一个中间 CA)。我成功更改了 GitLab 实例中的配置并移至运行器(即在 Ubuntu 18.04.5 LTS 上)。我试图遵循GitLab 文档但没有成功。

我遵循此处的默认方法,即“默认 - 读取系统证书”,因此我将证书(CA 和中级)添加到 Ubuntu CA 列表中。一切似乎都奏效了,因为跑步者出现在 GitLab 中。

我开始工作,我得到:

Running with gitlab-runner 11.5.0 (3afdaba6)
  on RUN01 12ccbb74
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:ab773999a02271b25a9f3bce46018fc3ad46a7f922a5e3e8712b6d1c7087c415 for node:latest ...
Running on runner-12ccbb74-project-73-concurrent-0 via (...)...
00:02
Fetching changes...
00:01
HEAD is now at 60b6860 Update dependency mocha to v9
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@(...).git/': SSL certificate problem: unable to get issuer certificate
ERROR: Job failed: exit code 1

然后我(在 GitLab 实例上)将完整链添加到证书文件中,错误更改为SSL certificate problem: self signed certificate in certificate chain.

我的逻辑*:它适用于 Ubuntu,但不适用于 Docker。所以我转到了Docker 和 Kubernetes 执行程序的信任 TLS 证书部分。

到目前为止我已经尝试过,但没有成功:

  1. 我将根 CA 证书添加到/etc/gitlab-runner/certs/ca.crt.
  2. 我还尝试使用链中包含根 CA 和中间 CA 的文件。
  3. 我添加volumes = ["/cache", "/path/to-ca-cert-dir/ca.crt:/etc/gitlab-runner/certs/ca.crt:ro"]到config.toml文件中。但我几乎可以肯定我应该/path/to-ca-cert-dir用一些东西代替。我只是不知道是什么。

*更新:当我安装 GitLab Runner 时,我使用 Debian/Ubuntu/CentOS/RedHat 的 GitLab 存储库安装,因此 Docker/K8s 说明没有意义。我发布了有关如何解决此问题的答案。

ubuntu ssl-certificate docker gitlab
  • 1 个回答
  • 4352 Views
Martin Hope
Pipelynx
Asked: 2021-08-12 03:34:37 +0800 CST

Gitlab-Server 的证书对于主题备用名称无效

  • 0

我的公司拥有https://data.ddl.at的证书,其中包括gitlab.ddl.at. 这个 Gitlab-Server 是内部的,域名只由我们内部的 DNS-Server 解析。作为参考,还有 SAN https://sicher.ddl.at,它是公开的,在浏览器中有效。

我已经在 Gitlab-Server 上配置了这个证书,当我去 时gitlab.ddl.at,证书被浏览器验证并被认为是有效的。

一旦我尝试使用 Gitlab-Runner,就会出现问题。我在另一台机器上安装并注册了一个,一开始遇到一些问题后,我让它连接到主实例,但作业仍然无法签出子模块,运行程序正在获取server certificate verification failed.

现在在这里我认为是问题的根本症状:如果我运行openssl s_client -connect data.ddl.at:443,我会得到:

CONNECTED(00000005)
depth=2 OU = GlobalSign Root CA - R3, O = GlobalSign, CN = GlobalSign
verify return:1
depth=1 C = BE, O = GlobalSign nv-sa, CN = GlobalSign Extended Validation CA - SHA256 - G3
verify return:1
depth=0 businessCategory = Private Organization, serialNumber = FN 374566h, jurisdictionC = AT, jurisdictionL = Wels, jurisdictionST = Oberoesterreich, C = AT, ST = Oberoesterreich, L = Ruestorf, street = Erwin Greiner-Str. 4, OU = GIS, O = DDL GmbH, CN = data.ddl.at
verify return:1
---
Certificate chain
 0 s:businessCategory = Private Organization, serialNumber = FN 374566h, jurisdictionC = AT, jurisdictionL = Wels, jurisdictionST = Oberoesterreich, C = AT, ST = Oberoesterreich, L = Ruestorf, street = Erwin Greiner-Str. 4, OU = GIS, O = DDL GmbH, CN = data.ddl.at
   i:C = BE, O = GlobalSign nv-sa, CN = GlobalSign Extended Validation CA - SHA256 - G3
 1 s:C = BE, O = GlobalSign nv-sa, CN = GlobalSign Extended Validation CA - SHA256 - G3
   i:OU = GlobalSign Root CA - R3, O = GlobalSign, CN = GlobalSign
---
Server certificate
[...]

最后:Verify return code: 0 (ok)

现在,当我运行时openssl s_client -connect gitlab.ddl.at:443,我得到:

CONNECTED(00000005)
depth=0 businessCategory = Private Organization, serialNumber = 374566h, jurisdictionC = AT, jurisdictionL = Wels, jurisdictionST = Oberoesterreich, C = AT, ST = Oberoesterreich, L = Ruestorf, street = Erwin Greiner-Stra\C3\9Fe 4, OU = GIS, O = DDL GmbH, CN = data.ddl.at
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 businessCategory = Private Organization, serialNumber = 374566h, jurisdictionC = AT, jurisdictionL = Wels, jurisdictionST = Oberoesterreich, C = AT, ST = Oberoesterreich, L = Ruestorf, street = Erwin Greiner-Stra\C3\9Fe 4, OU = GIS, O = DDL GmbH, CN = data.ddl.at
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
 0 s:businessCategory = Private Organization, serialNumber = 374566h, jurisdictionC = AT, jurisdictionL = Wels, jurisdictionST = Oberoesterreich, C = AT, ST = Oberoesterreich, L = Ruestorf, street = Erwin Greiner-Stra\C3\9Fe 4, OU = GIS, O = DDL GmbH, CN = data.ddl.at
   i:C = BE, O = GlobalSign nv-sa, CN = GlobalSign Extended Validation CA - SHA256 - G3
---
Server certificate
[...]

第一个错误是unable to get local issuer certificate.

我也尝试过使用可公开访问sicher.ddl.at的 ,但错误与gitlab.ddl.at.

它获得的证书是 for data.ddl.at,但它具有 SAN gitlab.ddl.at,这不应该使它有效吗?我究竟做错了什么?

ssl-certificate openssl gitlab subject-alternative-names
  • 1 个回答
  • 169 Views
Martin Hope
cclloyd
Asked: 2021-07-10 07:58:05 +0800 CST

迁移到新集群后 GitLab Runner 无法注册

  • 1

我在 Kubernetes 中安装了 GitLab 和他们的 Helm 图表。

我通过以下步骤将旧的 Gitlab 部署从一个集群迁移到另一个集群:

  • 缩小旧集群中的所有 pod
  • 将带有 helm 的 values.yml 应用到新集群(以创建 PVC)
  • 缩减新集群中的所有 pod
  • 更改 DNS 记录、HAProxy 等
  • 手动将数据从旧 PVC 同步到新 PVC(minio、gitaly、redis、postgres、prometheus)
  • 运行 helm upgrade 以使部署在新集群中重新上线

毕竟大部分部署工作正常。能够登录和使用git。

但是跑步者没有注册,所以我不能运行任何 CI。看着gitlab-gitlab-runner吊舱,我看到下面的消息一遍又一遍地重复:

Registration attempt 30 of 30
Runtime platform                                    arch=amd64 os=linux pid=691 revision=3b6f852e version=14.0.0
WARNING: Running in user-mode.
WARNING: The user-mode requires you to manually start builds processing:
WARNING: $ gitlab-runner run
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner...
 
ERROR: Registering runner... failed                 runner=y6ixJoR1 status=500 Internal Server Error
PANIC: Failed to register the runner. You may be having network problems.

如您所见,它无法注册跑步者。试图去/admin/runners给我一个 500 错误。

我在哪里可以看到更多关于我为什么会收到这个 500 错误的信息?

kubernetes gitlab helm
  • 2 个回答
  • 1330 Views
Martin Hope
Oyabi
Asked: 2021-05-05 11:06:30 +0800 CST

CreateContainerError:超出上下文期限

  • 1

对于一个项目,我必须使用大容器(500Mb 到 60Gb)。

我没有精确的测量值,但是当我使用 gitlab-runner 运行大于 3-5Gb 的容器时,我在 rancher 中遇到错误:CreateContainerError: context deadline exceeded

我们的 kubernetes 集群是使用 rke 构建的,rancher 作为 web ui 并位于我们的数据中心。

该错误仅在 gitlab-runner 中出现,如果我docker run ...在 kubernetes 节点上启动,一切正常。

也许某处有超时?

你们有没有人遇到过这个问题?

谢谢你。

docker kubernetes gitlab helm rancher-2
  • 1 个回答
  • 4247 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve