In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
[Gitlab + Jenkins + Pipeline + WebHook+ Multibranch]-continuous integration and automatic release
The realization of this paper:
The code is submitted to gitlab, which automatically triggers Jenkins to build gitlab development branch merge, then automatically publishes it to gitlab master branch merge in dev environment, and then builds it automatically. Need to manually update the prod environment Jenkins preparation work Jenkinsfile preparation work Gitlab preparation work selection Jenkins task trigger verification Jenkins preparation work installation plug-in gitlabpipeline configuration Gitlab connection Open system Administration-system Settings-gitlab uncheck this option check Enable authentication for'/ project' end-point configuration GitLab connections settings Connection name and Gitlab host URLCredentials configuration add Jenkins credential type selection Gitlab API tokenAPI token access on Gitlab There is a user and has a developer role acquisition method: login user-User settings-Access Tokens Create a Token record to copy token values and save them to the credentials of Jenkins Click the following Test Connection test success will prompt Success if it fails to check whether the url address of gitlab is correctly configured multi-branch pipelining task new task Select the multi-branch pipeline configuration task to add a repository, type select GitCredentials configuration to add Jenkins credentials type select Username with Password user's access to have a user on Gitlab and have a developer role if your project type belongs to Private, this user must be a member of this project other default read Jenkinsfile files in the root directory Jenkinsfile preparation
Reference Jenkinsfile Demo
Main configuration:
/ / get gitlab connection, fill in our previous configuration gitlab connectionproperties ([gitLabConnection ('gitlab-bigdata')]) / / pull substitution code checkout scm// to tell gitlab job status updateGitlabCommitStatus name:' build' State: 'pending'// triggers different steps according to different branches if (env.BRANCH_NAME = =' master' | | env.BRANCH_NAME = = 'dev') {stage ("Build Docker Image") {echo "build docker image" echo "Only dev/master branch can build docker image"} if (env.BRANCH_NAME = =' dev') {stage ("Deploy to test") {echo "branch dev to deploy to environment test"} stage ("Integration test") {echo "test Environment Integration Test"}} if (env.BRANCH_NAME = = 'master') {stage ("Deploy to prod") {echo "branch Master to deploy to environment prod "} stage (" Health check ") {echo" prod check "}} Gitlab is ready to modify the default security request Note: log in using root when Jenkins and Gitlab are on the same machine Console-Settings-Network-outgoing request (Admin Area-settings-Network-Outbound requests) plus the check Allow requests to the local network from hooks and services of this option, save the trigger mode of the selected Jenkins task and trigger the timing manually.
Gitlab trigger
Enter the project, Settings-Integrations, fill in the address of the Jenkins task, select Push events and Merge request eventsJenkins url format: http://JENKINS_URL/project/PROJECT_NAMEWhen you configure the plugin to trigger your Jenkins job, by following the instructions below depending on job type, it will listen on a dedicated URL for JSON POSTs from GitLab's webhooks. That URL always takes the form http://JENKINS_URL/project/PROJECT_NAME, or http://JENKINS_URL/project/FOLDER/PROJECT_NAME if the project is inside a folder in Jenkins. You should not be using http://JENKINS_URL/job/PROJECT_NAME/build or http://JENKINS_URL/job/gitlab-plugin/buildWithParameters, as this will bypass the plugin completely. Verify the submitted code view status-enter the project WebHook status, click Settings-Integrations to edit the record that triggered the Jenkins to view the Recent Deliveries section, showing the latest Trigger status Pipelines status Jenkins Job status successful status WebHook status-200Pipelines status-passedJenkins Job status-successful thanks to CI/CD 's Gitlab integration Jenkins multi-branch pipeline for quality inspection and automatic release
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.