Step Library
Bundle Lambda functions and prepare the CloudFormation deployment package using the Serverless Framework package command.
The Serverless Package step bundles your Lambda functions and prepares the CloudFormation template for upload to S3. It runs before the Serverless Deploy step and is added automatically when you select the Serverless Deployment With Rollback Strategy.
What you will learn
The parameters available on the Serverless Package step.
How the Package step downloads the artifact and runs
serverless package.
Before you begin
Ensure the following are in place before adding this step to your stage:
A configured Serverless service with a manifest and artifact source.
A configured Serverless infrastructure with an AWS connector, region, and stage.
The stage runtime environment configured with a Kubernetes cluster connector. Go to Serverless deployment for setup details.
Configure the step
The following parameters are available on the Serverless Package step.
Name
Yes
Display name for this step in the stage canvas. Default: Serverless Aws Lambda Package V2.
Container Registry
Yes
A Harness Docker Registry connector pointing to the registry that hosts the step image.
Image
Yes
The harness/serverless-plugin image and tag to use, for example harness/serverless-plugin:nodejs20.x-3.39.0-1.1.0-beta-linux-amd64.
Command Options
No
Additional flags passed to serverless package, for example --verbose. Appended after --stage and --region.
Pre-Execute Command
No
Shell command that runs before the step logic. Use this to install dependencies or change directory.
Environment Variables
No
Key-value pairs injected into the container.
How the step works
By the time the Package step runs, the platform has already fetched and rendered the manifest. Harness Manifest Rendering copies the manifest files into the container at /harness/<manifest-id>/<folder-path>/, and Harness Manifest Templating resolves all Go template expressions (including the artifact path) in place.
The Package step runs two sub-steps:
Download Artifact Action: Downloads the primary artifact (ZIP file or Docker image) from the configured artifact source to
/harness/artifacts/primary/<filename>. The download path is also available as theARTIFACT_DOWNLOAD_PATHenvironment variable for use in subsequent steps.Serverless Package Action: Runs
serverless package --stage <stage> --region <region>in the manifest directory. The manifest at this point already contains the resolved artifact path, for example:
After packaging completes, the .serverless/ directory contains the packaged artifacts and CloudFormation template, ready for the Deploy step.
Next steps
Go to Serverless Deploy to review the deployment step
Last updated
Was this helpful?