> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Simplified GitOps CI/CD with tfy apply — v0.132

> From v0.132, use a single tfy apply command to replace complex per-file CI/CD scripts for GitOps workflows.

<Warning>
  **Applicable to:** All users using Gitops to configure TrueFoundry resources. Requires **Control Plane v0.132+** and **TrueFoundry CLI v0.14.2+**.
</Warning>

## What Is Changing

The `tfy apply` CLI command now supports **directory mode** with **`--diffs-only`** and **`--ref`** flags, replacing the need for complex per-file CI/CD scripts. A single command now handles everything — detecting changed files, resolving dependencies between resources, and applying them in the correct order.

### Before (per-file approach)

Previously, CI/CD pipelines required:

* Shell scripts to detect which YAML files changed between commits
* Manual sorting of files by dependency order (nesting level)
* Separate handling for added, modified, and deleted files
* Per-folder processing functions for each resource type
* Third-party GitHub Actions (e.g. `tj-actions/changed-files`) to track changes

This resulted in **80–100+ lines of pipeline code** and was fragile — dry runs would fail if a PR contained dependent resources (e.g. a workspace and an application inside it) because the resources were applied individually without dependency awareness.

### After (single command)

The entire CI/CD pipeline is now two lines:

**Pull request (dry-run):**

```bash theme={"dark"}
tfy apply --dir truefoundry --dry-run --show-diff --diffs-only --sync --ref <base-ref>
```

**Merge to main (apply):**

```bash theme={"dark"}
tfy apply --dir truefoundry --diffs-only --sync --ref <previous-commit>
```

The CLI internally resolves resource dependencies, so dry runs succeed even when a PR adds multiple interdependent resources at once.

## What's Improved

* **Dependency resolution** — `tfy apply` now automatically determines the correct apply order for resources that depend on each other. Dry runs no longer fail when a single PR introduces a workspace along with the applications inside it.
* **Simpler pipelines** — No more shell scripts, file-change detection logic, or per-folder processing. The full GitHub Actions workflow is now under 30 lines.
* **Consistent behavior** — The same command works across GitHub Actions, Bitbucket Pipelines, Jenkins, and any other CI/CD system.

For complete CI/CD examples (GitHub Actions, Bitbucket Pipelines, Jenkins, and more), see the [GitOps setup guide](/docs/setup-gitops-using-truefoundry#setup-cicd) and the [sample repository](https://github.com/truefoundry/truefoundry-gitops-sample-repository).

## What You Need to Do

1. **Upgrade the TrueFoundry CLI** to version **0.14.2 or greater**:
   ```bash theme={"dark"}
   pip install -U "truefoundry"
   ```
2. **Verify your Control Plane** is on version **0.132 or later**.
3. **Update your CI/CD pipelines** — replace the existing per-file scripts with the simplified commands. Refer to the [GitOps setup guide](/docs/setup-gitops-using-truefoundry#setup-cicd) and the [sample repository](https://github.com/truefoundry/truefoundry-gitops-sample-repository) for ready-to-use configs.
4. **Organize manifests under `truefoundry/`** — ensure all your YAML manifests are inside a `truefoundry/` directory so `tfy apply -d truefoundry` picks them up. See the [repository structure guide](/docs/setup-gitops-using-truefoundry#organizing-the-git-repository) for details.

***

If you have any questions or run into anything unexpected during the migration, reach out and we'll be happy to assist.
