gitlab-development-kit部署gitlab

环境

  • mac 12.6.4
  • xcode 13.4
  • gdk 0.2.10
  • gitlab-foss 13.7

安装

  • 依赖
    # install ohmyzsh
    $ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    # 安装homebrew
    $ xcode-select --install
    $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    $ brew update
    # 安装依赖 https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/v0.2.10/doc/advanced.md#macos
    $ git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git
    $ cd gitlab-development-kit
    $ git checkout v0.2.10
    
    $ brew bundle
    $ brew link pkg-config
    $ brew pin libffi icu4c readline re2
    $ if [ ${ZSH_VERSION} ]; then shell_file="${HOME}/.zshrc"; else shell_file="${HOME}/.bash_profile"; fi
    $ echo 'export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ${shell_file}
    $ source ${shell_file}
    $ brew install chromedriver --cask
    
  • install and set up GDK
    $ rm Gemfile.lock
    $ make bootstrap
    # gdk install gitlab_repo= 依赖ruby 3.0.5 所以直接clone
    # gdk install gitlab_repo=git@gitlab.com:gitlab-org/gitlab-foss.git
    $ git clone git@gitlab.com:gitlab-org/gitlab-foss.git gitlab
    $ cd gitlab; git checkout v13.7.0; cd -
    $ make install
    
  • 配置nginx
    $ echo '127.0.0.1 gdk.test' | sudo tee -a /etc/hosts
    $ brew install nginx
    # vim gdk.yml
    hostname: gdk.test
    port: 3443
    https:
      enabled: true
    nginx:
      enabled: true
      http2:
        enabled: true
      ssl:
        certificate: gdk.test.pem
        key: gdk.test-key.pem
    
    $ gdk reconfigure
    $ gdk restart
    # HTTP: http://gdk.test:8080
    # HTTPS: https://gdk.test:3443
    
  • goproxy 配置https 80
    $ git clone https://gitlab.com/firelizzard/super-simple-proxy
    $ cd super-simple-proxy;
    $ go run . -netrc -secure gdk.test:443 -key /path/to/gdk.test-key.pem -cert /path/to/gdk.test.pem -insecure gdk.test:80 -forward gdk.test,gdk.test:3443
    # https://gdk.test (port 443 is default for HTTPS).
    # entirely disable downloading checksums for all Go modules
    export GOSUMDB=off
    # disable checksum downloads for all projects
    export GONOSUMDB=gdk.test
    # disable checksum downloads for projects within a namespace
    export GONOSUMDB=gdk.test/namespace
    # disable checksum downloads for a specific project
    export GONOSUMDB=gdk.test/namepsace/project
    
  • 遇到问题
    • openssl
      # vim ~/.zshrc 修改openssl@3 -> openssl@1.1 
      # Added by GDK bootstrap
      export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl@1.1 --with-readline-dir=/usr/local/opt/readline"
      
    • thrift
      # gem install thrift -v '0.16.0'  -- --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value"
      $ gem install thrift -v 0.16.0 -- --with-cppflags="-Wno-compound-token-split-by-macro"
      
    • goproxy
      $ go env -w GOPROXY=https://goproxy.cn,direct
      # vim Makefile
      export GOPROXY ?= https://goproxy.cn
      
    • brew services
      $ sudo rm -rf /Library/Developer/CommandLineTools
      $ xcode-select --install
      
    • jaeger-all-in-one: truncated gzip input tar: Error exit delayed from previous errors.
      # https://github.com/bytedeco/javacpp-presets/issues/150
      $ rm -rf jaeger*
      
    • undefinded URI
      # vim lib/gdk/config.rb
      $ require 'uri'
      
    • gdk reconfigure remember!
      # vim lib/gdk.rb 从gem/bin/gdk 复制
      def self.remember!(directory)
      	File.open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
        		f.puts File.realpath(directory)
      	end
      	true
      rescue StandardError => e
      	warn e
      	false
      end
      
GitLab Runner是一个开源项目,是GitLab CI/CD系统的组件之一。它负责执行定义在GitLab CI/CD的pipelines中的作业。GitLab Runner允许开发人员在包含Docker、Kubernetes等各种环境中运行作业。 Maven是一个用于构建Java项目的工具。它提供了一个强大的依赖管理系统,可以自动下载和管理项目所需的依赖。通过Maven,开发人员可以定义项目的结构以及构建、测试和部署项目的过程。 JDK(Java Development Kit)是Java开发工具包的缩写,是用于开发Java应用程序的软件包。JDK包括Java运行时环境(JRE)、编译器(javac)、调试器(jdb)以及用于创建、编译和运行Java应用程序所需的其他工具。 在GitLab Runner中使用Maven和JDK版本是非常常见的。可以通过在.gitlab-ci.yml文件中定义构建和测试阶段的作业,指定要使用的Maven版本和JDK版本。 例如,可以在.gitlab-ci.yml文件中定义一个作业来构建和测试Java项目: ```yaml build: stage: build script: - mvn clean package ``` 在这个例子中,作业名为build,打包阶段执行的命令是mvn clean package。这将使用默认的Maven版本和JDK版本来构建项目。 如果需要指定特定的Maven版本和JDK版本,可以在.gitlab-ci.yml文件中使用variables选项定义环境变量。 ```yaml variables: MAVEN_VERSION: "3.6.3" JDK_VERSION: "11" build: stage: build script: - mvn clean package ``` 在这个例子中,指定了Maven版本3.6.3和JDK版本11。作业将使用这些指定的版本来构建项目。 总之,GitLab Runner可以与Maven和JDK一起使用,通过在.gitlab-ci.yml文件中定义作业和使用环境变量,可以指定要使用的特定Maven版本和JDK版本来构建和测试项目。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

it&s me

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值