Skip to main content
Version: Early Access

Add an externally stored artifact to a package

Artifacts are the physical files that make up a specific version of an application.

For example, an application binary, configuration files, or web content. When adding an artifact to a deployment package, you can either:

  • Upload an artifact that will be stored in the Deploy internal repository
  • Specify the uniform resource identifier (URI) of an externally stored artifact, which Deploy will resolve when it needs to access the file.

Set the URI of a deployable artifact

If you set the file URI (fileUri) property of an artifact configuration item (CI) to a URI, Deploy uses an artifact resolver to resolve the URI when it needs access to the artifact. Example: When you set up a deployment, Deploy will download the artifact temporarily to perform certain actions on it. After deployment is complete, Deploy will delete its temporary copy of the artifact.

By default, Deploy supports Maven repositories, including Artifactory and Nexus, and HTTP/HTTPS locations. You can also add your own custom artifact resolver. For more information, see Extending the external artifact storage feature.

important

The value of the fileUri property must be a stable reference, it must point to the same file whenever it is referenced. "Symlink"-style references, such as a link to the latest version, are not supported.

Changing the URI of a deployable artifact

important

Do not change the file URI property after saving the artifact CI.

Deploy performs URI validation, checksum calculation, and placeholder scanning once, after the creation of the artifact configuration item (CI). It does not perform these actions again if the fileUri property is changed.

If you are using the Deploy internal repository, changing the URI of a saved CI can result in orphaned artifact files that cannot be removed by the garbage collection mechanism.

If you want to change the file URI, create a new CI for the artifact.

Use a Maven repository URI

The URI of a Maven artifact must start with maven:, followed by Maven coordinates. Example:

maven:com.acme.applications:PetClinic:1.0

For information about configuring your Maven repository, see Configure Deploy to fetch artifacts from a Maven repository.

important

References to SNAPSHOT versions are not supported because these are not stable references.

Deploy searches for the artifact during initial deployments and update deployments. If the artifact is missing from the repository, the search will return an error. You can configure Deploy to serve an empty artifact for the deployment to continue. This option is not recommended, as it can cause issues that are hard to debug. To enable this option, set xl-platform.extensions.resolver.maven.ignoreMissingArtifact in the conf/maven.conf file, to:

xl.repository.artifact.resolver.maven.ignoreMissingArtifact = true
note

The maven.conf file is deprecated. The configuration properties from this file have been migrated to the xl.artifact.resolver block of the deploy-artifact-resolver.yaml file. For more information, see Deploy Properties.

Use a HTTP or HTTPS URI

You can use an HTTP or HTTPS reference in the fileUri property. Deploy will attempt to get the filename from the Content-Disposition header of the HEAD request, and then from the Content-Disposition header of the GET request. If neither is available, Deploy will get the filename from the last segment of the URI.

You can specify authentication credentials using only one of these methods:

  1. Specify basic HTTP credentials in the URI. Example:
    http://admin:admin@example.com/artifact.jar
  2. Select credentials from an existing set of credentials defined in Deploy. For more information, see Store credentials in Deploy. Example:
    http://example.com/artifact.jar

To connect using HTTPS with a self-signed SSL certificate, you must configure the JVM parameters of Deploy to trust your certificate.

Deploy looks up the artifact during initial deployments and update deployments. If the URL returns a 404 error, the lookup will return an error. You can configure Deploy to serve an empty artifact so that the deployment can continue. This option is not recommended, as it can cause issues that are hard to debug. To enable this option, set xl-platform.extensions.resolver.http.ignoreMissingArtifact in the conf/extensions.conf file, to:

xl.repository.artifact.resolver.http.ignoreMissingArtifact = true
note

The extensions.conf file is deprecated. The configuration properties from this file have been migrated to XL_DEPLOY_SERVER_HOME/centralConfiguration folder. For more information, see Deploy Properties.

Create a deployment package using the CLI

This example shows how you can create a deployment package with an externally stored artifact using the Deploy CLI:

myApp = factory.configurationItem('Applications/myApp', 'udm.Application')
repository.create(myApp)
myApp1_0 = factory.configurationItem('Applications/myApp/1.0', 'udm.DeploymentPackage')
repository.create(myApp1_0)
myFile = factory.configurationItem('Applications/myApp/1.0/myFile', 'file.File', {'fileUri': 'http://example.com.com/artifact.war'})
repository.create(myFile)