container registries

Integrate RazorOps with harbor


Harbor is an open source trusted cloud native registry project that stores signs and scans content. Harbor extends the open source Docker Distribution by adding the functionalities usually required by users such as security identity and management. Having a registry closer to the build and run environment can improve the image transfer efficiency. Harbor supports replication of images between registries and also offers advanced security features such as user management access control and activity auditing.

Container Registry is a single place for your team to manage Docker images, perform vulnerability analysis, and decide who can access what with fine-grained access control. Existing CI/CD integrations let you set up fully automated Docker pipelines to get fast feedback.


Prerequisites:

1. Harbor account

Install harbor with harbor installation guide .

Next login to Harbor with username and password



2. Next we move to harbor dashboard



Here select New project… from my side am selecting razorops



3. Enter to razorops project



Right side corner we have push commands


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


Razorops 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



Click on 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 below



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 here :

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"]

Gist_code

<script src="https://gist.github.com/Razorops-code/9505399cab90056329e294edbb48dbf6.js"></script>



Click on Run your first build

Running a build pipeline and successfully pushed to Harbor registry



Output logs :



Now successfully push docker image pushed to Harbor repository

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



Open the image in Harbor with tag latest-v1