Install your app's dependencies and package it into a distributable artifact — a Python wheel — inside a Harness CI pipeline running on Harness Cloud. No delegate, no Kubernetes, no infrastructure to manage. This tidbit clones a repo, installs the build tooling, and runs python -m build to produce a .whl you can see in the logs. The same two-step pattern swaps cleanly to a Java JAR or a Node package.
Build & Package is the atomic CI skill of turning source code into a shippable artifact. Harness clones your repo onto a Harness Cloud VM, you install whatever your build needs, then you run your ecosystem's package command. The result — here, tidbit_calc-0.1.0-py3-none-any.whl — is a real, installable artifact produced from the committed sample-app/, not a fabricated inline script. (Testing and publishing the artifact are separate tidbits.)
A single CI stage on Harness Cloud with two Run steps:
- Install Dependencies — upgrades
pipand installs the PEP 517buildfrontend. - Build Package —
cd sample-appand runspython -m build, producingsample-app/dist/tidbit_calc-0.1.0-py3-none-any.whl(plus the.tar.gzsdist), then listsdist/.
No delegate, no Kubernetes — Python is preinstalled on the Harness Cloud Linux image.
- A Harness account with a Project (free tier is fine).
- Permission to create and run pipelines.
- A GitHub code connector (this pipeline uses
account.github_public, an Account-level connector on the public GitHub URL). Any healthy GitHub connector works; Connectivity Mode "Connect through Harness Platform" is required for Harness Cloud. - Harness Cloud build credits (included on the free tier). No delegate needed.
| Ecosystem | Install step | Package command | Artifact lands in |
|---|---|---|---|
| Python wheel | pip install build |
python -m build |
dist/*.whl |
| Java JAR | (Maven/Gradle preinstalled) | mvn -B package or ./gradlew build |
target/*.jar |
| Node package | npm ci |
npm pack |
*.tgz |
Point the Build Package step's cd at the directory that holds that ecosystem's build file (pyproject.toml, pom.xml, package.json).
- Fork / clone this repo so the pipeline can clone your copy and build your
sample-app/. - Configure
.env(optional, for reference):cp .env.example .envand fill your connector ref, repo, and org/project. The.envis git-ignored and not consumed by the pipeline — it only documents your swap points. - Create / confirm a GitHub connector in Harness: Project Settings → Connectors → New Connector → GitHub. Note its reference (e.g.
account.github_public), then run Test Connection. - Import the pipeline:
- In your project → Pipelines → Create a Pipeline → Import From Git, or Create → YAML and paste
.harness/build_and_package.yaml. - Edit every
# REPLACE:line:projectIdentifier/orgIdentifier,connectorRef,repoName(your fork), andbranch.
- In your project → Pipelines → Create a Pipeline → Import From Git, or Create → YAML and paste
- Run it. Click Run; provide
branch: mainif prompted. - Expected success. The build reaches Success in well under a minute. In the Build Package step log you'll see:
Successfully built tidbit_calc-0.1.0.tar.gz and tidbit_calc-0.1.0-py3-none-any.whl ----- Built artifacts ----- tidbit_calc-0.1.0-py3-none-any.whl tidbit_calc-0.1.0.tar.gz
cd sample-app
pip install build
python -m build
ls dist/ # tidbit_calc-0.1.0-py3-none-any.whl- Replace the Build Package command per the cheat sheet above (
mvn -B package,npm pack, …) and pointcdat that build file's directory. - Add a real dependency to
sample-app/pyproject.toml, replace the install step withpip install -r requirements.txt, and watch it install before the build.
No module named buildin Build Package. Step 1 (pip install build) didn't run or was deleted. Ensure it runs before Step 2.ERROR Multiple top-level packages discovered/ nodist/produced.python -m buildran in the wrong directory, or your package layout doesn't match.cdinto the dir holdingpyproject.toml. This repo uses asrc/layout declared via[tool.setuptools.packages.find] where = ["src"].- Clone fails with
connector not found/ auth error.connectorRefdoesn't exist in scope or can't reach the repo. Use the exact identifier (account-scoped refs are prefixedaccount.), run Test Connection, and confirmrepoNamematches your fork.
Running tests, publishing/uploading the artifact to a registry, Docker image builds, and caching build dependencies. Those are separate tidbits. This one is only install + package.
- CI Run step settings: https://developer.harness.io/docs/continuous-integration/use-ci/run-step-settings
- Configure codebase (clone): https://developer.harness.io/docs/continuous-integration/use-ci/codebase-configuration/create-and-configure-a-codebase
- Harness Cloud build infrastructure: https://developer.harness.io/docs/continuous-integration/use-ci/set-up-build-infrastructure/use-harness-cloud-build-infrastructure