same performance script can work in different environment - performance-testing

I have created a scripts for performance testing in PT environment, now the ask is to run same scripts in UAT environment so I have replaced the PT URL to UAT environment URL in my script will that work? if boat environment having same UI and same layers on the application

Related

Shell script & param file(s) for deployment across multiple environments

I have a shell script that installs a particular software on an Azure VM. Say, it is install_software.sh.
There are environment specific parameters defined in a .param file. For example,
INSTALLATION_PATH=XYZ
INSTALLER_LOCATION=ABC
I plan to do this:
Create 3 param files specific to DEV, QA, PROD environments
Load all the 3 files from GitHub into the VM
Accept environment name as an argument while executing the script, example:
sh install_software.sh DEV
Check if $1 of the executed command is DEV, and EXPORT from DEV .param file.
Now, do you think this is a good approach? Or, is there any smarter approach. Appreciate if I can be pointed to any sample code snippets too. Thank you very much.

Azure Pipelines Environment variables not working for PowerShell on Target Machines

I’m unable to get the environment variables (for example $env:RELEASE_RELEASENAME) for a task that runs a PowerShell script on a target machine, however, the env variables work for PowerShell Inline.
Does getting env variables from PowerShell on target machines need special treatment or am I missing something here?
Sometimes, I met this problem with Ubuntu hosted agent. My solution is to manually add the environment, then I can get the environment variable in inline script or script file.

Set Config property based on deployment platform (dev, staging, qa, production) in Node.js

In Node.js, I want to set config property value based on platform (dev, staging, qa, production) it will get deployed.
So for example for dev and staging environment, I want to set value '234'
And for prod, i want to set value '456'.
for deployment, i am using VSTS.
Shall I make the use of deployment variables?
For setting config property based, please take a look at this question: Node.js setting up environment specific configs to be used with everyauth
In VSTS Release, you could use environment scoped value per environment.
Share values across all of the tasks within one specific environment
by using environment variables. Use an environment-level variable for
values that vary from environment to environment (and are the same for
all the tasks in an environment). You define and manage these
variables in the Variables tab of an environment in a release
pipeline.
Source Link: Custom variables
If you want to change values, suggest you to use Replace Tokens task Visual Studio Team Services Build and Release extension that replace tokens in files with variable values.

Restrict people from running production pipelines

I'm evaluating gitlab community edition as a self hosted version. Everything is fine with the product except anyone who has access to pipelines (master or admin) can run deployment on production.
I saw their issue board and i see that this is a feature that will not be coming to gitlab anytime soon.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/20261
For now, I plan on deploying my spring boot applications using the following strategy.
A separate runner installed on the production server
There will be an install script with instructions some where in production server
gitlab-runner user will only have permissions to run the above specific script (Somehow).
Have validations in the script for GITLAB_USER_NAME variable.
But I also see that there are disadvantages in this approach.
GITLAB_USER_NAME is an environment variable which can be overridden easily thus compromising the validation.
Things are complicated when introducing new prod servers.
Too many changes apart from .gitlab-ci.yml... CI/CD was supposed to be simple not painful...
Do I have any alternate approaches or hacks for this...?

I cannot detect an environment variable from my unit test

My web app depends on an environment variable.
I wrote a unit test to ensure the environment variable is not null. The test passes on my local machine because, of course, I put the environment variable in my system variables. I had to restart Visual Studio for it to recognize the environment variable. But the test fails when it is built using CI in the cloud.
The TFS Build is scheduled to deploy it to a staging environment, and the environment variable is present in the staging environment as well as the production environment. If it is successful, it will deploy it to the staging environment, and then auto-swap with production. But it doesn't get far because the unit test fails. Is the unit test run in an environment different from the actual hosted website? If so, I must change my unit test strategy to not test environment variables. I may make an application status page to check such things then. But I wondered if anyone knew what was up on this.
The custom environment variable which you have in your personal machine must also be on the build controller. TFS Builds run on controller (Agents internally) and the unit tests run post build of the binary (Integral part of the Build before packaging)
Check if you can add the environment variable in the Build controller. You probably would need to reach the Build team and get that environment variable added in the Build server.
You also have a choice to "Pass the build if the unit test fails"
You can also categorize the unit test and set priorities and run only unit tests of certain priority; like priority 1 alone. You ca eliminate the case which is failing to be part of a unit test priority which you want to run.
Hope this helps!!

Resources