Run a Script step template generating warning when running in a linux container tentacle

Hi there,
I’ve successfully managed to get the octopusdeploy\tentacle container image customized with Powershell 7 registering in our cloud octopus instance. I’ve also managed to adapt the powershell scripts we are using to run there too.

However, we have a number of “Run a script” step templates, that are writing Warnings to the deployment console that seem to be related to path separators:

Extracting package '/etc/octopus/Files/Postie@S221024.1.1000769+master.e2964e8.769.docker@63D40CE0BA92224CA1EB945F270EAAA8.nupkg' to '/etc/octopus/Work/20221024104530-216257-18' 
No files were found in /etc/octopus/Work/20221024104530-216257-18 that match the substitution target pattern '/etc/octopus/Work/20221024104530-216257-18/Ecs\ScaleTaskSet.ps1' 

(The No files... message above is being written to error stream and showing as orange in the tasklog)

This warning does not fail our deployment - in fact, the script does run correctly on the linux tentacle with the windows path separator. I have no visibility into what the Run A Script step is actually doing trying to search/replace or why it may be needed.

Please see screenshot attachment for the step definition.

(Note that the Replace that I do have control over relates to the package name in the feed and the warning is not related to that)

Ideally I’d like to be able to run the step without warning on windows or linux tentacles. Is there anyway to clear this error?

Sincerely
Pete

Hi Peter,

Thanks for getting in touch!

That warning is normal if you’re using one of the variable replacement features and the step is failing to find the file specified.

Within the script step configuration, are any of those features enabled if you hit the Configuration Features button at the top-right?
e.g.

If you do not need them, unticking them should prevent the warning from appearing.

If they are all disabled and the warning still appears, I would suggest ticking them all and checking if any config is saved in any of them. I have seen an issue with an older version where the config could persist after the option was unticked.

Regards,
Paul

Hi Paul,
Thanks for the really speedy reply… Unfortunately. none of those features are enabled for the Step Template:

I checked the “Usage” tab for the step template, and all projects are up to date with the latest change in this step template, so it’s not an older version.

Any other ideas?

Sincerely
Pete

Thanks for checking that.

Would you be able to head into the project, open the process page and then use the overflow menu at the top right to select Download as JSON
e.g.
image

Within that JSON is there a "Octopus.Action.EnabledFeatures" field within the section for that step?

e.g. this is my step template with one of those features enabled.

 {
      "Id": "4c45452e-cefc-48c0-b34e-a5962b6ef00c",
      "Name": "Script Step Template",
      "Slug": "script-step-template",
      "PackageRequirement": "LetOctopusDecide",
      "Properties": {
        "Octopus.Action.TargetRoles": "Kube"
      },
      "Condition": "Success",
      "StartTrigger": "StartAfterPrevious",
      "Actions": [
        {
          "Id": "51ae91b5-d5a8-4a3e-9311-7fab152d3fde",
          "Name": "Script Step Template",
          "Slug": "script-step-template",
          "ActionType": "Octopus.Script",
          "Notes": null,
          "IsDisabled": false,
          "CanBeUsedForProjectVersioning": false,
          "IsRequired": false,
          "WorkerPoolId": null,
          "Container": {
            "Image": null,
            "FeedId": null
          },
          "WorkerPoolVariable": "",
          "Environments": [],
          "ExcludedEnvironments": [],
          "Channels": [],
          "TenantTags": [],
          "Packages": [],
          "Condition": "Success",
          "Properties": {
            "Octopus.Action.Script.ScriptSource": "Inline",
            "Octopus.Action.Script.Syntax": "PowerShell",
            "Octopus.Action.Script.ScriptBody": "write-host \"test\"",
            "Octopus.Action.EnabledFeatures": "Octopus.Features.SubstituteInFiles",
            "Octopus.Action.Template.Id": "ActionTemplates-721",
            "Octopus.Action.Template.Version": "1",
            "Octopus.Action.RunOnServer": "false"
          },

If that is clear too, would it be possible for you to export the step template and send it through for me to test?

Paul,
Thanks for sticking with this.
I exported the process JSON and inspected. I could not find the Octopus.Action.EnabledFeatures property on the step that I am seeing warnings for.

There was an unrelated step that did have those features enabled, so I made sure to disable the feature on that step. I updated all related processs and re-exported my Process JSON - definately no mention of EnabledFeatures. I created a new release for the project and re-attemted the deployment, but warnings persist.

This is the step export: (NB: I’ve scambled the various Ids in case that leaks info about our cloud account)

{
  "Id": "99999999f-0a64-4824-a19c-999999999999999",
  "Name": "ECS 2 - Start the canary",
  "Description": null,
  "ActionType": "Octopus.Script",
  "Version": 1,
  "CommunityActionTemplateId": null,
  "Packages": [
    {
      "Id": "9999999-be80-48e5-856f-999999999",
      "Name": "",
      "PackageId": "#{Octopus.Project.Name | Replace \"-ECS\" \"\"}",
      "FeedId": "feeds-builtin",
      "AcquisitionLocation": "Server",
      "Properties": {
        "SelectionMode": "immediate"
      }
    }
  ],
  "Properties": {
    "Octopus.Action.Script.ScriptSource": "Package",
    "Octopus.Action.Script.ScriptFileName": "Ecs\\ScaleTaskSet.ps1",
    "Octopus.Action.Script.ScriptParameters": "-EcsClusterName #{EcsClusterName} -EcsServiceName #{EcsServiceName} -TasksetGroup SECONDARY -Scaling One",
    "Octopus.Action.Package.PackageId": "#{Octopus.Project.Name | Replace \"-ECS\" \"\"}",
    "Octopus.Action.Package.FeedId": "feeds-builtin",
    "Octopus.Action.Package.DownloadOnTentacle": "False"
  },
  "Parameters": [],
  "StepPackageId": "Octopus.Script",
  "$Meta": {
    "ExportedAt": "2022-10-24T14:31:05.409Z",
    "OctopusVersion": "2022.4.3913-hotfix.4575",
    "Type": "ActionTemplate"
  },
  "LastModifiedBy": "Your GitHub Username",
  "Category": "other"
}```

Thanks for sending that over.

I’d completely missed that this was a script file within a package. With that in mind, the substitution that is trying to run will be the default variable substitution for script files.
I’m assuming that the script within the package isn’t attempting to use any variables configured within the project? This would explain why it is continuing to work despite the warning.

I think you’re correct in that the issue is to do with the file separator being incorrect for Linux.
Would it be possible to try amending the step template Script file name to Ecs/ScaleTaskSet.ps1 and updating the step in this project only to see if that removes the warning?

Unfortunately this Step Template is shared with project processes that still run on Windows tentacles - we haven’t fully converted to running on Linux container tentacle yet - this is the overall migration task I’m working on at the moment (and the reason I’m logging a bunch of linux container forum questions).

Given that the step doesn’t fail, I’m happy to live with the warning for now, and swap the path separator at a later date when I’m happy to fully commit to Linux container tentacle.

Thanks for your assistance Paul!

Pete

No worries.

One last thing you could try would be adding a project variable named Octopus.Action.SubstituteInFiles.EnableNoMatchWarning with a value of false.

The system variable is technically for one of the other variable replacement features, so it may not do anything in this instance, but not harm in trying.

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