我想使用一个gitlab-runner来生成两个相似的,但不是完全相同的构建。
在git存储库中,我有几个分支: prod、test、dev。是否可以只使用一个跑步者在不同的路径上进行建造?
例如:
/home/gitlab-runner/builds/860ee11a/0/projectname - prod/home/gitlab-runner/builds/860ee11a/1/projectname -试验/home/gitlab-runner/builds/860ee11a/2/projectname - dev如果是的话,你是如何做到的?
发布于 2016-03-11 04:10:27
是的,你能做到的。
您可以使用以下逻辑:
image: <image> # choose your image (ryby, python, node, php etc)
# add cache for speeding up builds
cache:
paths:
- <cache-folder>/ # the name will need to be set according to your project
before_script:
- <your command> # here you set the commands you want to run for every commit
- <your command>
# add a job called 'build' -> to run your builds
build:
stage: build # this will define the stage
script:
- <your scripts> # choose the script you want to run first
only:
- build # the 'build' job will affect only 'build' branch
# add a job called 'test' -> to run your tests
test:
stage: test # this will define the stage
script:
- <your scripts> # choose the script similar to the deployment
except:
- master # the 'test' job will affect all branches expect 'master'
# the 'deploy' job will deploy and build your project
deploy:
stage: deploy
script:
- <your scripts> # your deployment script
artifacts:
paths:
- <folder> # generate files resulting from your builds for you to download
only:
- master # this job will affect only the 'master' branch您还可以使用when运行作业when (其他作业成功或失败)。
示例:
医生:
希望能帮上忙!
发布于 2016-03-10 12:26:23
是的,这是默认行为。每当你推到回购(不管分支),一个活跃的跑步者将继续运行您的构建。日志和工件是独立存储的。
在您的..gitlab ci.yml中,您可以根据分支或标记名采取不同的操作。有关更多信息,请参见http://doc.gitlab.com/ce/ci/yaml/README.html,并查找唯一和除关键字外的关键字。
最后,您可以创建使用API的触发器。请参阅http://doc.gitlab.com/ce/ci/triggers/README.html
https://stackoverflow.com/questions/35915170
复制相似问题