Uploading an Artifact in Artifact Registry

The method that you use to upload an artifact to Artifact Registry depends on the size of the artifact file.

File size less than 200 MB
  • Oracle Cloud Console (recommended)
  • OCI CLI in Cloud Shell
  • OCI CLI in a local environment
  • REST API
File size 200 MB to 4 GB
  • OCI CLI in Cloud Shell (recommended)
  • OCI CLI in a local environment
  • REST API
File size greater than 4 GB
  • OCI CLI in a local environment (recommended)
  • REST API
Tip

If an artifact file size is greater than 200 MB, you can't use the Console to upload that artifact, but you can copy the CLI command for uploading that artifact from the Console. To get a generated CLI command, see the following steps for uploading an artifact in the Console.

    1. Open the navigation menu and click Developer Services. Under Containers & Artifacts, click Artifact Registry.
    2. Under List scope, choose a compartment that contains a repository for artifacts.
    3. Click the name of a repository for the artifacts.
    4. Click Upload artifact.
    5. For the new artifact, specify an Artifact path. This path describes the location of the artifact. An artifact path can start with a letter, slash, or underscore, followed by letters, numbers, dashes, slashes, or underscores. Slashes don't create a directory structure, but you can use slashes to organize a repository. For example:

      • project01/my-test-app/test-artifact
      • project01/my-web-app/artifact-abc
    6. For the new artifact, specify a string for the Version. Because of incremental updates in artifacts, you assign versions to artifacts. This way, you can associate builds with the artifact versions and roll back to previous versions. For example:

      • 1.1.0
      • 1.2-beta-2

      When you enter path and version, the artifact name populates with the following format:

      <artifact-path>:<version>

    7. To upload a file that's less than 200 MB, click Console and follow these steps:
      1. Select or drag an artifact to the Content file area.
      2. Click Upload.
    8. To upload a file that's between 200 MB and 4 GB, click Cloud Shell and follow these steps:
      1. Launch Cloud Shell.
      2. Drag an artifact into the Cloud Shell window.
      3. After the file transfer completes, copy the generated command displayed in the Upload artifact window and paste the command in Cloud Shell.
      4. Update <file-name> to the name of the file that you dragged to Cloud Shell.
      5. Run the command in Cloud Shell.
      6. Close the Upload artifact window.
      7. After the command runs successfully in Cloud Shell, refresh the browser to see the listed artifact.
    9. To upload a file that's greater than 4 GB, click CLI and follow these steps:
      1. Set up the OCI CLI in a local environment. For general information, see How do I use the CLI? and for installation steps see the CLI Quickstart.
      2. Copy the generated command displayed in the Upload artifact window and paste the command in the local environment.
      3. Update <path-to-file> in the command with the path to the artifact in the local environment. For example:

        ./artifact-abc.zip
      4. Run the command in a local environment.
  • Upload artifacts to Artifact Registry repositories by using the Command Line Reference for Artifact Registry.

    To upload an artifact into a repository in Artifact Registry, use the artifacts generic artifact resource.

    Get all the commands for artifacts generic artifact:

    oci artifacts generic artifact -h

    Get help for the upload-by-path command:

    oci artifacts generic artifact upload-by-path -h

    Find the required options:

    • --repository-id
    • --artifact-path (user-defined path to organize artifact in repository)
    • --artifact-version (user-defined version)
    • --content-body (path to artifact in your local environment)

    Upload an artifact:

    oci artifacts generic artifact upload-by-path --repository-id <repository-OCID> --artifact-path <user-defined-path-for-artifact> --artifact-version <version> --content-body <path-to-artifact-on-local-env>

    Example:

    oci artifacts generic artifact upload-by-path --repository-id ocid1.artifactrepository.oc1..xxx... --artifact-path project01/my-web-app/artifact-abc --artifact-version 1.0 --content-body <path-to-artifact-on-local-env>
  • Use the PutGenericArtifactContentByPath operation to upload an artifact in a specific repository.