Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [che-dev] adding environment variables support to Builder.class

Hi,

Following the comments on Github  ,I add new Commit

 

https://github.com/codenvy/che-core/pull/115

 

Please review and merge if accepted.

 

Thanks,

-Dany.

 

 

 

From: che-dev-bounces@xxxxxxxxxxx [mailto:che-dev-bounces@xxxxxxxxxxx] On Behalf Of Shapiro, Dany
Sent: Sunday 14 June 2015 14:38
To: che developer discussions
Subject: Re: [che-dev] adding environment variables support to Builder.class

 

Hi,

Following my previous email, below you can find the a pull request.

 

https://github.com/codenvy/che-core/pull/115

 

Please review and merge if accepted.

 

Thanks,

-Dany.

 

 

From: che-dev-bounces@xxxxxxxxxxx [mailto:che-dev-bounces@xxxxxxxxxxx] On Behalf Of Shapiro, Dany
Sent: Thursday 11 June 2015 15:36
To: che-dev@xxxxxxxxxxx
Subject: [che-dev] adding environment variables support to Builder.class

 

Hi,

We, here at SAP are developing Che Builder that should be able to execute build requests while the execution relies on environment variables.

i.e. the commands that are going to be executed by the builder read some information from the  environment variables.

Hence the environment variables should be updated before the build execution dynamically for every build.

 

Following current implementation the information could be passed to the builder using the BuildRequest, but as I see it, update of the environment variables before the build execution is missing.

So I'm proposing  to add  the following method to the Builder.class

 

public Map<String, String> getEnvironmentVariables (){

                return new HashMap<String, String>();

}

 

Any implementing builder class can override this method , by default it will be empty .

so that in Line 440 in Builder.class ,the code could be changed to the following :

 

ProcessBuilder processBuilder = new ProcessBuilder().command(commandLine.toShellCommand()).directory(

                            configuration.getWorkDir()).redirectErrorStream(true);

 

Map<String, String> env = processBuilder.environment();

env. putAll(getEnvironmentVariables());

 

Process process = processBuilder.start();

 

 

 

This way the command executed by the builder will be able to use the environment variables passed in to the builder using the BuildRequest.

Do you agree on this solution? Please provide any insights or suggestion,  I will prepare a pull request shortly.

 

Thanks

 

Best Regards,

Dany Shapiro.

DI Cloud Exp DevX | SaaS Extensions &  Ecosystem Team | SAP Labs Israel | 15 Hatidhar st. | Raanana 43665, Israel

T +972-(0)9-777-5201

SAP_logo_small

 

 


Back to the top