Artifact collection only happens after step completion

I was working on a custom step that would alter a file, however I wanted to collect an artifact of the config file both before and after the change. Is there any good way to do this outside of creating a before and after step?

Hi Robert,

Thanks for getting in touch. There is a few ways you could do this.

You won’t need to have additional steps, you can use Custom deployment scripts on an existing step, have a look at this documentation with some helpful screen shots: https://octopus.com/docs/deploying-applications/custom-scripts#Customscripts-Scriptsinpackagestepsscripts-configured-in-steps

Depending on where your original file is coming from, if it’s from a package you will have access the file from the package, you could capture the file that way, as for after modification it would be custom script, to make a copy of the modified file.

Regards,
Nick

I don’t believe that solution would work for me as I am not using a package. I’m reading an xml file (.net Machine config) and depending on the values making changes.

Hello,

When you read the file in, at that point save a copy of it, that will be the original file. Modify the file, now it’s changed, you can also make a copy at that point to, in your logic.

If this still doesn’t make sense would you mind providing some more specific details as to how you have it currently working.

Regards,
Nick

Nick,
I believe I can make that work by reading the file into a second variable then if the file changes writing the variable to a temp location and publishing that as the artifact for the original value.

Thanks,
Rob