Octopus set ASPNETCORE_ENVIRONMENT - environment-variables

Windows 10
Octopus v2018.4.3
Has anyone successfully used Octopus to set the system environment variable ASPNETCORE_ENVIRONMENT ?

To set system variable from octopus, you need to run bash command for that
Command : setx ASPNETCORE_ENVIRONMENT "C:\foo" /M

Related

Could I override the grails.env during runtime

Grails seems to build the artefacts per env.
with the command "grails -Dgrails.env=test war
Is it possible for me to override the running environment programmatically?
The issue here is that we produce the war file using production env config. But I want to run the same war file in other environments, like Test, Staging, DR etc.
There are two options:
1. set grails.env in command line
2. programmatically set the current env in the code.
I wonder how could I achieve option2. Our deploy script is shared, not grails specific. There is a generic environment variable named SYSTEM is passed in command line. If I could map that env to the grails.env in code, that would be idea.

Jenkins Sonarqube Plugin: JAVA_HOME exists but does not point to a valid Java home

I am trying to set up the Sonarqube for my project, but when I start to generate a build, I get the following error:
ERROR: JAVA_HOME exists but does not point to a valid Java home
folder. No "\bin\java.exe" file can be found there.
The SonarQube Scanner did not complete successfully
I check some docs but none of them helps. For the JAVA_HOME environment variable, I point it to be C:\Program Files (x86)\Java\jdk1.8.0_111 I also double check it by using powershell java -version command. It also gives me the same answer: java version "1.8.0_111" . Anyone knows how to solve the problem?
Thanks.
You can edit:
C:\Users\HOME_FOLDER\.jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarQubeScanner\bin>notepad sonar-scanner.bat
and put following:
SET JAVA_HOME=< JDK Path>
if EXIST in the sonar-scanner.bat fails because there is a space in the path, so the solution is to set the JAVA_HOME to a value without spaces e.g. using the short name of the "Program Files" SET JAVA_HOME= C:\Progra~1\Java\jre9
I encountered the same error. The issue was with sonar-scanner.bat referencing wrong %JAVA_HOME% path.
In the sonar-scanner.bat the variable "use_embedded_jre" is set to true and immediately the validation is done for the PATH.
#REM ==== START VALIDATION ====
#REM *** JAVA EXEC VALIDATION ***
set use_embedded_jre=true
if "%use_embedded_jre%" == "true" (
set "JAVA_HOME=%SONAR_SCANNER_HOME%\jre"
)
Set the variable value to "false", the issue will be fixed.
set use_embedded_jre=false
Ensure that JAVA_HOME is pointing JDK .
Please try to reinstall the java 8. Setup JAVA_HOME again then It will work.
This problem might be because space between "Program Files (x86)"
I had the same problem and struggled with it for a while.
After modifying sonar-scanner.bat a bit I found out that during execution of Sonarqube the %JAVA_HOME% was completely different from the one I configured in my environment variables.
Turned out I had hardcoded JDK installations in my Global Tool Configuration inside Jenkins.
My solution:
Open your Jenkins, go to Manage Jenkins -> Global Tool Configuration
Click JDK installations...
Make sure JAVA_HOME parameter is empty or just click Delete JDK
In this case Jenkins will use %JAVA_HOME% variable it finds during the execution and it's just the one you configured in your environment variables. Worked for me
You should restart your machine after java installation.
I was having the same issue. On my machine JRE was located at C:\Program Files (x86)\Jenkins\jre. So I appended System's PATH Environment Variable with C:\Program Files (x86)\Jenkins\jre\bin;
It worked.
Do not forget to restart Jenkins service from Windows Services

Register dll with Jenkins + Octopus

I want to do deploy a DLL file into the Test environment with Jenkins and Octopus. How can I register the DLL file onto the Test environment straight from Octopus ? Is this the good approach or how can this be achieved ?
The main thing that I want to is that I do not want to run the regsvr32 instruction in cmd on the test server but instead I want to automate it and run it when the deploy from the Octopus happens.
Thank you
Open your Octopus project processes.
Add step (Run a script): You should do this with powershell.
Set your environments if necessary.
Example Powershell:First line is a Powershell command. Second line is executing CMD command on powershell with this:
& "someprogram.exe" parameters
copy-item -Path \\10.0.0.10\DllShareName\myapp.dll -Destination \\10.0.0.11\MyDllTargetFolder
& "C:\windows\system32\regsvr32.exe" myapp.dll

How to set Jenkins installation file location?

I want to set Jenkins file location to E:\Programs\Jenkins kind of location
I'm using the command java -jar jenkins.war
How do i specify the file location with that commad
I think you mean jenkins home. Just specify JENKINS_HOME environment variable before launching jenkins. If you are using Windows go to user accounts configuration and change your environment variables. Add variable JENKINS_HOME with value E:\Programs\Jenkins.

How to set environment variable in Solaris 11 for ant?

I am trying to install ant in Solaris. I am using this:
https://ant.apache.org/manual/install.html
but I have no idea how to set the ANT_HOME environment variable. Please help?
If you want to set the ANT_HOME temporally, typing export ANT_HOME=you ant path in your installing terminal. Otherwise, you can add ANT_HOME permanently by adding a line of export ANT_HOME=you ant path in /etc/profile file (you have to own root privilege).

Resources