version v7.2.
For up-to-date documentation, see the
latest version.
Artifactory - Upload Artifacts
5 minute read
Methods to Upload Artifacts
Uploading artifacts to Artifactory involves storing your build outputs, libraries, or other files within one of Artifactory’s repositories.
Here’s how to upload artifacts in Artifactory and some tips on how to use the functionality efficiently:
Web UI Upload
Uploading artifacts through the Web UI is not recommended for most artifacts:
- Slow Performance: It takes a significant amount of time compared to programmatic methods.
- Timeout Failures: Uploads frequently fail based on platform-configured network timeouts (e.g., nginx, Zscaler, etc.).
- Unreliability: The UI connection is generally not reliable for consistent artifact delivery.
- Size Limitations: UI uploads are strictly limited in size (platform dependent). Expected Solution: To avoid these issues, we highly recommend using the JFrog CLI or REST API (cURL) commands explained below. These are the recommended, robust solutions to upload or download artifacts safely and efficiently.
Step-by-Step Process :
- Log in to the Artifactory Web UI.
- Navigate to the relevant local repository where you want to store your artifact
(e.g.,
private-maven-test-local). - Select the Deploy button.
- Either drag and drop the artifact into the provided upload area or use the Browse button to select the file from your system.
- Configure the target path within the repository.
- Select Deploy to upload the artifact.
This method should be used for exceptional cases; always prefer programmatic ways (cURL / JFrog CLI).
REST API Upload (cURL)
You can automate and manage your repository efficiently without the UI limitations with the REST API. You can discover all available endpoints in the official REST API guide.
Endpoint: PUT /artifactory/{repoKey}/{filePath}
Construct the upload URL using your repository key and desired file path.
Use a command-line tool like
curlor integrate it within a script to upload:curl -H "X-JFrog-Art-Api:<api_key>" -T <file> "http://<artifactory_url>/artifactory/<repoKey>/<filePath>"Execute the command to upload the artifact.
Advantages: Highly reliable, bypasses UI timeout limitations, suitable for automation, can handle multiple or batch uploads, and integrates well with CI/CD pipelines.
Artifactory CLI (JFrog CLI)
The JFrog CLI is the most robust replacement for UI uploads, specially designed to handle large files and network interruptions gracefully.
Installation: Download and install the JFrog CLI .
Configuration:
jfrog rt configUpload Command:
jfrog rt u "<local_file_path>" "<repository_path>"
Uploading to a Specific Project (JFrog CLI):
To upload an artifact and explicitly assign it to a target project,
use the --project flag followed by your Project Key:
jfrog rt u "<local_file_path>" "<repository_path>" --project "<project_key>"
Advantages: Simplifies interactions with Artifactory, natively supports bulk uploads, handles large artifact sizes reliably without UI timeout drops, and integrates well with automation scripts.
Build Tools Integration
Various build tools can integrate with Artifactory to manage and upload artifacts:
- Maven:
- Configure Artifactory as a distribution repository in your
pom.xml. - Deploy artifacts using the
mvn deploycommand.
- Configure Artifactory as a distribution repository in your
- Gradle:
- Set up Artifactory credentials and repository in your
build.gradle. - Use the
gradle publishtask to upload artifacts.
- Set up Artifactory credentials and repository in your
- npm:
- Configure Artifactory registry in
.npmrc. - Use
npm publishto upload the package.
- Configure Artifactory registry in
- Docker:
- Tag your Docker image with the Artifactory repository URL.
- Use
docker pushto upload the image.
NextGen CICD
NextGen CICD is a modern approach to continuous integration and continuous delivery.
You can find more information on the Artifactory NextGen CICD . You can also find various exemples for Python or Java of using the NextGen CICD with Artifactory.
Tips for Efficiently Using Artifactory Uploads
Efficient Use of Repositories:
- Organize artifacts logically within repositories (e.g., separate snapshots from releases). This helps in managing versioning and access controls efficiently.
Use Checksums:
- Artifactory’s checksum-based storage prevents redundant uploads and saves storage space. Make sure to use checksum verification when uploading artifacts through API or CLI.
Bulk Uploads:
- For large numbers of files or large artifacts, use the JFrog CLI or REST API to script bulk uploads. This ensures efficiency and decreases the risk of manual errors and network drops.
Repository Metadata:
- Use metadata and properties during uploads to tag artifacts with relevant information (e.g., build number, environment). This enhances traceability and searchability.
Access Controls:
- Set appropriate permissions and visibility for repositories to ensure that only authorized personnel can upload/modify the artifacts.
Troubleshooting Tips
- Authentication Issues: Failure to authenticate or permission denied errors.
- Ensure you are using the correct username and password or authentication token.
- Verify that your user account has the necessary permissions to upload to the target repository.
- Check if Single Sign-On (SSO) is configured correctly if applicable.
- For API or CLI usage, confirm that the credentials are correctly specified in the configuration.
- Connectivity Problems: Timeouts, network errors, or inability to reach the Artifactory server.
- Verify network connectivity between your client machine and the Artifactory server.
- Ensure there are no firewall rules or network policies (like Zscaler) blocking the connection.
- If you are experiencing timeouts via the UI, switch to the JFrog CLI or cURL .
- Check if the Artifactory server URL is correct and reachable from your client.
- If using a proxy, ensure that it’s properly configured and not blocking connections.
- Repository Configuration: Errors indicating the repository does not exist or is misconfigured.
- Double-check the repository key in your upload path to ensure it matches the correct repository in Artifactory.
- Ensure the repository type (local, remote, virtual) supports the type of artifact you are uploading.
- Verify that the repository is not disabled or under maintenance.
- File Size and Limit: Uploads fail due to file size limits or storage quota issues.
- UI Uploads have strict size limits. Use the JFrog CLI for large files.
- Verify upload size limits imposed by your Artifactory product and platform instance.
- If you are using the Project feature , check if the repository has sufficient storage space ( Administration view).
- Artifact Checksum Validation: Errors due to checksum mismatch or verification failures.
- Ensure the correct checksum (MD5, SHA1) is provided if required by the repository configuration.
- Verify that the artifact is not corrupted during the upload process.
- If using multipart upload, ensure all parts are correctly assembled before performing the upload.
- Others errors in CLI or inconsistent upload behavior.
- Double-check command syntax and parameters for CLI tools like JFrog CLI .
- Verify that paths specified in scripts are correct and accessible.
- Ensure environment variables and configuration files are properly set up and referenced.