Search code examples
octopus-deploy

Octopus Deploy octo-pack is including a folder


I am using Octopus Deploy to deploy an angular application to Azure. To do this, I have used grunt-octo, which packages the deployment into a nuget package and sends it to Octopus Deploy.

The packing part of this process is taking the files from the dist folder. Here is the octo-pack part of the Grunt script:

'octo-pack': {
  prod: {
    options: {
      dst: './bin'
    },
    src: ['dist/**/*']
  }
}

However, this includes the dist folder in the deployment, so my files are inside a dist folder in Azure.

I have not been able to find a way to just get the files within the folder.

Octopus Deploy lets you run a Powershell script as part of the process, but I don't think that is a good solution.

Anyone got any ideas?


Solution

  • I found this answer in the Octopus forums: http://help.octopusdeploy.com/discussions/problems/47569-grunt-octopack

    The key part of the article is this:

    The grunt-octo modules currently does not support the dynamic file list feature provided by grunt

    This stops the CDW (Current Working Directory) part from working correctly.

    I have submitted this Pull Request to add some additional parameters to fix this issue: https://github.com/OctopusDeploy/grunt-octo/pull/2

    This adds 2 new parameters to the options, where you can specify if you want the parent folder to be removed and to specify the name of the folder to remove:

    options: {
      dst: './bin',
      removeParent: true,
      parentDir: 'dist'
    }
    

    UPDATE:

    Since I submitted the Pull Request, the package has been updated to honor the working directory. This will now work using the following code:

    'octo-pack': {
      prod: {
        options: {
          dst: './bin'
        },
        src: ['**/*'],
        cwd: 'dist'
      }
    },