我正在使用gitlab CI runner来测试我的代码并生成一些文件.我只是想通过CI runner将生成的文件推送到gitlab存储库.有没有办法做到这一点?
与我的同事一起,我们致力于开发一个每天变得越来越重要的C++库.我们已经通过gitlab-ci.yml文件构建了持续集成实用程序,让我们:
各种让我们选择GitLab的东西!
我们希望对整个库进行概述,并将基准推送到一个单独的项目中.我们已经使用SSH密钥方法完成了类似的文档,但是这次我们想避免这种情况.
我们尝试了这样的脚本:
test_ci_push:
tags:
- linux
- shell
- light
stage: profiling
allow_failure: false
only:
- new-benchmark-stage
script:
- git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.mycompany.home/developers/benchmarks.git &> /dev/null
- cd benchmarks
- touch test.dat
- echo "This is a test" > test.dat
- git config --global user.name "${GITLAB_USER_NAME}"
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git add --all
- git commit -m "GitLab Runner Push"
- git push http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.mycompany.home/developers/benchmarks.git HEAD:master
- cd ..
Run Code Online (Sandbox Code Playgroud)
我们还尝试了一个基本 …
在我的CI管道中,我正在生成一个public/graph.png可视化我的代码某些方面的工件。在以后的步骤中,我想将其从CI管道中提交给仓库。这是相关的部分.gitlab-ci.yml:
commit-graph:
stage: pages
script:
- git config user.email "cipipeline@example.com"
- git config user.name "CI Pipeline"
- cd /group/project
- mv public/graph.png .
- git add graph.png
- git commit -m "committing graph.png [ci skip]"
- echo $CI_COMMIT_REF_NAME
- git push origin HEAD:$CI_COMMIT_REF_NAME
Run Code Online (Sandbox Code Playgroud)
当管道在gitlab中运行时,它失败并显示:
$ git config user.email“ cipipeline@dhgitlab.dunnhumby.co.uk”
$ git config user.name“ CI管道”
$ cd / group / project
$ mv public / graph.png。
$ git add graph.png
$ git commit -m“ committing graph.png [ci …