Preprocess Tanzu (formerly PCF) Artifacts to Match Supported Types

Updated 1 day ago by Michael Cretzman

Currently, this feature is behind a Feature Flag. Contact Harness Support to enable the feature. Feature Flags can only be removed for Harness Professional and Essentials editions. Once the feature is released to a general audience, it's available for Trial and Community Editions.

See New features added to Harness and Features behind Feature Flags (Early Access) for Feature Flag information.

Harness supports the most common Tanzu Application Services (formerly PCF) artifact package types.

If your artifact doesn't match the supported types, you can run a script to preprocess the artifact (unzip, untar, etc). Preprocessing occurs when setting up the app during deployment.

In this topic:

Before You Begin


  • Preprocessing is for non-Docker artifacts.

Review: Supported Artifact Types

Harness supports the following PCF artifact servers/types.

Metadata-only Sources:

  • Jenkins
  • AWS (Amazon Web Services) S3
  • Artifactory (includes Docker)
  • Nexus
  • Bamboo

File-based Sources:

  • Docker Registry
  • Artifactory (Tgz files)
  • Nexus (Tgz files)
  • Google Container Service (GCS)
  • AWS Elastic Container Registry (ECR)
  • SMB
  • SFTP
  • Custom Repository
Harness supports any single file (non-folder) deployed using cf push. TAR, WAR, JAR, ZIP, and Docker are supported.

Step 1: Select Preprocessing in App Setup Step

This step assumes you've created a PCF Workflow before. If not, see:

Open the App Setup step in the Workflow.

Select Pre-Process Package for PCF Deployment. The script option appears.

Step 2: Add Preprocessing Script

Enter a script to perform preprocessing on the downloaded artifact before deployment.

Reference the downloaded artifact using the expression ${downloadedArtifact}.

For example:

tar -xvf ${downloadedArtifact}

Copy the processed artifact to a directory using ${processedArtifactDir}.

For example:

cp myfolder/helloworld.war ${processedArtifactDir}

The entire preprocessing script might look like this:

tar -xvf ${downloadedArtifact}

cp myfolder/helloworld.war ${processedArtifactDir}

Let's look at another example:

Let's say you have a zip archive that contains a folder named myArtifact. Inside the myArtifact folder is an artifact named myArtifact.war.

You unzip the archive:

unzip ${downloadedArtifact}

Once you unzip the archive the result is myArtifact/myArtifact.war.

Next, you need to copy myArtifact.war to a directory. The directory is identified using the expression ${processedArtifactDir}.

For example:

cp myArtifact/myArtifact.war ${processedArtifactDir}

Step 3: View the Preprocessing in the Deployment Logs

When you deploy the Workflow the preprocessing is shown in the logs for the App Setup step.

Here's an example:

# Executing artifact processing script: 

See Also

Configure As Code

To see how to configure the settings in this topic using YAML, configure the settings in the UI first, and then click the YAML editor button (</>).

The preprocessing YAML looks something like this:

- type: PCF_SETUP
name: App Setup
artifactProcessingScript: |
# Preprocessing script for non-Docker artifacts:
# Enter a script to perform preprocessing on the downloaded artifact before deployment.
# Reference the downloaded artifact using the expression: $\{downloadedArtifact}
# Reference the processed final artifact directory using: $\{processedArtifactDir}
# For example: if unarchiving $\{downloadedArtifact} is a file
# named helloworld.war, an artifact preprocessing script
# might look like:
# tar -xvf $\{downloadedArtifact}
# cp helloworld.war $\{processedArtifactDir}

tar -xvf ${downloadedArtifact}
cp -r package2 ${processedArtifactDir}

How did we do?