Resolution
If your Deploy Kubernetes YAML step succeeds, but nothing is deployed, the most common cause is that no files were found at the path provided in the step. The step will not fail in this scenario, so it may be unclear why the deployment appears to have not run.
Check that the paths in the Deploy Kubernetes YAML step match the real folder layout, relative to the root of the package or Git repository. Paths are case-sensitive. Then create a new release, deploy it, and check that the task log shows a Matched file: line for each manifest you expect.
Cause
A deployment that uses the Deploy Kubernetes YAML step finishes with a Success status and a warning, but no Kubernetes resources are created or updated. The task log for the step shows warnings like these:
Warning | No files were found in /octopus/Work/<id>/staging/package that match the substitution target pattern 'manifests/*.yaml'
Info | Applying Batch #1 for YAML matching 'manifests/*.yaml'
Warning | No files found matching 'manifests/*.yaml'
Info | Resource status check completed successfully because all resources are deployed successfully
The pattern in quotes is the value of the step's Kubernetes YAML file paths field (package source) or File Paths field (Git repository source). If you list several paths, the Deploy Kubernetes YAML step can apply some and skip others. The matching paths are applied, and each missing path logs its own No files found matching warning.
When the Deploy Kubernetes YAML step executes, it extracts the package, or files from the Git repository, into a staging folder on the deployment target. It then evaluates each line in the paths field as a glob pattern, relative to the root of that staging folder.
When a pattern matches no files, the step logs a warning. Nothing is passed to kubectl, and the step reports success.
For example, with a package containing this layout:
manifests/
app.yaml
sub/
extra.yaml
These paths behave like this:
| Path | Result |
|---|---|
manifests/*.yaml |
Matches manifests/app.yaml only |
**/*.yaml |
Matches both files |
manifests/**/*.yaml |
Matches both files |
*.yaml |
Matches nothing, because * doesn't search subfolders |
Manifests/*.yaml |
Matches nothing, because matching is case-sensitive |
manifests/*.yml |
Matches nothing, because .yml and .yaml are different extensions |
manifests\app.yaml |
Matches nothing, because the separator must be / |
Diagnosis and fix
Most of these issues show the same warning, No files found matching '<pattern>'. What tells them apart is the pattern in the warning and what's actually in your package. You may need to enable verbose logging, as some of the lines below are only shown when verbose logging is enabled.
Open the deployment's Task Log tab and choose View settings > Log level > Verbose. When a path matches, the step logs a Matched file: line under each batch:
Verbose | Extracting package to: /octopus/Work/<id>/staging/package
Verbose | Extracted 2 files
Info | Applying Batch #1 for YAML matching 'manifests/*.yaml'
Verbose | Matched file: manifests/app.yaml
If your impacted deployment has no Matched file: line logged, work through the issues below. More than one can apply at once.
The package has an extra top-level folder
You'll see the warning even though the path looks right:
Warning | No files found matching 'manifests/*.yaml'
When you list the package contents, every file sits under an extra folder:
unzip -l MyApp.1.0.0.zip
MyApp/manifests/app.yaml
Many build tools wrap their output in a folder like this. Paths in the step start at the package root, so manifests/*.yaml doesn't match MyApp/manifests/app.yaml.
To fix it, add the folder to the path (MyApp/manifests/*.yaml), or change your build so the manifests sit at the package root. To download the package from the built-in feed, go to Deploy > Packages, select the package and version, and choose Download.
For a Git repository source, paths start at the repository root. Check the path against the branch or commit the release used, not your current default branch.
The pattern doesn't search subfolders
You'll see a warning for a pattern with no folder in it, while your manifests are in a subfolder:
Warning | No files found matching '*.yaml'
* only matches files in one folder, so *.yaml at the root doesn't find manifests/app.yaml.
To fix it, use **/ to include subfolders, for example **/*.yaml or manifests/**/*.yaml.
The case or extension doesn't match
You'll see the warning, and the package has the file under a slightly different name:
Warning | No files found matching 'manifests/*.yaml'
Manifests/app.yml
Matching is case-sensitive, and .yml and .yaml don't match each other. This often catches out manifests written on Windows or macOS, where the file system usually ignores case.
To fix it, use the exact case and extension of the files in the package. If the package has both extensions, add a line for each:
manifests/*.yaml
manifests/*.yml
The path uses backslashes
You'll see a backslash in the pattern:
Warning | No files found matching 'manifests\app.yaml'
To fix it, use forward slashes (/) in the path.
A variable in the path isn't defined
You'll see the variable syntax in the warning, unchanged:
Warning | No files found matching '#{ManifestDir}/app.yaml'
If the variable isn't defined for the deployment, Octopus leaves #{ManifestDir} in the path as literal text.
To fix it, define the variable and check it's scoped to the environment and target you're deploying to. Make sure to create a new release for any variable changes to take effect. Once the variable resolves, the log should show the evaluated path:
Info | Applying Batch #1 for YAML matching 'manifests/app.yaml'
Only some of the paths were applied
You'll see some resources created, and a warning for one of the batches. This example lists two paths, manifests/app.yaml and manifests/service.yaml:
Warning | No files were found in /octopus/Work/<id>/staging/package that match the substitution target pattern 'manifests/service.yaml'
Info | Applying Batch #1 for YAML matching 'manifests/app.yaml'
Verbose | Matched file: manifests/app.yaml
Verbose | Created Resources:
Verbose | - v1/ConfigMap/app-config in namespace my-app
Info | Applying Batch #2 for YAML matching 'manifests/service.yaml'
Warning | No files found matching 'manifests/service.yaml'
Info | Resource status check completed successfully because all resources are deployed successfully
The Created Resources: lines only show when verbose logging is enabled. Without it, you'll only see the Applying Batch lines and the warnings.
Each line in the paths field runs as its own batch, in order. A missing path only logs a warning, so the step applies the other batches and the task still finishes with a Success status.
To fix it, check every batch in the task log for a No files found matching warning, not just the first, and correct each path that doesn't match.
Octopus won't save the path
When you save the process, Octopus shows the following error:
The path to your YAML file(s) cannot stem from a root directory or use '.' or '..' directories.
All paths must be relative to the package or repository root, so they can't start with / or use . or ...
To fix it, remove any leading / or ./ from the path.