Does anyone know how to check if an environmental variables is empty in gradle ?? Ie APP_NAME I want to check if an empty string is sent back from the pipeline?
m
Matias
03/27/2021, 4:23 PM
Use
System.getenv("APP_NAME")
f
Freedom
03/27/2021, 4:25 PM
Thanks I know how to get an environmental variables I want to check is it an empty string
m
Matias
03/27/2021, 4:27 PM
if you have the gradle file in groovy you can do:
Copy code
if (!System.getenv("APP_NAME")?.trim()) {
//here if null or empty
}
if you have it in kts, you can just use any kotlin function…