# gitlab **Repository Path**: kajum/gitlab ## Basic Information - **Project Name**: gitlab - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-10 - **Last Updated**: 2021-12-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: Git ## README # gitlab 环境 ## 使用 1.创建网络 ```shell docker network create gitlab-network ``` 2.启动 ```shell docker-compose up -d ``` 3.配置修改 `gitlab.rb` ``` # 配置http协议所使用的访问地址,不加端口号默认为80 external_url 'http://hostname' # 配置ssh协议所使用的访问地址和端口 gitlab_rails['gitlab_ssh_host'] = 'hostname' gitlab_rails['gitlab_shell_ssh_port'] = 222 # 此端口是run时22端口映射的222端口 ``` # gitlab-ci.yml ```yaml # This file is a template, and might need editing before it works on your project. # To contribute improvements to CI/CD templates, please follow the Development guide at: # https://docs.gitlab.com/ee/development/cicd/templates.html # This specific template is located at: # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml # This is a sample GitLab CI/CD configuration file that should run without any modifications. # It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts, # it uses echo commands to simulate the pipeline execution. # # A pipeline is composed of independent jobs that run scripts, grouped into stages. # Stages run in sequential order, but jobs within stages run in parallel. # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages stages: # List of stages for jobs, and their order of execution - build - test - deploy docker-build-job: stage: build tags: - docker-deploy image: tico/docker:latest services: - docker:dind variables: # 当你使用 dind 服务, 你必须让 Docker 和服务内部启动的进程沟通,进程是通过 # 网络连接的方式,而不是/var/run/docker.sock套接字。Docker 19.03会自动完成这个设置, # 是通过设置entrypoint.sh文件里的DOCKER_HOST变量来实现的。 # # 'docker' 主机名是服务容器的别名 # 注意Docker在哪里创建证书,Docker会在启动的时候自动创建这些证书, # 并且在服务容器和任务容器之间共享/certs/client目录。 # 这个共享是通过config.toml文件里的卷挂载来实现的: DOCKER_TLS_CERTDIR: "/certs" before_script: - echo "ready..." - echo $name script: - docker ps build-job: # This job runs in the build stage, which runs first. stage: build tags: - deploy script: - echo "Compiling the code..." - echo "Compile complete." unit-test-job: # This job runs in the test stage. stage: test # It only starts when the job in the build stage completes successfully. script: - echo "Running unit tests... This will take about 60 seconds." - sleep 1s - echo "Code coverage is 90%" lint-test-job: # This job also runs in the test stage. stage: test # It can run at the same time as unit-test-job (in parallel). script: - echo "Linting code... This will take about 10 seconds." - sleep 1s - echo "No lint issues found." deploy-job: # This job runs in the deploy stage. stage: deploy # It only runs when *both* jobs in the test stage complete successfully. script: - echo "Deploying application..." - echo "Application successfully deployed." ```