Gitlab on k8s最佳实践

news2024/9/25 17:20:11

文章目录

  • gitlab on k8s
    • GitLab部署
      • helm 安装 postgresql
      • helm 安装 redis 集群
      • gitlab manifest 部署
      • gitlab如何上传项目?
      • gitlab监控metrics
      • gitlab runner helm 部署
      • helm部署问题
      • k8s中gitlab exector架构图
      • what is Gitlab Runner Helper?
      • gitlab如何连接上k8s? KAS `Kubernetes agent server`
    • gitlab CI
      • gitlab CI template
      • gitlab CI Demo
      • gitlab 和gitlab-runner的关系
      • runner和exector的关系
      • gitlab环境变量
      • 参考

gitlab on k8s

GitLab部署

helm 安装 postgresql

helmchar: github

  • 安装日志

    [root@master2 ~]#helm install gitlib-db -n gitlab /opt/helm/postgresql/
    NAME: gitlib-db
    LAST DEPLOYED: Mon Apr 24 09:05:58 2023
    NAMESPACE: gitlab
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    NOTES:
    CHART NAME: postgresql
    CHART VERSION: 12.1.9
    APP VERSION: 15.1.0
    
    ** Please be patient while the chart is being deployed **
    
    PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:
    
        gitlib-db-postgresql.gitlab.svc.cluster.local - Read/Write connection
    
    To get the password for "postgres" run:
    
        export POSTGRES_PASSWORD=$(kubectl get secret --namespace gitlab gitlib-db-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)
    
    To connect to your database run the following command:
    
        kubectl run gitlib-db-postgresql-client --rm --tty -i --restart='Never' --namespace gitlab --image 10.50.10.185/postgresql/bitnami/postgresql:15.1.0-debian-11-r20 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
          --command -- psql --host gitlib-db-postgresql -U postgres -d postgres -p 5432
    
        > NOTE: If you access the container using bash, make sure that you execute "/opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash" in order to avoid the error "psql: local user with ID 1001} does not exist"
    
    To connect to your database from outside the cluster execute the following commands:
    
        kubectl port-forward --namespace gitlab svc/gitlib-db-postgresql 5432:5432 &
        PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432
    
  • 创建gitlab初始化数据库

在这里插入图片描述

helm 安装 redis 集群

chart: github

  • 安装日志

    [root@master2 ~]#helm install gitlib-redis -n gitlab /opt/helm/redis/
    NAME: gitlib-redis
    LAST DEPLOYED: Mon Apr 24 09:08:19 2023
    NAMESPACE: gitlab
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    NOTES:
    CHART NAME: redis
    CHART VERSION: 17.4.3
    APP VERSION: 7.0.8
    
    ** Please be patient while the chart is being deployed **
    
    Redis® can be accessed via port 6379 on the following DNS name from within your cluster:
    
        gitlib-redis.gitlab.svc.cluster.local for read only operations
    
    For read/write operations, first access the Redis® Sentinel cluster, which is available in port 26379 using the same domain name above.
    
    To connect to your Redis® server:
    
    1. Run a Redis® pod that you can use as a client:
    
       kubectl run --namespace gitlab redis-client --restart='Never'  --image 10.50.10.185/redis/bitnami/redis:7.0.8-debian-11-r0 --command -- sleep infinity
    
       Use the following command to attach to the pod:
    
       kubectl exec --tty -i redis-client \
       --namespace gitlab -- bash
    
    2. Connect using the Redis® CLI:
       redis-cli -h gitlib-redis -p 6379 # Read only operations
       redis-cli -h gitlib-redis -p 26379 # Sentinel access
    
    To connect to your database from outside the cluster execute the following commands:
    
        kubectl port-forward --namespace gitlab svc/gitlib-redis 6379:6379 &
        redis-cli -h 127.0.0.1 -p 6379
    

gitlab manifest 部署

参考

官方的chart超级复杂,组件超级多。Gitlab 主要涉及到3个应用:Redis、Postgresql、Gitlab 核心程序,实际上我们只要将这3个应用分别启动起来,然后加上对应的配置就可以很方便的安装 Gitlab 了,我们这里选择使用的镜像不是官方的,而是 Gitlab 容器化中使用非常多的一个第三方镜像:sameersbn/gitlab

  • 登录

    http://chot-gitlab.prod.com:32100/ 账密: root/xxx

  • 使用外部redis 和pg

  • 使用sameersbn的gitlab镜像

  • 使用nginx ingress 向外暴露服务 kubernetes.io/ingress.class: nginx

  • gitlab-prod.yaml

    • 注意需要将pg和redis分别开启30300和30302 nodePort
    • 这一步可优化为域名连接避免开太多的nodeport
    ---
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: gitlab-data-pvc
      namespace: gitlab
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 200Gi
      storageClassName: nfs-storage-179sc
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: gitlab
      namespace: gitlab
      labels:
        name: gitlab
    spec:
      replicas: 1
      selector:
        matchLabels:
          name: gitlab
      template:
        metadata:
          name: gitlab
          labels:
            name: gitlab
        spec:
          #nodeName: 192.168.102.22  # *
          containers:
          - name: gitlab
            image: 10.50.10.185/gitlab/sameersbn/gitlab:15.8.0-1
            imagePullPolicy: IfNotPresent
            env:
            - name: TZ
              value: Asia/Shanghai
            - name: GITLAB_TIMEZONE
              value: Beijing
            - name: GITLAB_SECRETS_DB_KEY_BASE
              value: long-and-random-alpha-numeric-string  # *
            - name: GITLAB_SECRETS_SECRET_KEY_BASE
              value: long-and-random-alpha-numeric-string  # *
            - name: GITLAB_SECRETS_OTP_KEY_BASE
              value: long-and-random-alpha-numeric-string  # *
            - name: GITLAB_ROOT_PASSWORD
              value: admin123  # *
            - name: GITLAB_ROOT_EMAIL
              value: ninesun@126.com  # *
            - name: GITLAB_HOST
              value: chot-gitlab.prod.com  # *
            - name: GITLAB_PORT
              value: "30400"
            - name: GITLAB_SSH_HOST
              value: k8s-22.host.com  # *
            - name: GITLAB_SSH_PORT
              value: "30401"
            - name: GITLAB_NOTIFY_ON_BROKEN_BUILDS
              value: "true"
            - name: GITLAB_NOTIFY_PUSHER
              value: "false"
            - name: GITLAB_BACKUP_SCHEDULE
              value: daily
            - name: GITLAB_BACKUP_TIME
              value: 01:00
            - name: DB_TYPE
              value: postgres
            - name: DB_HOST
              value: gitlib-db-postgresql-hl #headless svc name: gitlib-db-postgresql-hl
            - name: DB_PORT
              value: "5432"
            - name: DB_USER
              value: postgres
            - name: DB_PASS
              value: "postgres"  # *
            - name: DB_NAME
              value: gitlab_production # 这一步如果需要重新创建数据库,就需要单独建立。否则就把gitlab 的数据存储在默认数据库postgres
            - name: REDIS_HOST
              value: gitlib-redis-headless # headless svc name: gitlib-redis-headless
            - name: REDIS_PORT
              value: "6379" # 默认端口是6379
            ports:
            - name: http
              containerPort: 80
            - name: ssh
              containerPort: 22
            volumeMounts:
            - mountPath: /home/git/data
              name: data
            livenessProbe:
              httpGet:
                path: /
                port: 80
              initialDelaySeconds: 180
              timeoutSeconds: 5
            readinessProbe:
              httpGet:
                path: /
                port: 80
              initialDelaySeconds: 25
              timeoutSeconds: 1
          volumes:
          - name: data
            persistentVolumeClaim:
              claimName: gitlab-data-pvc
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: gitlab
      namespace: gitlab
      labels:
        name: gitlab
    spec:
      ports:
        - name: http
          port: 80
          targetPort: http
          nodePort: 30400
        - name: ssh
          port: 22
          targetPort: ssh
          nodePort: 30401
      type: NodePort
      selector:
        name: gitlab
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: gitlab
      namespace: gitlab
      annotations:
        kubernetes.io/ingress.class: nginx
    spec:
      rules:
        - host: chot-gitlab.prod.com
          http:
            paths:
              - path: /
                pathType: Prefix
                backend:
                  service:
                    name: gitlab
                    port:
                      number: 80
    
    • gitlab需要启动多久?

      启动大约需要4mins,期间可能会导致readlines probe检查失败。可以将initialDelaySeconds 调大一些

在这里插入图片描述

gitlab如何上传项目?

  • 第一步: 添加需要推送项目的服务器的公钥

    key的内容就是id_rsa.pub的内容

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NlPzyq3P-1683179705925)(https://s3-us-west-2.amazonaws.com/secure.notion-static.com/19224c7f-f2c7-4569-ace6-28b0a579233b/Untitled.png)]

  • 第二步: git 上传项目

    # 添加remote url
    git remote add origin1 http://chot-gitlab.prod.com:30400/gitlab-instance-f410c318/gitlab-ci-k8s-demo.git
    
    # 查看remote url
    git remote -v
    origin  https://github.com/myysophia/gitlab-ci-k8s-demo.git (fetch)
    origin  https://github.com/myysophia/gitlab-ci-k8s-demo.git (push)
    origin1 http://chot-gitlab.prod.com:30400/gitlab-instance-f410c318/gitlab-ci-k8s-demo.git (fetch)
    origin1 http://chot-gitlab.prod.com:30400/gitlab-instance-f410c318/gitlab-ci-k8s-demo.git (push)
    
    # 推送代码
    git push -u origin1 --all
    

gitlab监控metrics

这部分可以接入外部的grafana监控面板进行监控

http://chot-gitlab.prod.com:30400/-/metrics?token=zuqjYZFKMof22VkTRLek

gitlab runner helm 部署

  • helm 部署

    chart github:

  • 全局runner和项目runner

    官方建议自建的实例使用指定的runner,也就是每个项目一个单独的runner

    两者如何选择?

  • 全局runner token

  • 项目runner token

helm部署问题

域名解析问题

  • 参考链接

https://todoit.tech/k8s/gitlab-runner/

https://blog.csdn.net/boling_cavalry/article/details/106991576

  • 报错处理: Incorrect Usage: flag provided but not defined: -template-config

版本问题

GitLab 社区版 15.8.0 需要使用对应的runner镜像(**https://docs.gitlab.com/runner/)****

  • docker push 10.50.10.185/gitlab/registry.gitlab.com/gitlab-org/gitlab-runner:alpine-v15.8.0

  • 如何查看gitlab版本: http://chot-gitlab.prod.com:32100/help

  • config.toml 配置 如何覆盖config.template.toml

    非root用户→ 容器中~/.gitlab-runner/config.yaml

    concurrent = 10
    check_interval = 30
    log_level = "info"
    shutdown_timeout = 0
    
    [session_server]
      session_timeout = 1800
    
    [[runners]]
      name = "chot-gitlab-runner-minio-gitlab-runner-55564b6469-k2d6h"
      url = "http://chot-gitlab.prod.com:32100/"
      id = 8
      token = "vbR7MMTPKSL7dyPALsUN"
      token_obtained_at = 2023-02-17T03:24:19Z
      token_expires_at = 0001-01-01T00:00:00Z
      executor = "kubernetes"
      [runners.custom_build_dir]
      [runners.cache]
        Type = "s3"
        Shared = true
        MaxUploadedArchiveSize = 0
        [runners.cache.s3]
          ServerAddress = "chot-minio-web.prod.com:32100"
          AccessKey = "IwA5ttRQsZlKkkQV"
          SecretKey = "C07BrPYktE997bMcWUdcHyXQPVPr3mSJ"
          BucketName = "gitlab"
        [runners.cache.gcs]
        [runners.cache.azure]
      [runners.kubernetes]
        host = ""
        bearer_token_overwrite_allowed = false
        image = "10.50.10.185/gitlab/ubuntu:16.04"
        namespace = "gitlab"
        namespace_overwrite_allowed = ""
        pull_policy = ["if-not-present"]
        node_selector_overwrite_allowed = ""
        helper_image = "10.50.10.185/gitlab/ubuntu:16.04"
        pod_labels_overwrite_allowed = ""
        service_account_overwrite_allowed = ""
        pod_annotations_overwrite_allowed = ""
        [runners.kubernetes.affinity]
        [runners.kubernetes.pod_security_context]
        [runners.kubernetes.init_permissions_container_security_context]
          [runners.kubernetes.init_permissions_container_security_context.capabilities]
        [runners.kubernetes.build_container_security_context]
          [runners.kubernetes.build_container_security_context.capabilities]
        [runners.kubernetes.helper_container_security_context]
          [runners.kubernetes.helper_container_security_context.capabilities]
        [runners.kubernetes.service_container_security_context]
          [runners.kubernetes.service_container_security_context.capabilities]
        [runners.kubernetes.volumes]
        [runners.kubernetes.dns_config]
        [runners.kubernetes.container_lifecycle]
    
  • 跑通一个gitlab cicd

    https://github.com/yangshun2005/gitlab-cicd

  • gitlab exector 报错处理

    • 使用k8s exector 无法拉取镜像

      Running with gitlab-runner 15.8.0 (12335144)
        on chot-gitlab-runner-minio-gitlab-runner-6fbf87f59b-j6bhq S7qPFnrs, system ID: r_vB5NUhtcRQ1R
      Preparing the "kubernetes" executor
      00:00
      Using Kubernetes namespace: gitlab
      Using Kubernetes executor with image ubuntu:16.04 ...
      Using attach strategy to execute scripts...
      Preparing environment
      00:03
      Waiting for pod gitlab/runner-s7qpfnrs-project-1-concurrent-0bc7zl to be running, status is Pending
      WARNING: Failed to pull image with policy "IfNotPresent": image pull failed: rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host
      ERROR: Job failed: prepare environment: waiting for pod running: pulling image "ubuntu:16.04": image pull failed: rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
      

      修改runner values的文件

      image:
          registry: 10.50.10.185/gitlab
          image: ubuntu
          tag: 16.04
      
      Waiting for pod gitlab/runner-gm-nhepv-project-1-concurrent-057xgd to be running, status is Pending
      ERROR: Job failed: prepare environment: waiting for pod running: image pull failed: Failed to apply default image tag "map[image:ubuntu registry:10.50.10.185/gitlab tag:16.04]": couldn't parse image reference "map[image:ubuntu registry:10.50.10.185/gitlab tag:16.04]": invalid reference format. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
      

      exector不支持这种image的方式

      修改为

      image: 10.50.10.185/gitlab/ubuntu:16.04

      镜像拉取成功后会启动两个容器一个helper 一个 build镜像

      如果runner分配给exector的工作1小时没有完成,这些容器就退出了。

      error log

      • helper 和 build镜像启动后,容器启动报错
      /bin/bash: line 1: gitlab-runner-build: command not found
      

      gitlab 流水线报错如下:

      OCI runtime exec failed: exec failed: unable to start container process: exec: "gitlab-runner-helper": executable file not found in $PATH: unknown
      
      # 从pod yaml文件中找出 其中helper 容器中执行这段脚本
      if [ -x /usr/local/bin/bash ]; then
      exec /usr/local/bin/bash 
      elif [ -x /usr/bin/bash ]; then
      exec /usr/bin/bash 
      elif [ -x /bin/bash ]; then
      exec /bin/bash 
      elif [ -x /usr/local/bin/sh ]; then
      exec /usr/local/bin/sh 
      elif [ -x /usr/bin/sh ]; then
      exec /usr/bin/sh 
      elif [ -x /bin/sh ]; then
      exec /bin/sh 
      elif [ -x /busybox/sh ]; then
      exec /busybox/sh 
      else
      echo shell not found
      exit 1
      fi
      

      查阅官方文档后发现这个helper 镜像还是个专有镜像,下载gitlab runner对应版本的helper, 这个helper镜像就是那个具体干活的,gitlab 的 .gitlab-ci.yml 根据配置的时间间隔把活给gitlab runner。

      gitlab runner则是让helper images 去处理。所以刚开始的时候helper的image 用ubuntu是不对的。

      具体理解参考Override the helper image部分:

      Advanced configuration | GitLab

      bitnami/gitlab-runner-helper:15.8.0

      Running with gitlab-runner 15.8.0 (12335144)
        on chot-gitlab-runner-minio-gitlab-runner-75f87cfdbf-d89z6 fhyNaFUz, system ID: r_MDgwGq2YmKGA
      Preparing the "kubernetes" executor
      00:00
      Using Kubernetes namespace: gitlab
      Using Kubernetes executor with image 10.50.10.185/gitlab/ubuntu:16.04 ...
      Using attach strategy to execute scripts...
      Preparing environment
      Waiting for pod gitlab/runner-fhynafuz-project-1-concurrent-0v9gq4 to be running, status is Pending
      Waiting for pod gitlab/runner-fhynafuz-project-1-concurrent-0v9gq4 to be running, status is Pending
      	ContainersNotInitialized: "containers with incomplete status: [init-permissions]"
      	ContainersNotReady: "containers with unready status: [build helper]"
      	ContainersNotReady: "containers with unready status: [build helper]"
      Waiting for pod gitlab/runner-fhynafuz-project-1-concurrent-0v9gq4 to be running, status is Pending
      	ContainersNotInitialized: "containers with incomplete status: [init-permissions]"
      	ContainersNotReady: "containers with unready status: [build helper]"
      	ContainersNotReady: "containers with unready status: [build helper]"
      Waiting for pod gitlab/runner-fhynafuz-project-1-concurrent-0v9gq4 to be running, status is Pending
      	ContainersNotInitialized: "containers with incomplete status: [init-permissions]"
      	ContainersNotReady: "containers with unready status: [build helper]"
      	ContainersNotReady: "containers with unready status: [build helper]"
      /bin/bash: line 1: gitlab-runner-build: command not found
      

      实在没办法,提个issue吧

      April 21, 2023

      官方更新了gitlab-runner-helper镜像版本

k8s中gitlab exector架构图

一图胜千言。

在这里插入图片描述

The Kubernetes executor for GitLab Runner | GitLab

what is Gitlab Runner Helper?

helm部署gitlab runner的时候有一个help image。

Gitlab Runner Helper 是与 Gitlab Runner 一起使用的辅助容器。 Gitlab Runner 允许运行 CI/CD 作业并将结果发送回 Gitlab。

gitlab如何连接上k8s? KAS Kubernetes agent server

gitlab CI

gitlab CI template

lib/gitlab/ci/templates · master · GitLab.org / GitLab · GitLab

gitlab CI Demo

上来不应该直接尝试on k8s,为啥不从最简单的开始呢?

使用 docker部署 gitlab-runner ,注册一个exector 为shell的runner

  • 先来个简单的.gitlab-ci.yaml

    
    before_script:
      - echo "Before script section122333"
      - echo "For example you might run an update here or install a build dependency"
      - echo "Or perhaps you might print out some debugging details"
    
    after_script:
      - echo "After script section"
      - echo "For example you might do some cleanup here"
    
    build1:
      stage: build 
      script:
        - echo "Do your build heresd"
    
    test1:
      stage: test
      script:
        - echo "Do a test here"
        - echo "For example run a test suite"
    
    test2:
      stage: test
      script:
        - echo "Do another parallel test here"
        - echo "For example run a lint test"
    
    deploy1:
      stage: deploy
      script:
        - echo "Do your deploy here"
      environment: production
    

第一步: 1. 建立 Docker Volume

目前runner部署在10.50.10.36 理论上哪台有docker环境的都可以的.

$ docker volume create gitlab-runner-config

第二步: 使用创建的卷启动GitLab Runner容器:

-env TZ=CST

docker run -d --name gitlab-runner --restart always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v gitlab-runner-config:/etc/gitlab-runner \
		--add-host=chot-gitlab.prod.com:10.50.10.33 \
    10.50.10.185/gitlab/gitlab/gitlab-runner:v15.8.0

第三步: register 一个runner,exector 选择shell

root@27172e22cf90:/# gitlab-runner register
Runtime platform                                    arch=amd64 os=linux pid=54 revision=12335144 version=15.8.0
Running in system-mode.

Enter the GitLab instance URL (for example, https://gitlab.com/):
http://chot-gitlab.prod.com:30400/
Enter the registration token:
GR1348941BbkUVr8B1UumMfNx4LrL
Enter a description for the runner:
[27172e22cf90]:
Enter tags for the runner (comma-separated):

Enter optional maintenance note for the runner:

WARNING: Support for registration tokens and runner parameters in the 'register' command has been deprecated in GitLab Runner 15.6 and will be replaced with support for authentication tokens. For more information, see https://gitlab.com/gitlab-org/gitlab/-/issues/380872
Registering runner... succeeded                     runner=GR1348941BbkUVr8B
Enter an executor: docker-ssh, virtualbox, docker-ssh+machine, instance, ssh, docker+machine, kubernetes, custom, docker, parallels, shell:
docker
Enter the default Docker image (for example, ruby:2.7):
10.50.10.185/gitlab/ubuntu:16.04
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!

Configuration (with the authentication token) was saved in "/etc/gitlab-runner/config.toml"

或者一步到位:

gitlab-runner register --url http://chot-gitlab.prod.com:30400/ --registration-tokenGR1348941BbkUVr8B1UumMfNx4LrL --executor shell

第四步 查看CI结果

  • 不同exector的runner配置

    gitlab-runner register时可以指定不同的exector. 可以打不同的tag,让不同的项目或编译条件使用不同的exector.

    gitlab-runner list
    Runtime platform                                    arch=amd64 os=linux pid=27160 revision=12335144 version=15.8.0
    Listing configured runners                          ConfigFile=/etc/gitlab-runner/config.toml
    meta-162                                            Executor=docker Token=_mFCm2xiCnFd8rKaAKFg URL=http://chot-gitlab.prod.com:30400/
    meta-162                                            Executor=shell Token=_yvc4o5ycSACmtyTvBVK URL=http://chot-gitlab.prod.com:30400/
    
  • CI使用minio作为cache

    例如在java项目编译的时候会有很多依赖包需要下载,如果每次都从网络拉取不稳定,这时候如果把依赖包缓存起来,下次构建项目就很快.

    [runners.cache]
            Type = "s3"
            Shared = true
            [runners.cache.s3]
              AccessKey = "IwA5ttRQsZlKkkQV"
              SecretKey = "C07BrPYktE997bMcWUdcHyXQPVPr3mSJ"
              BucketName = "gitlab"
              ServerAddress = "chot-minio-api.prod.com:32100"
    

gitlab 和gitlab-runner的关系

GitLab CI 之 Runner 的 Executor 該如何選擇?

runner和exector的关系

runner并不是实际干活的,runner 可以指定特定的exector干活,在gitlab中有不同的exector,目前有这几种exector:

  • docker-ssh
  • virtualbox
  • docker-ssh+machine
  • instance
  • ssh
  • docker+machine
  • kubernetes
  • custom
  • docker
  • parallels
  • shell

可以结合自己的技术栈进行选择,目前我们常使用的是shell 和 docker、k8s

gitlab环境变量

这块都是gitlab预设定的一些环境变量,更多请打开CI_DEBUG_TRACE mode。

例如下面三个环境变量分别是当前gitlab实例名、绝对路径和相对路径。

$ echo "${CI_PROJECT_NAMESPACE}"
gitlab-instance-f410c318
$ echo "${CI_PROJECT_DIR}"
/home/gitlab-runner/builds/hs9MHCAM/0/gitlab-instance-f410c318/gitlab-ci-k8s-demo
$ echo "${CI_PROJECT_PATH}"
gitlab-instance-f410c318/gitlab-ci-k8s-demo

参考

用 GitLab CI 进行持续集成

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/487880.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Windows】关闭Windows Update自动更新

目录 一 服务中关闭Win10自动更新及关联服务 二 注册表中关闭Win10自动更新 三 组策略中关闭Win10自动更新 四 计划任务中关闭Win10自动更新 电脑系统盘不够用了,为此准备关闭Windows Update自动更新,以节省空间。为保证关闭之后不死灰复燃&#xff…

Ajax入门

在B/S架构中,浏览器端发送请求的传统方式如下: 1.直接在浏览器地址栏上输入url 2.超链接 3.from表单 4.在JavaScript代码中发送请求 1)window.open(url) 2)document.location.href url 3)window.location.href url ……

优思学院|精益生产在制药行业的应用情况如何?

精益生产作为一项优化生产过程、提高效率的方法论,精益生产在制药行业得到了广泛应用。其核心理念是通过消除浪费,不断改进生产流程,实现资源的最大化利用和生产成本的最小化,从而提高企业的竞争力和市场占有率。 在制药行业&…

Java语言----LinkedList 和 链表的实现

目录 一.链表概念 二.链表的分类 三.无头单向非循环链表的实现 3.1创建简单链表 3.2 链表基本方法实现 3.3四大基本功能 3.3.1.增加元素结点 3.3.2.查找元素结点 3.3.3.删除元素结点 3.3.4.结点信息修改 四.LinkedList是什么? 五.LinkedList使用方法 总结 …

蓝牙耳机哪款性价比高?2023蓝牙耳机性价比排行

随着蓝牙耳机的使用愈发频繁,蓝牙耳机产品也越来越多,蓝牙耳机的功能、价格、外观设计等都不尽相同。接下来,我来给大家推荐几款性价比高的蓝牙耳机,感兴趣的朋友一起来看看吧。 一、南卡小音舱Lite2蓝牙耳机 参考价&#xff1a…

unity,如何让当前物体获取鼠标位置,转向鼠标在屏幕中的位置?

介绍 unity,如何让当前物体获取鼠标位置,转向鼠标在屏幕中的位置? 方法 void Update() {// 获取鼠标在屏幕上的位置Vector3 mousePos Input.mousePosition;// 将鼠标在屏幕上的位置转换为世界空间中的位置Vector3 worldPos Camera.main.S…

C++11多线程join()和detach()的理解

简介 每一个程序至少拥有一个线程,那就是执行main()函数的主线程,而多线程则是出现两个或两个以上的线程并行运行,即主线程和子线程在同一时间段同时运行。而在这个过程中会出现几种情况: 主线程先运行结束子线程先运行结束主子…

NLP实战:基于Pytorch的文本分类入门实战

目录 一、前期准备 1.环境准备 2.加载数据 二、代码实战 1.构建词典 2.生成数据批次和迭代器 3. 定义模型 4. 定义实例 5.定义训练函数与评估函数 6.拆分数据集并运行模型 三、使用测试数据集评估模型 四、总结 这是一个使用PyTorch实现的简单文本分类实战案例。在…

MySQL_1 数据库的基本操作

目录 一、拾枝杂谈 1.cmd验证MySQL服务 : 2.cmd连接MySQL服务 : 3.MySQL服务 : 二、数据库介绍 1.定义 : 2.SQL语句分类 : 三、数据库操作 1.数据库的创建 : 1 基本语法 2 演示 2.数据库的删除 : 1 基本语法 2 演示 3. 数据库的查询 : 1 基本语法 2 演示 4.数据库的…

【youcans 的 OpenCV 学习课】21. Haar 小波变换

专栏地址:『youcans 的图像处理学习课』 文章目录:『youcans 的图像处理学习课 - 总目录』 【youcans 的 OpenCV 学习课】21. Haar 小波变换 1. 小波变换1.1 小波变换基本概念例程 17_1:常用小波族的图像 1.2 连续小波变换1.3 离散小波变换&a…

《通过十几轮数据进行模型训练,实现精确的无创血糖测量的演绎学习》阅读笔记

目录 0 演绎学习 1 论文摘要 2 论文十问 3 论文亮点与不足之处 4 与其他研究的比较 5 实际应用与影响 6 个人思考与启示 参考文献 0 演绎学习 在本文中,DL指的是Deduction Learning,即演绎学习方法。该方法是一种机器学习方法,通过使…

ServerPapers 开源轻量级服务器监控工具

ServerPapers 开源轻量级服务器监控工具 起因 之前用过一些服务器监控工具,但是有些配置复杂不够方便。也有些配置简单,但没有我想要显示的一些信息。所以我就花了三天时间自己写了一个开源的轻量级服务器监控工具。 项目 介绍 ServerPapers是一个基…

聚观早报|苹果版余额宝四天吸金69亿;​微软拟推出私有版ChatGPT

今日要闻:苹果版余额宝四天吸金69亿元;称微软拟推出私有版ChatGPT;特斯拉上调Model 3、Model Y售价;好莱坞编剧将举行15年来首次罢工;字节跳动要在美国卖书了 苹果版余额宝四天吸金69亿元 早些时候,苹果推…

自动驾驶TPM技术杂谈 ———— I-vista验收标准(试验规程)

文章目录 术语介绍试验准备场地要求环境要求精度要求边界车辆&路沿石 试验方法能力试验双边界车辆平行车位白色标线平行车位双边界车辆垂直车位白色标线垂直车位方柱垂直车位双边界车辆斜向车位白色标线斜向车位 新功能评价平行车位远程操控泊入泊出试验垂直车位远程操控泊…

用户界面对象的线程亲缘性第二篇: 设备上下文

在上一篇文章中,我们简单地介绍了控制窗口句柄的线程亲缘性规则。 今天,我们来讲讲设备上下文(Device Context, 简称 DC) 。 设备上下文也有一定程度的线程亲缘性。调用 DC 相关函数,例如 GetDC 的线程,必须在同一个线程中调用其…

VC++判断Windows系统是Win7、Win8,还是Win10系统(附源码)

有时候我们需要获取操作系统版本,比如win7、win8、win8.1、win10等,对不同版本的系统做特殊处理。有时我们还需要分辨当前系统是64位的,还是32位的。 1、系统API函数GetVersionEx已经被废弃,不能再使用了 以前我们一般使用系统API函数GetVersionEx去获取操作系统版本,但从…

B016_单行函数篇

2022年4月14日08:25:25 通过本章学习,您将可以: SQL中不同类型的函数 在 SELECT 语句中使用字符,数字,日期和转换函数 使用条件表达式术语 函数-预定义的接受参数的代码块单行函数-为每条记录返回一行结果多行函数-返回一个结果,每组数据处理什么是SQL函数 多行函数也叫…

【Redis—主从复制】

概念 如果把数据都存储到一台服务器上,当服务器出现宕机后,数据会丢失。而把数据备份到多台服务器上,那么当一台服务器发生故障后,其他服务器仍然可以继续提供服务。由于是多台服务器,所以服务器之间的数据要保持一致…

SwiftUI 如何动态条件显示和隐藏 Toolbar 按钮且不做无谓刷新

功能需求 在 SwiftUI 中我们可以非常容易的定制导航栏 Toolbar 中按钮的显示,包括折叠、分组和按条件动态显示和隐藏等。 如上图所示,我们仅用寥寥几行代码就实现了 SwiftUI 导航栏 Toolbar 按钮的折叠、分组和按条件动态显示隐藏等功能。 在本篇博文中,您将学到以下内容:…

Spring Cache的使用

目录 一、前言二、什么是Spring Cache?三、Spring Cache常用注解四、使用方法1.导入依赖2.开启缓存注解3.Cacheables4.CachePut5.CacheEvict6.Caching 一、前言 在日常开发工作中,缓存是一个很常见的技术手段,它可以有效地提高系统性能。当系…