DZone
DevOps Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > DevOps Zone > Continuous Integration and Continuous Deployment With GitLabCI

Continuous Integration and Continuous Deployment With GitLabCI

In just seven steps and with some software installed, you can easily create a continuous integration/continuous deployment pipeline using GitLab CI.

Amruta Kawade user avatar by
Amruta Kawade
·
Jan. 01, 19 · DevOps Zone · Tutorial
Like (4)
Save
Tweet
16.61K Views

Join the DZone community and get the full member experience.

Join For Free

Continuous integration and continuous deployment have become significant parts of the software development process. GitLab comes with built-in continuous integration, continuous deployment, and continuous delivery support to build, test, and deploy your application.

This article walks through the steps needed to create a CI/CD pipeline using GitLab CI. We are showing here how to build and deploy Angular code (front-end).

Requirements

  • You have a GitLab account and have created a GitLab repository for storing source code.

  • You have a server machine with Gitlab Runner, Maven, Ansible, Docker, and Nexus installed.

Steps

1. Register and Install Gitlab-runner

Do this step using this link: https://docs.gitlab.com/runner/install/. Note: Use the shell executor while registering Runner.

2. Add Config File to Your Project Repository

Add your source code to the repository. Add a .gitlab-ci.yml file to the root directory of your project .  Open the file and add the contents. Here, we have written build and deploy code in same stage:

.gitlab-ci.yml3. Add Variables 

Replace variables with values in the 'Variables' section under the 'Settings' tab.

Image title

4. Setup Nexus Repository

Note: Below are the settings for the current project scenario.

Nexus artifactory

5. Ansible Playbook 

Below is an Ansible playbook for the current project scenario.

Image title

6. Repository View

Now, after adding source code and config files, the repository will look as below:

Image title

7. CI/CD Pipeline Execution

Any changes to code will trigger the pipeline and we can see the status in CI/CD Pipeline tab.

Image title

You can see the complete log status if you click the 'failed' or 'passed' status icons.

Image title

Conclusion

Developers can start using this CI/CD pipeline to build and deploy by updating their code in the repository. Artifacts will be available in Nexus repository for further deployments if there are any. You can set up more jobs for enhancing the pipeline. This basic CI/CD pipeline using GitLab CI would look as below:

Image title

CI/CD Integration Software development Repository (version control)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Take Control of Your Application Security
  • Refactoring Java Application: Object-Oriented And Functional Approaches
  • Challenges to Designing Data Pipelines at Scale
  • An Overview of Key Components of a Data Pipeline

Comments

DevOps Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo