我正在运行 gitlab 作业,在该作业中我试图取消 CI / CD 设置中设置的某些变量。
例如,我已
SOME_VARIABLE设置为<some_value>
然后,在工作定义中,我尝试
variables:
SOME_VARIABLE: ""
script:
- echo SOME_VARIABLE - [%SOME_VARIABLE%]
Run Code Online (Sandbox Code Playgroud)
但在工作本身中我仍然得到
SOME_VARIABLE - [<some_value>]
代替
SOME_VARIABLE - []
有人遇到过这个吗?
我的 gitlab ci-cd 配置文件使用许多环境变量。为了设置它们,我使用 gitlab ci-cd 秘密变量。
例如,开发部署部分:
- echo "====== Deploy to dev server ======"
# Add target server`s secret key
- apk add git openssh bash
- mkdir ~/.ssh
- echo $DEV_SERVER_SECRET_KEY_BASE_64 | base64 -d > ~/.ssh/id_rsa
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
- echo "Test ssh connection for"
- echo "$DEV_SERVER_USER@$DEV_SERVER_HOST"
- ssh -o StrictHostKeyChecking=no -T "$DEV_SERVER_USER@$DEV_SERVER_HOST"
# Delploy
- echo "Setup target server directories"
- TARGET_SERVER_HOST=$DEV_SERVER_HOST TARGET_SERVER_USER=$DEV_SERVER_USER TARGET_SERVER_APP_FOLDER=$DEV_SERVER_APP_FOLDER pm2 deploy pm2.config.js dev setup 2>&1 …Run Code Online (Sandbox Code Playgroud) continuous-integration continuous-deployment gitlab gitlab-ci-runner devops
我有一个有角度的 (7) 项目。
在我的 package.json 中,我定义了一个命令:
{
"name": "xxx",
"version": "0.1.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build-prod": "ng build --prod",
"test": "ng test",
"test-ci": "ng test --no-watch --no-progress --browsers=ChromeHeadlessNoSandbox",
"e2e-ci": "ng e2e --protractor-config=e2e/protractor.conf.js",
"deploy": "firebase deploy --token $FIREBASE_TOKEN --non-interactive",
"lint": "ng lint",
"e2e": "ng e2e"
},
[...]
}
Run Code Online (Sandbox Code Playgroud)
当我npm run build-prod在本地运行时,一切都很好。
现在我尝试在我的 gitlab CI 上执行此代码。
为此我有以下内容.gitlab-ci.yml
image: node:10
build:
stage: build
cache:
paths:
- node_modules/
script:
- npm install --quiet
- npm …Run Code Online (Sandbox Code Playgroud) 我想从 gitlab-ci.yml 执行外部(在本地计算机上)bash 脚本,该脚本使用 docker:stable 映像。我想执行位于 gitlab docker 映像外部的startup.sh。这是可能的还是有更好的选择?
gitlab-ci.yaml
image: docker:stable
#Build script
variables:
CI_DEBUG_TRACE: "true"
DOCKER_DRIVER: overlay
before_script:
- docker --version
build:
services:
- docker:dind
script:
- docker build --no-cache -t <tag> .
- docker login -u root -p <pass> <registry>
- docker tag ...
- docker push ...
- echo "build completed"
stage: build
tags:
- <tag>
deploy_staging:
stage: deploy
script:
- ./sh startup.sh
Run Code Online (Sandbox Code Playgroud)
bash脚本
#!/bin/bash
docker login -u root -p <pass>
docker pull <image>
docker-compose up …Run Code Online (Sandbox Code Playgroud) 我们有一些作业需要几个小时才能运行,有时您可以检测到它会提前失败,因此取消作业可能会很有用。但是,当作业从作业列表中消失时,它不会释放运行程序,并且任务仍会在托管运行程序的计算机上运行。杀死它的唯一方法似乎是连接到运行程序并杀死它正在运行的进程。
跑步者如何杀死工作?Gitlab-runner 在 Linux 机器上运行,而不是在 Docker 容器内运行。
我有一个 web 应用程序,由以下部分组成: - 前端存储库 (Angular 8) - 后端存储库 (Node.js/NestJS 6)
我使用 Gitlab 作为 SCM 提供程序、docker 注册表和 CI/CD 工具。安装、检查、测试(单元)和构建已经可以与 CI 配合使用。
现在我想介绍我使用 Cypress 在前端存储库中添加的 E2E 测试。
为了使测试正常工作,我需要 - 运行后端(使用 docker-compose),包括 S3 模拟和数据库(mongo) - 将演示数据插入后端(为此获得一个脚本) - 运行指向后端 API - 运行 cypress 测试
我的问题是:如何运行包含 CI 阶段中的依赖项的 dockerized 后端,以便我有一个后端实例来运行 e2e 测试?
我已经尝试在舞台内通过 docker-compose 运行后端。这导致容器启动,但无法从 gitlab-runner 容器内访问它们。
这是前端存储库 .gitlab-ci.yml 中的一个阶段:
e2e:
image: docker:stable
stage: e2e
script:
- apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make nodejs npm git curl
- pip install …Run Code Online (Sandbox Code Playgroud) continuous-integration gitlab-ci e2e-testing gitlab-ci-runner
使用gitlab-runner执行python unittest后,testcase失败,但是gitlab显示pass。
$ python3 test/test_utils.py
test_init (__main__.Test_BslReset) ... ERROR
test_reset_all (__main__.Test_BslReset) ... ERROR
======================================================================
ERROR: test_init (__main__.Test_BslReset)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_utils.py", line 9, in setUp
self.bsl_reset = common.utils.BslReset()
File "/home/gitlab-runner/builds/FgNVsWZq/0/root/hddl-r-sanity/common/utils.py", line 119, in __init__
self.bsl_reset_src = os.path.join(get_hddl_install_dir(), 'hddl-bsl')
File "/home/gitlab-runner/builds/FgNVsWZq/0/root/hddl-r-sanity/common/utils.py", line 65, in get_hddl_install_dir
raise ValueError('Not check EnvVar(HDDL_INSTALL_DIR),Please set it!')
ValueError: Not check EnvVar(HDDL_INSTALL_DIR),Please set it!
======================================================================
ERROR: test_reset_all (__main__.Test_BslReset)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_utils.py", line 9, in setUp
self.bsl_reset = common.utils.BslReset()
File …Run Code Online (Sandbox Code Playgroud) 我正在尝试为 python 项目设置 gitlab ci 管道,但 sonarqube 客户端遇到一些问题,该客户端无法解析coverage.xml 文件
\n\n我收到的错误如下:
\n\nINFO: Python test coverage\nINFO: Parsing report \'/builds/core-tech/tools/nlu/mix-nlu-middleware/server/tests/cov.xml\'\nWARN: Invalid directory path in \'source\' element: /bolt-webserver/bolt\nWARN: Invalid directory path in \'source\' element: /bolt-webserver/tests\nERROR: Cannot resolve the file path \'base.py\' of the coverage report, the file does not exist in all <source>.\nERROR: Cannot resolve 404 file paths, ignoring coverage measures for those files\nINFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=74ms\nINFO: Sensor PythonXUnitSensor [python]\nINFO: Sensor PythonXUnitSensor [python] (done) | …Run Code Online (Sandbox Code Playgroud) 我是 gitlab CICD 的新手,我对 gitlab runner 的兴趣感到困惑。Gitlab 已经可以在项目上自动运行 CICD,而无需安装运行程序。所以我需要帮助了解建议的跑步者以及何时何地需要它?
我在 MacBook Pro 上使用 gitlab-runner 和 Docker。我使用 gitlab.com 来托管我的 git 存储库。我已经配置了一个存储库,以便每当提交被推送到存储库时就执行管道。该管道有两个任务:显示一些信息,以及克隆一个单独的存储库作为依赖项。
这是第一个作业的输出:
Running with gitlab-runner 12.2.0 (a987417a)
on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/staging-fw/my-project/.git/
Created fresh repository.
From https://gitlab.com/staging-fw/my-project
* [new branch] master -> origin/master
Checking out 722c2c38 as master...
Skipping Git submodules setup
$ python /scripts/info.py
Printing job info...
Builds …Run Code Online (Sandbox Code Playgroud) gitlab-ci-runner ×10
gitlab ×6
gitlab-ci ×6
devops ×2
docker ×2
angular ×1
angular-cli ×1
e2e-testing ×1
git ×1
pytest ×1
python ×1
python-3.7 ×1
sonarqube ×1