Limiting artifacts to be built

Artifacts to be built can be limited by various mechanisms. This section deals with various techniques to limit artifacts being built

Limiting artifacts by domain

Artifacts to be built can be restricted by domain during a build process in sfp by utilizing specific configurations. Consider the release config example provided in

# release-config for sales
releaseName: sales
pool: sales-pool
excludeAllPackageDependencies: true 
includeOnlyArtifacts:
  - sales-ui
  - sales-channels
releasedefinitionProperties:
  skipIfAlreadyInstalled: true
  usePackageDiffDeploymentMode: true
  promotePackagesBeforeDeploymentToOrg: prod
  changelog:
    workItemFilters:
      -  (AKG|GIK)-[0-9]{2,5}
    workItemUrl: https://example.atlassian.net/browse
    limit: 30

You can use the path to the config file to the build command to limit the artifacts being built as in the sample below

// Limit build by release config
sfp build -v devhub --branch=main --domain config/sales.yaml

Limiting artifacts by packages

Artifacts to be built can be limited only to certain packages. This could be very helpful, in case you want to build an artifact of only one package or a few while testing locally.

// Limit build by certain packages
sfp build -v devhub --branch=main -p sales-ui,sales-channels

Limiting artifacts by ignoring packages

Packages can be ignored from the build command by utilising an additional descriptor on the package in project manifest (sfdx-project.json)

// Sample sfdx project json 
{
  "packageDirectories": [
    {
      "path": "./src-env-specific-pre",
      "package": "src-env-specific-pre",
      "versionNumber": "1.0.0.0",
      "": [
        "build"
      ]
    },
    {
      "path": "./src/frameworks/feature-mgmt",
      "package": "feature-mgmt",
      "versionNumber": "1.0.0.NEXT"
    }
  ]
}

In the above scenario, src-env-specific-pre will be ignored while build command is invoked

Last updated