This document describes how to store Composer artifacts in CODING-AR for centralized artifact management and version control. The following sections introduce how to create an artifact, configure authentication, and pull and push artifacts.
Open CODING-AR
1. Log in to the CODING Console and click Use Now to go to CODING page.
2. Click in the upper-right corner to open the project list page and click a project icon to open the project. 3. In the menu on the left, click Artifact Management.
Preparations
Note:
Before you begin:
Install Composer.
Select Composer as the repository type.
Create a Composer Package (Optional)
Install Composer
Run the following command to install Composer.
curl -sS https://getcomposer.org/installer | php
Add an environment variable for global access.
mv composer.phar /usr/local/bin/composer
Initialize
mkdir composer-demo && cd composer-demo
Initialize the Composer package. Enter the required information when asked.
After initialization, a composer.json
configuration file will be added to the directory.
Go to the directory where the Composer package is located and create an auth.json
file. You can select manual or automatic configuration.
Automatic configuration
Click Generate configuration from access token and then copy the content to the auth.json
file.
Manual configuration
Copy the commands on the webpage and replace [PASSWORD]
with your service password.
Push an Artifact
Run the commands on the CODING-AR page to compress Composer package files into a zip
package and then push it to the repository using tools such as cURL
.
Enter the password configured in auth.json
and replace <version>
with the specific version number.
After the push is successful, you can view the package in CODING-AR.
Pull an Artifact
Go to the Composer package directory and set the repository URL. You can use the commands in CODING.
Replace the Composer source with the CODING repository (optional).
composer config repo.packagist false
Replace <package>
with the package to be pulled and run the pull command.
composer require < PACKAGE >:< VERSION >
Enter your service email address and password to pull the package.
If you try to pull an artifact that does not exist in the CODING private repository, the system will try to pull from the configured proxy. You can add a third-party artifact source to obtain artifacts from the specific repository. Without the need for configuration, CODING will retrieve artifacts in sequence from top to bottom.
Was this page helpful?