Generic Artifact Registry
About 419 wordsAbout 1 min
Prerequisites
Push Artifacts
Local Command Line Push
- Configure .netrc to automatically load push credentials when using curl command. Replace
<CNB_TOKEN>with actual value
printf "\nmachine \nlogin cnb\npassword %s\n" "<CNB_TOKEN>" >> ~/.netrc- Execute the following command to push to CNB. Replace
<REPO_URL>,<PACKAGE>,<VERSION>,<LOCAL_FILE_NAME>with actual values
curl --netrc '<REPO_URL>/<PACKAGE>?version=<VERSION>' -T '<LOCAL_FILE_NAME>'Push in Cloud Native Build
- Paste the following content to
.cnb.yamland commit to repository. Replace<REPO_URL>,<PACKAGE>,<LOCAL_FILE_NAME>with actual values
.cnb.yml
$:
tag_push:
- docker:
image: curlimages/curl
stages:
- name: "Configure Authentication Credentials"
script: printf "machine \nlogin cnb\npassword %s\n" "${CNB_TOKEN}" > ~/.netrc
- name: "Publish to CNB"
script: curl --netrc "<REPO_URL>/<PACKAGE>?version=${CNB_BRANCH}" -T "<LOCAL_FILE_NAME>"- Commit a Tag, which will trigger Cloud Native Build. Note: Tag value will be used as the artifact version number, please use Semantic Versioning
Push in Workspaces
Click the "Workspaces" button in the upper right corner of the repository page to enter the development environment
Execute the following command to configure credentials
printf "machine \nlogin cnb\npassword %s\n" "${CNB_TOKEN}" > ~/.netrc- Publish to CNB. Replace
<REPO_URL>,<PACKAGE>,<VERSION>,<LOCAL_FILE_NAME>with actual values
curl --netrc '<REPO_URL>/<PACKAGE>?version=<VERSION>' -T '<LOCAL_FILE_NAME>'Use Artifacts
Pull Artifacts
- Configure .netrc to automatically load push credentials when using curl command. Replace
<CNB_TOKEN>with actual value
printf "\nmachine \nlogin cnb\npassword %s\n" "<CNB_TOKEN>" >> ~/.netrc- Pull artifacts. Replace
<REPO_URL>,<PACKAGE>,<VERSION>with actual values
curl -OfL --netrc '<REPO_URL>/<PACKAGE>?version=<VERSION>'Delete Artifacts
generic does not provide delete command for now, please refer to Delete Artifacts
FQA
Q1: Package Name Restriction Rules
Package name refers to the full path, for example: a/b/c.txt
- Maximum length is 128, maximum depth is 5 levels
- Case-sensitive. a/b/c.txt and A/B/C.TXT are different paths
- Directory and file cannot have the same name. a/b/c and a/b/c/ cannot exist at the same time
- Path segments cannot start or end with space. a/ b /c.txt will throw an error during parameter validation
- Single - cannot be used as directory name or file name. a/-/c.txt is invalid
- Package name whitelist regex is:
"^[a-zA-Z0-9\u4e00-\u9fa5._\\-/ ]+$"