In Build process I am using Step definition “Configuration - Encrypt Section” (created by cjuroz) to encrypt connection strings for my web app.
When I am deploying it’s creating wrong ciphers, When I go to step definition and do “Run” and provide all required parameter by pointing out same folder where deployment process deploys, it encrypt correctly and I can connect to database.
There is no error but creating wrong encryption. Not sure what is the difference in executing from Step definition “Run” command and running that step as part of project deployment.
Thanks for getting in touch and I’m sorry to hear that you are having these issues.
Can you send through how you’ve configured the step in your deployment process (including any values for values used in the step configuration) and also when you manually Run the step template.
It doesn’t look like that step is based on the step template from the Library, can you tell me what version of Octopus you are running? (If you’re on an older version I might be incorrect in my thinking below)
Is it possible that you have a local step template that is being used in your deployment process, or have you modified the Library step template in anyway (as this would force you to save a local copy and renaming it)?
I have attached step export as requested. Powershell script works OK even if I run contents of script manually on my server. Only time it generate wrong ciphers which doesn’t work when run as part of deployment.
When you say that you run the script on your server it works, are you running the script on the Tentacle server that is failing to create the correct ciphers as part of a deployment?
Also, are you running the script on the web.config file that has the correct values for the environment that the deployment runs in?
Could you disable the encrypt step, and then check the values that are in the web.config post-deployment to make sure that they are the correct ones? It feels like it might be an issue with values here at play as the script works fine when run on its own and we don’t do anything special as part of the deployment when running the script.
Script always runs without any errors. let me take you through steps
Failing scenario
We kick deployment
Package gets deployed and tokens gets replaced, now we have final web.config with correct connection strings in it.
Encryption step runs fine and creates some cipher in web.config
When we run application it can’t connect to database
Now we rolledback connection string and back to raw web.config file which has correct connection string.
5. I got to Library -> Step Templates -> Encrypt Step
6. Click Run
7. Select server where application is deployed
8. Provide path to last deployment
9 Click run, This runs fine and create cipher.
10. This time application can connect to database and runs fine.
Now in above scenario it’s not clear what’s the difference in these two execution and why application works for one encryption and fails for other?