Updated on 2024-01-25 GMT+08:00

Managing Self-hosted Repos

You can edit repository descriptions, add paths, delete repositories, and manage user permissions.

Editing Repository Descriptions and Paths

  1. Access the self-hosted repo homepage. In the left pane, click the name of the repository to be edited.
  2. Click Settings on the right of the page to display the basic information about a repository.
  3. Edit the repository description as required and click Submit.

    On the basic information page, the repository name, package type, home project, and permission scope cannot be modified.

    On the Basic Information page of the repository, enter the path and click to add paths for the Maven, npm, Go, PyPI, RPM and Conan repositories.

    Click to delete a path.

Configuring Deployment Policies

The self-hosted repo supports three version policies: Allow redeploy, Disable redeploy, and Read-only. You can set whether to allow artifacts in the same path to be uploaded and overwrite the original package.

  1. Access the self-hosted repo homepage. In the left pane, click the repository name.
  2. Click Settings on the right of the page. The basic information about the repository is displayed. Click the Deployment Policies tab.

    • Allow redeploy (selected by default): Artifacts in the same path can be uploaded. After being uploaded, the original package will be overwritten.
    • Disable redeploy: Artifacts in the same path cannot be uploaded.
    • Read-only: Artifacts cannot be uploaded, updated, or deleted. You can download an uploaded artifact.

  3. Click OK.

Deleting a Repository

You can delete a self-hosted repo. Deleted repositories are moved to the recycle bin.

  1. Access the self-hosted repo homepage. In the left pane, click the name of the repository to be deleted.
  2. Click Settings on the right of the page to display the basic information about a repository.
  3. Click Delete. Check that the deleted repository is no longer displayed in the repository list in the left pane.

Managing Repository Permissions

After a repository is created, the mapping between project members and repository roles is as follows:

  • The project creator and project manager are repository administrators.
  • The developer, test manager, tester, and O&M manager are repository developers.
  • The participant, viewer, and customized roles are repository viewers.

To add or delete permissions for self-hosted repo members, perform the following steps:

  1. Go to the self-hosted repo page and select the target repository from the list.
  2. Click Settings on the right of the page.
  3. Click the Repository Permissions tab. The added repository members are displayed in the list.

  4. Add members.

    Click Add Members in the upper left corner, select a member, and click Next.

  5. Assign roles to the member.

    Select Repository Administrator, Repository Developer, or Repository Viewer from the Repository Roles drop-down list.

  6. Click OK. The repository member is added and the repository role is configured. The newly added member is displayed in the list.
  7. In the member list, select multiple repository members and click Repository Roles to configure repository roles in batches.

The following table lists the operations of each repository permission.

Operation/Role

Tenant Administrator

Non-Tenant Administrator

Repository Administrator

Developer

Viewer

Repository Administrator

Developer

Viewer

Create a self-hosted repo

×

×

×

Edit a self-hosted repo

×

×

×

Manage the association between repositories and projects

×

×

×

Upload a private component

×

×

Download a component

Delete a component

×

×

Restore a component

×

×

Permanently delete a component

×

×

Delete a repository

×

×

×

×

×

Restore a repository

×

×

Permanently delete a repository

×

×

×

×

×

Clear recycle bin

×

×

×

Restore all

×

×

×

Manage user permissions

×

×

  1. Tenant administrators (IAM users with the Tenant Administrator permissions) can manage all projects of a tenant.
  2. Project creators who are not tenant administrators have the permissions listed in the preceding table.
  3. IAM users created without being added to any groups do not have permissions. Administrators can assign permissions to these IAM users on the IAM console. Then users can use cloud resources in the account based on the assigned permissions. For details, see Creating a User Group and Assigning Permissions.

Set-Up

You can connect the self-hosted repo to a local development environment so that private components in the self-hosted repo can be used during local development.

  1. Access the self-hosted repo homepage. In the left pane, click the name of the repository to be connected to the local development environment.
  2. ClickTutorial on the right of the page.
  3. In the displayed dialog box, click Download Configuration File to download the configuration file to your local directory.
  4. Copy the downloaded file to the corresponding directory based on the instructions in the Information dialog box.

Configuring the Encryption Mode of a Self-hosted Maven

Selecting Maven as the dependency management tool

  • Ensure that you have installed JDK and Maven.
  • Download the provided configuration file, or modify the Maven settings.xml file in the conf or .m2 directory according to the following procedure.

To encrypt a password, perform the following operations:

  1. Create a master password.

    mvn --encrypt-master-password <password>

    The following encrypted password is generated: {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}.

    Save it to the ${user.home}/.m2/settings-security.xml file. For example:

    <settingsSecurity>
    <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
    </settingsSecurity>

  2. Encrypt the password.

    mvn --encrypt-password <password>

    The following encrypted password is generated: {COQLCE6DU6GtcS5P=}.

    Save it to the settings.xml file. For example:

    <settingsSecurity>
    <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
    </settingsSecurity>

Selecting Gradle as the dependency management tool

  • Ensure that you have installed JDK and Gradle.
  1. Add the nu.studer.credentials plug-in to the build.gradle file in the Gradle project.

    plugins{   
     id 'nu.studer.credentials' version '2.1'
    }

  2. Create an encryption password.

    gradle addCredentials -PcredentialsKey=accountPassword -PcredentialsValue="**"

    The following encrypted password is generated: cVe******kg\=\=.

    By default, the data is stored in the GRADLE_USER_HOME/gradle.encrypted.properties file. For example:

    accountPassword=cVe******kg\=\=

  3. Configure the repository with an encrypted password in the build.gradle file.

    def password = credentials.accountPassword
                   repositories {
                     maven {
                       credentials {
                         username 'cn-north-1_f9e40463c23845438ca9efd3a7ec854e_67902fb51ded48c2868310a07e1569e7'
                         password password
                       }
                       url 'https://devrepo.devcloud.huaweicloud.com/artgalaxy/cn-north-1_f9e40463c23845438ca9efd3a7ec854e_maven_1_7/'
                     }
                   }

Resetting the Repository Password

You can reset the password in the self-hosted repo configuration file. After the password is reset, download the configuration file again to replace the original file.

  1. Access the self-hosted repo homepage. Click above the repository list on the left and choose Reset Repository Password.
  2. In the displayed dialog box, click OK. Check that a message is displayed indicating the password has been reset.

Obtaining the Self-hosted Repo Path

The path of the self-hosted repo will be used when you connect the repository to the local development environment. You can perform the following operations to obtain the path:

  1. Access the self-hosted repo homepage. In the left pane, click the repository name.
  2. The path of the self-hosted repo is displayed in the repository details on the page. You can click to obtain the path.

Obtaining the Association Between the Self-hosted Maven Repo and Project

When uploading a Maven component to the self-hosted repo through a build task, specify the repository path in the Build with Maven step.
  • Do not configure POM: The dependency package is not released to the self-hosted repo.
  • Configure all POMs: If you run the mvn deploy command, the dependency package is released to the specified release repository and snapshot repository.

    After the self-hosted Maven repo is associated with a project, you can select the repository in the build step of the build task in the project.

  1. Access the self-hosted repo homepage. In the left pane, click the name of a self-hosted Maven repo.
  2. Click Settings on the right of the page, and choose Project Associations.
  3. In the Operation column of the target project in the self-hosted Maven repo, click .
  4. In the displayed dialog box, select the repository name, and click OK.

    After an "Operation successful" message is displayed, the value of Associated Repositories for the project will be updated according to the number of selected repositories.