In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
. gitlab-ci.yml
. gitlab-ci.yml is used to configure what CI does in your project. This file is located in the root directory of the repository.
When there is a new content push to the repository, or after the code is merged, GitLab will look for the. gitlab-ci.yml file, and if the file exists, Runners will start build this commit based on the contents of the file.
Gitlab-ci.yml uses YAML syntax, you need to pay special attention to indent format, to use spaces to indent, not tabs to indent.
Stages
Stages represents the construction phase, which is, to put it bluntly, the process mentioned above. There are 3 stages by default: build, test, and deploy. We can define multiple Stages in a single Pipeline, and these Stages will have the following characteristics:
All Stages will run sequentially, that is, when one Stage is complete, the next Stage will start.
The build task (Pipeline) will be successful only when all Stages are completed.
If any of the Stage fails, the subsequent Stages will not be executed and the build task (Pipeline) fails
Jobs
Jobs stands for build work, and represents work performed within a Stage. We can define multiple Jobs in Stages, and these Jobs will have the following characteristics:
1. Jobs in the same Stage will be executed in parallel
2. The Stage will be successful only if all the Jobs in the same Stage are executed successfully.
3. If any Job fails, the Stage fails, that is, the build task (Pipeline) fails
Constraint
There must be a script part in the task.
Example
# define stages (phase). The tasks will be performed in this order.
Stages:
-build
-test
-deploy
# define job (task)
Job1:
Stage: test
Tags:
-XX # only runner labeled XX will perform this task
Only:
-dev # this task is performed only if the dev branch submits the code. It can also be a branch name or a trigger name
-/ ^ future-.*$/ # regular expressions, only branches that begin with future- are executed
Script:
-echo "I am job1"
-echo "I am in test stage"
# define job
Job2:
Stage: test # if stage is not defined here, it is also test by default
Only:
-master # this task is performed only if the master branch submits the code
Script:
-echo "I am job2"
-echo "I am in test stage"
Allow_failure: true # allows failure, that is, it does not affect the next build
# define job
Job3:
Stage: build
Except:
-dev # with the exception of the dev branch, all branches submit code to perform this task
Script:
-echo "I am job3"
-echo "I am in build stage"
# define job
.job4: # for job that you don't want to execute temporarily, you can choose to add a "." in front of it, so that you can skip this task, otherwise you need to comment out the stage with deploy in addition to commenting out the job4.
Stage: deploy
Script:
-echo "I am job4"
# template, which is equivalent to a common function, is useful when there are repetitive tasks
.job _ template: & job_definition # create an anchor, 'job_definition'
Image: ruby:2.1
Services:
-postgres
-redis
Test1:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.