I'm not being able to set an environment project variable on runtime. On my workflow, I got a job that downloads the project and creates a release. I'd like to take the release number and set as an environment variable in a way that could be used later for another job on my workflow.
I've already tried to set the variable using but when the next job on the workflow runs this variable is undefined:
echo 'export TAG_VERSION="1.0.0"' >> $BASH_ENV
Unfortunately, the job where I want to use this variable is a CircleCI Orbs so there's not much I can change. Here is the link for the Orbs aws-ecr
This is the job on the workflow
- aws-ecr/build_and_push_image:
tag: ${TAG_VERSION}
...
Related
Is there any version/source update step or action that needs to be done when building GCFs with Cloudbuild. Or is there anyway to make sure that pubsub topic invokes the latest GCF version?
I've got a bunch of GCFs that are built with CloudBuild, and afterwards invoked by a pubsub topic. Weirdly some of them (not all) throw an error from a previous version of the GCF (the last GCF build actually fixes the error).
GCFs source code shows what's expected: the latest version of the code
Yet, GCF throws error that was in the GCF's previous version source code.
That line doesn't even exist in the source code of the currently active GCF's version (GCF > Functions > FUNC_NAME > Source).
In some occasions it's been a few hours since a GCF deployment and the first invocation.
From the best of my understanding, a new code is to be used at a "cold start" of a next "slot/instance" of a cloud function... And if you have some instances being used constantly - when one invocation is finished, the next one uses this (just became available) available "runtime environment slot", so that the environment is not created from scratch. Thus, it may take some time until all those "slots" are substituted with new, which have the new version of code being uploaded when the environment is created.
You might prefer to delete the cloud function, and then recreate it (using the new code), or drain the pubsub, so there is a pause in cloud functions being triggered.
I have a pre-request script that increments an enviroment variable to generate different ids each time a request is generated. Also, I have a runner that calls this request multiple times:
However, I’ve noticed that during the runner the environment variable is not updated, at least in the environment’s tab:
But I monitor the variable in the console log and it is incrementing correctly:
My problem is that if I prematurely stop the runner before all the requests end, the environment variable didn’t register all the sets that were executed, and such it keeps the value it had at the beginning of the execution. This may be a known issue or it might just be me using the tools in the wrong way, does anyone have any advice? I can manually set the variable to the value I need after each run but it would be better if the last line of the pre-request script
pm.environment.set(“runnerCounter”, Number(pm.environment.get(“runnerCounter”)) + 1);
always worked by setting the environment variable properly.
Also, I did check the Keep variable values as true, so as to persist any variable changes, even though I’m not sure this is necessary when it comes to environment variables.
pm.variables.set is for setting local variables
to set environment variable use pm.environment.set
Note that , it will set only the current value . INitial value remains the same
read more about postman variables
https://learning.postman.com/docs/sending-requests/variables/
I need to set a local environment variable for current user and it shoukd be visible to other processes like a new command prompt. I need it for windows. I have tried options like putenv and editing the registry from C++ code but the new cmd prompt see the old values. Primarily i need to edit PATH variable along with few custom env variables. Will appreciate if i can get a working sample code.
Please note that the environment variable need to persist past program execution.
My requirement is for windows. I even tried running setx from C++ code and it works fine but for PATH variable it trims it down to 1024 character and i lose the update. Is there a workaround to this?
IF my wording looks confusing about the requirement. I need exactly same behavior as if i am using setx.
Thanks in advance.
If you start Cmd.exe from your process you can control its environment. The environment variables are inherited from the parent process. They can also be overridden when you call CreateProcess.
If you change the users/system environment configuration in the registry(HKCU\Environment/HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment) and log off/reboot then the first process will use these new defaults.
If you update the registry you can tell other applications to refresh their environments without logging off by broadcasting a message:
BroadcastSystemMessage(0, 0, WM_SETTINGCHANGE, 0, (LPARAM)TEXT("Environment"));
In reality it is only Explorer.exe that reacts to this message but that is enough to affect new applications started from the taskbar/start menu.
The setx command is actually an executable that sets values in the registry. If you are looking to simulate the behavior where you can set an environment variable that will last longer than the current process you will need to write it to the HKCU\Environment key. The HKCU is for the the current user and can be written to without elevated permissions.
Use RegEdit.exe or reg.exe query HKCU\Environment to view the current settings. From C/C++ you can use the Registry functions. If you can, I recommend using the ATL CRegKey class as it follows RAII and ensures handles are properly cleaned up.
I has customize the DefaultTemplate and change the SyncWorkspace activity to TfGet activity.
Now I'm trying to queue a build with shelve but the build seem to ignore the shelve and ran the build without the shelve, I'v tried to queue the same build with the same shelve in the default template and everything is fine..
There is anyone that know what the problem?
Did you have to use TF get activity to get the sources. There are some obvious differences between the both SyncWorkspace and Tf get activity. Recommend you to use TF get source activity. Tess pass on my environment with below settings.
Each build process template has a parameter called SupportedReasons. This enum is normally set to all. Make sure you have this parameter in your customized templated and didn't change the value.
It is possible to set the delay time when executing a jenkins build?
Like when using p.ex:
http://host/jenkins/job/job_name/build?delay=100sec
But making it with a plugin. I dont know how to get this delay parameter and set it with another value.
Thanks a lot.
I think build parameters are stored as environment variables and if that's the case, then you should be able set them using some code like this:
build.getEnvironment(listener).put("delay", "250");
In your plugin, you would put this in the setUp method of a class that extends the BuildWrapper.