Process Configuration

Good day,

I am having an issue when I am attempting to use the “JSON Configuration Variables” feature.
I have this enabled and am using the below pattern as example

approot\packages#{Octopus.Action.Package.NuGetPackageId}#{Octopus.Action.Package.NuGetPackageVersion}\Pivot.Generic.Scheduler.Web\appsettings.json

This issue is that this is no finding the appsetting.json file within the packet.

Result:
"No files were found that match the replacement target pattern ‘approot\packages\PivotGenericSchedulerID\1.0.182089247\Pivot.Generic.Scheduler.Web\appsettings.json’ "

Within Octopus -> Library I can see my packet id PivotGenericSchedulerID with version
1.0.182089247 as its resolved above. And if I download that packet locally I can see within the root\

Pivot.Generic.Scheduler.Web and within that directory appsettings.json exists.

I have attempted this with patterns:
“approot\appsettings.json”
“approot\Pivot.Generic.Scheduler.Web\appsettings.json”
“appsettings.json”

But all result in a “No files were found that match the replacement target pattern”

Any ideas?

I seen in other posts “Substitute Variables in Files” feature also needs to be enabled - is this related? (and does it explain why the above is not working)

Thanks,
Conor

Have you verified the package path on the server?

Hi Michael,

On the server where Octopus is installed I can see the nuget packages are available under

…\Octopus\Packages\PivotGenericSchedulerID\PivotGenericSchedulerID.1.0.182079194.nupkg for example

So perhaps the pattern is incorrect,

I will attempt

approot\packages#{Octopus.Action.Package.NuGetPackageId}##{Octopus.Action.Package.NuGetPackageId}.{Octopus.Action.Package.NuGetPackageVersion}\Pivot.Generic.Scheduler.Web\appsettings.json

Getting the following warning:
No files were found that match the replacement target pattern ‘approot\packages\PivotGenericSchedulerID\PivotGenericSchedulerID.1.0.182089247\Pivot.Generic.Scheduler.Web\appsettings.json’

from pattern

approot\packages#{Octopus.Action.Package.NuGetPackageId}#{Octopus.Action.Package.NuGetPackageId}.#{Octopus.Action.Package.NuGetPackageVersion}\Pivot.Generic.Scheduler.Web\appsettings.json

Hello Conor,

Thanks for getting in touch. It should not require you to have Substitute Variables in Files toggled on. You will only need to match on the file path as it is defined within the package, you won’t need to include the package version or any info about where it’s deployed.

Either of these will work, depending on if there are other appsettings.json files in the package in other locations.

**\appsettings.json
**\Pivot.Generic.Scheduler.Web\appsettings.json

To put it another way approot\packages\PivotGenericSchedulerID\ is where it ends up in the end it doesn’t need to form part of your pattern matching to determine the file to be modified.

The key part of the info below where you specify the target files is in bold:

A comma- or newline-separated list of file names to replace settings in, relative to the package contents

If your concern was other previous versions also deployed there they will not be modified by this deployment / file substitution.

Hope that gets you going.

Regards,
Nick

Hi Nick,

Thank you for your detailed answer and example.
I have attempted with **\appsettings.json and found the particular json file in question, working beautifully.

Thanks again,
Conor

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.