この記事はJapaneseで表示されません。Koreanでご覧ください。

Dev Tools

Print

The Dev Tools menu provides open source tools necessary for the development process. The tools provided include Gitea, a configuration management tool, Sonatype Nexus for software binary management and proxy, and Harbor for image storage. This page will show you how to use each tool in a simple way.

Source Repository - Gitea

Git solutions are largely divided into on-premise solutions and cloud solutions. Github is a representative cloud solution. If you use a cloud solution, security issues or cost issues may arise because it is a public network. Modernization Platform provides Gitea, a built-in solution, as a default. Gitea's account and permissions are linked to Modernization Platform's account and permissions.

Connecting to Gitea

You can access it through the project menu Dev Tools > Source on the console screen.

The Gitea account is linked to the account you logged into the console with. When you first log in, you will be asked to enter a password, and you can use the password you enter to perform commands such as pull and push on Git.

Granting users permissions

Granting Gitea permissions to project members is only possible if you are a project admin or a user with the user-administrator role.

Go to Administrator > Members in the project menu on the console screen. Click the user ID or edit button to grant permissions and go to the details screen.

You can grant permissions by directly granting a role to a user or by adding the user to a group that has the role. If multiple permissions are granted to a user at the same time, the highest permission is applied.

Create a Repository

Git Repository is a repository that stores and manages files or folders. Usually, one repository is created for each application.

In Gitea, a repository can be created under your own account or organization. Anyone can create a repository under your own account. To create a repository under an organization, you need permission to create a repository in that organization. Only users who have been granted the git-administrator or git-writer role in the console can create a repository under the organization. In Modernization platform v2.0, Gitea's organization is managed by mapping 1:1 with the project in the console. The organization name is created as {realm}-{project}.

Click the + button at the top right of the organization to select a new repository or click the New Repository button under the organization name.

Enter the required owner and repository name and click the Create Repository button.

  1. Owner: Decide whether to create the repository under a personal account or under an organization.
  2. Repository Name: Enter the name of the repository.
  3. Visibility: Select whether to make the repository public. If made public, anonymous users who are not logged in to Gitea can also view the source of the repository.
  4. Description: Enter a description of the repository.
  5. Issue Labels: You can specify a set of labels that can be used when registering issues in the repository.
  6. .gitignore: Gitea provides sample .gitignore files for each language. Select the desired .gitignore.
  7. License: You can select the license for the repository.
  8. README: You can select whether to create a Readme file for the repository.
  9. Initialize Repository: If checked and you create a repository, the files selected in 6, 7, and 8 will be automatically added.
  10. Create Repository: The repository is created.

Download the source

The source code of the repository can be downloaded via git cli. You can check the checkout URL on the repository's main screen.

$ git clone https://GITEA-URL/realm-myproject/my-application.git
Cloning into 'my-application'...
Username for 'https://GITEA_URL': testuser
Password for 'https://testuser@GITEA_URL':
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.

If you are initially downloading the source code, you can use the git clone command to download it. Once you have downloaded the source, use git pull to download changes.

Upload source

You can upload the source code you added or changed locally via git cli.

  1. Check the list of changed source code - git status

    1. $ git status
      On branch master
      Your branch is up to date with 'origin/master'.
      
      Untracked files:
        (use "git add <file>..." to include in what will be committed)
      
              Application.java
      
      nothing added to commit but untracked files present (use "git add" to track)

      You can see that a file called Application.java has been added, but it is in an Untracked state. Git does not include Untracked files in the Commit target.

  2. Tracking changed source code - git add

    1. $ git add Application.java
      
      $ git status
      On branch master
      Your branch is up to date with 'origin/master'.
      
      Changes to be committed:
        (use "git reset HEAD <file>..." to unstage)
      
              new file:   Application.java

      If you check status again after running git add, you can see that the file is included in the tracked list.

  3. Commit source code - git commit

    1. $ git commit -m "Add Application.java"
      [master 76f4940] Add Application.java
       1 file changed, 0 insertions(+), 0 deletions(-)
       create mode 100644 Application.java

      You can commit changed files using the git commit command. In this case, commit means committing to the local repository, and you must also perform git push to upload to the remote (Gitea server).

    2. Before git commit, the user information to commit must be set.

    3. $ git config --global user.email "[email protected]"
      $ git config --global user.name "user name"
  4. Uploading source code - git push

    1. $ git push origin BRANCH_NAME
      Username for 'https://GITEA_URL': testuser
      Password for 'https://testuser@GITEA_URL':
      Counting objects: 3, done.
      Delta compression using up to 8 threads.
      Compressing objects: 100% (2/2), done.
      Writing objects: 100% (3/3), 289 bytes | 289.00 KiB/s, done.
      Total 3 (delta 0), reused 0 (delta 0)
      remote: . Processing 1 references
      remote: Processed 1 references in total
      To https://GITEA_URL/realm-myproject/my-application.git
         40cddcc..76f4940  master -> master
    2. The origin after the git push command refers to the remote repository (gitea server). BRANCH_NAME is the name of the git branch to which you want to upload the source.

Reference Documents

Gitea Official Guide

How to use Git

Nexus

Nexus is a repository management tool created by Sonatype. You can create repositories in various formats, such as Java Library, Node module, and Container Image. You can upload libraries you have developed yourself or use them as mirrors of the main repository (Maven Repository, NPM Repository, etc.).

General users are not issued an account to log in to Nexus, so if you need to create a repository or use it, you must request it from the administrator.

You can access it through the project menu Dev Tools > Nexus on the console screen.

If you access the Browse menu of Nexus, you can check the list of repositories. There are formats for repositories such as maven and npm. You can set three types for each format: proxy, hosted, and group. Proxy is a repository that literally proxyes an external repository (such as M2 repository). Through this proxy type repository, you can cache data from an external repository and receive libraries even in a closed environment. Hosted is a repository where you can upload libraries you have created yourself. A group is a repository that can group proxy and hosted repositories. It searches for libraries in the order they are grouped.

Using as a Maven Mirror

If your local development environment or CI build environment is private (closed network), you may not be able to receive libraries from the main repository on the public (internet). In this case, you can use Nexus as a Mirror to receive libraries. You can change the behavior of maven without modifying the pom.xml file by using the settings.xml file.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  ...
  <mirrors>
    <mirror>
      <id>modernizationplatform</id>
      <name>Modernization Platform Nexus</name>
      <url>NEXUS_REPOSITORY_URL</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  ...
</settings>

Each Nexus repository has a URL. You can get the URL of the repository by clicking the Copy URL button in the repository list. Enter the URL of the repository in the NEXUS_REPOSTIROY_URL of the settings.xml file. Typically, a repository of group type that combines proxy and hosted is used.


Enter the id of the repository specified in the pom.xml file in mirrorOf. In Maven, if a repository is not specified separately in the pom.xml file, central (https://repo.maven.apache.org/maven2) is used by default. To receive all libraries through Nexus, specify mirrorOf as *.


Create a settings.xml file as in the example and set it to view the settings.xml file according to the IDE (eclipse, vscode, intelliJ, etc.) you are using.

Using Gradle Proxy

Even if you use Gradle, you can perform a build using Nexus as a library repository.

Modify the contents of the project's build.gradle file as follows.

repositories {
    // mavenCentral()
    maven {
        url "NEXUS_REPOSITORY_URL"
    }
}

Normally you would use maven central (https://repo.maven.apache.org/maven2) via mavenCentral() . 

You can remove this part and change the configuration to look at Nexus.

Harbor

To run an application as a container, you need to build a container image and an image repository to store the image. The most widely known service-type repository is Docker Hub. Since there may be cost or security issues when using Docker Hub, Modernization Platform provides Harbor, an installable repository.


Harbor is an installable open source image repository. It is used as a repository for container images and Helm charts, and provides functions such as role-based access control and image vulnerability inspection.


Accessing Harbor

You can access it through Dev Tools > Images in the project menu of the console.


The Harbor account is linked to the console account. When you create the first user in Modernization Platform v2.0, there is no account in Harbor yet. If you log in to the Modernization Platform console with that account and access Harbor, a Harbor account will be automatically created.


Granting Harbor permissions to users

Only project administrators or users with the user-administrator role can grant Harbor permissions to project members.


Harbor permissions can be set for each project. When you create a project in Modernization platform v2.0, a project is automatically created in Harbor, and when you grant permissions to a user in the console, permissions are automatically added to the Harbor project.


Go to Administrator > Members in the project menu on the console screen. Click the user ID or edit button to grant permissions and go to the details screen.


You can grant permissions by directly granting a role to a user or adding a user to a group that has a role. If multiple permissions are granted to a user at the same time, the highest permission will be applied.


Uploading an Image

Adding a Tag to an Image to Upload


To upload an image to Harbor, you must grant a Harbor URL and tag to the image.

$ docker tag {IMAGE_NAME}:{TAG} {HARBOR_URL}/{PROJECT}/{IMAGE_NAME}:{TAG}
  • IMAGE_NAME : 업로드 할 원본 이미지의 이미지 명입니다.

  • TAG : 업로드 할 원본 이미지의 이미지 태그입니다.

  • HARBOR_URL : Harbor 의 접속 URL 입니다. 프로토콜을 제거한 Harbor 의 도메인명만 사용합니다. ex) harbor.cloudzcp.net

  • PROJECT : Harbor 에 생성되어 있는 프로젝트 명을 입력합니다.

Docker login

To upload an image from your local environment to Harbor, you must authenticate (docker login) with your Harbor account and CLI Secret. The login account name used here is the same as the user account name on the console. You can check the CLI Secret as follows.

on the Harbor screen, click the User Name > User Profile menu at the top right.

Click the CLI secret copy button in the pop-up window to copy the secret to the clipboard.

$ docker login tworld-registry.skt.cloudzcp.com
Username: {USERNAME}
Password: {CLI_SECRET}
Login Succeeded
  • USERNAME: Enter the user's login account.

  • Password: Enter the CLI secret value copied above.

Upload Image

Upload the image to Harbor using the docker push command.

$ docker push {HARBOR_URL}/{PROJECT}/{IMAGE_NAME}:{TAG}
The push refers to repository [{HARBOR_URL}/{PROJECT}/{IMAGE_NAME}]
cfd97936a580: Pushed
latest: digest: sha256:febcf61cd6e1ac9628f6ac14fa40836d16f3c6ddef3b303ff0321606e55ddd0b size: 527

The {HARBOR_URL}/{PROJECT}/{IMAGE_NAME}:{TAG} value uses the value with the tag added above.

Download Image

Download the image from Harbor using the docker pull command.

If the project in Harbor is private (most of them are), you must first perform docker login as you would when uploading an image.

$ docker pull {HARBOR_URL}/{PROJECT}/{IMAGE_NAME}:{TAG}
latest: Pulling from {PROJECT}/{IMAGE_NAME}
24fb2886d6f6: Pull complete
Digest: sha256:febcf61cd6e1ac9628f6ac14fa40836d16f3c6ddef3b303ff0321606e55ddd0b
Status: Downloaded newer image for {HARBOR_URL}/{PROJECT}/{IMAGE_NAME}:{TAG}

The {HARBOR_URL}/{PROJECT}/{IMAGE_NAME}:{TAG} value uses the value with the tag added above.

Online consultation

Contact us

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.