How To Intigrate Harbor With RazorOps CICD

Created by Shiva G, Modified on Thu, 27 Apr, 2023 at 3:27 PM by Shyam Mohan K

"Harbor" refers to an open-source container registry that is designed to help users store, manage, and secure Docker images and other container artifacts. Harbor provides features such as access control, vulnerability scanning, and image replication to help teams manage their container deployments more efficiently and securely.

Harbor is often used in combination with other DevOps tools such as Kubernetes and Jenkins to create an end-to-end container-based software delivery pipeline. By using Harbor as a central repository for container images, DevOps teams can ensure that all images used in their deployments are trusted, tested, and secure. Additionally, Harbor can help teams manage container image versioning, audit logs, and replication across multiple data centers or cloud providers.

Overall, Harbor is a powerful tool for DevOps teams looking to streamline their container-based software development and deployment workflows while maintaining high levels of security and control.

Prerequisites:

  1. Harbor account 

 

  • Install harbor with harbor installation guide 

  • Next login to Harbor with username and password 

Next we move to harbor dashboard 

Here select New project… from my side am selecting razorops 

Enter to razorops project

Navigate to the push commands located in the upper right-hand corner.

Adding TAG to image 

Example :

docker tag SOURCE_IMAGE[:TAG] r.codecrux.com/razorops/REPOSITORY[:TAG]

 

add  image with tag v1

example image name is spring

docker tag spring:latest r.codecrux.com/razorops/spring:v1

RozorOps integration 

Login to razorops with source code repository :

Here we login with github :

Next go to integration section for integrate Harbor to Razorops 

Next go to container registries and select self-hosted 

Clicklon connect 

Next you navigate to the Registry page with URL, Username, Password…. 

Enter the fields with Harbor URL and username password like bellow  

Click on save 

Harbor registry  was connected like bellow 

 

Next move to workflow for Razorops pipeline 

Here we select create pipeline we navigate to github pipeline repo :

Select github

Select pipeline Repository 

Here i am selected spring boot project repository and click on confirm 


Next navigate to pipeline create section 

write your pipeline add to repository

tasks:


 unit-test:


   runner: razorci/openjdk:11-buster


   steps:


   - checkout


   - commands:


     - |


       mvn clean package


          ls -a


   - docker/build:


        image: r.codecrux.com/Razorops/spring


        push: true


        tags: ["latest-v1"]

    After adding the .razororps.yaml file to the repository, a pipeline will be automatically triggered in the workflow based on the commit ID.



Running a build pipeline and successfully pushed to Harbor registry 

Output logs :

 The Docker image has now been successfully pushed to the Harbor repository.

We can find image in harbor razorops repo, with name razorops/spring 

Open the image in Harbor with tag latest-v1

Conclusion:- Integrating Harbor with RazorOps CI/CD pipeline is a straightforward process that involves configuring the pipeline to push Docker images to Harbor registry. This integration enables you to manage and store Docker images securely, as well as control access to them . By integrating Harbor with RazorOps, you can store Docker images in a secure and centralized location, reducing the risk of security breaches and ensuring compliance with regulatory requirements. The integration also provides version control and access control features, enabling you to manage and share Docker images efficiently and effectively

If you require assistance with this guide, please feel free to ask for help by booking a ticket here.



Visit and Signup - https://razorops.com/





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article