Easiest way to deploy automatic builds over remote server
In this blog, I will write down the details about how to deploy code to a remote server using Continuous Integration pipeline with GitLab repository and Jenkins as an automation tool for CI/CD.
Step 1: click on New Item from Jenkins Dashboard
Step 2: Create Free style project
Enter an item name (ex: demo)
And choose Freestyle Project
Step 3:
Click on "Ok", at the end of that page while scrolling down.
Step4:
Now configure the job
-->Give some general description of the job.
-->Discard old builds to keep you Jenkins server light weighted.
-->Select default Strategy Log Rotation
-->Can select Days to keep builds or Max # of builds to keep as per requirement.
-->Now create a GitLab Connection
Following are the process to create GitLab connection.
i) Create a developer account in GitLab and generate access token under user settings.
ii) Prerequisite for this step is few plugins needed to be installed as below In Jenkins
iii) Using the access token gitlab connection needs to be set up.
Step 5: Source Code Management
Choose Git repository and input Repository URL in given box
Credentials to the gitlab repository access should be created in jenkins credentials beforehand.
Specify the branch to build.
Mention Repository browser, select gitlab and insert URL and version.
Step 6: Build Triggers
Select Build when a change is pushed to GitLab. GitLab webhook URL: "JenkinsHostName:Port"/project/"projectname" and schedule Poll SCM which will trigger build for certain interval
Step 7: Build Environment
Select options whichever is necessary according to the need
Step 8 : Build
Set up certains post build actions such as archiving code artifacts. Files to be included can be set up here.
Step 8a: As the code should be deployed over remote server ssh needed to be integrated. In advance options if certain files needed to be excluded from build can be done.
For this step SSH servers should be set up in Jenkins configuration
That's all now workspace can be deleted once build is done to minimize jenkins server load as post build action and email notifications can be set up as per requirement.
Now the job can be saved.
Congratulations @dipanwita! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!