refactor(EnvironmentVars): streamline variable injection by removing redundant assignments
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
072ff4960a
commit
f88662b1e3
@ -10,30 +10,29 @@ class EnvironmentVars {
|
||||
}
|
||||
|
||||
def injectVars(Map configurations) {
|
||||
steps.env.SERVICE_NAME = "${configurations.SERVICE_NAME}"
|
||||
echo "SERVICE_NAME: ${steps.env.SERVICE_NAME}"
|
||||
if (steps.env.SERVICE_NAME == null || steps.env.SERVICE_NAME.isEmpty()) {
|
||||
steps.error("SERVICE_NAME is required")
|
||||
}
|
||||
steps.env.SERVICE_NAME = configurations.SERVICE_NAME
|
||||
|
||||
steps.env.SERVICE_LANG = ServiceLanguage.parse("${configurations.SERVICE_LANG}")
|
||||
steps.env.SERVICE_LANG = ServiceLanguage.parse(configurations.SERVICE_LANG)
|
||||
if (steps.env.SERVICE_LANG == ServiceLanguage.UNKNOWN) {
|
||||
steps.error("Unknown service language: ${configurations.SERVICE_LANG}")
|
||||
}
|
||||
|
||||
steps.env.SERVICE_GIT_REPO = "${configurations.SERVICE_GIT_REPO}"
|
||||
if (steps.env.SERVICE_GIT_REPO == null || steps.env.SERVICE_GIT_REPO.isEmpty()) {
|
||||
steps.error("SERVICE_GIT_REPO is required")
|
||||
}
|
||||
steps.env.SERVICE_GIT_REPO = configurations.SERVICE_GIT_REPO
|
||||
|
||||
steps.env.SERVICE_GIT_BRANCH = "${configurations.SERVICE_GIT_BRANCH}"
|
||||
if (steps.env.SERVICE_GIT_BRANCH == null || steps.env.SERVICE_GIT_BRANCH.isEmpty()) {
|
||||
steps.error("SERVICE_GIT_BRANCH is required")
|
||||
}
|
||||
steps.env.SERVICE_GIT_BRANCH = configurations.SERVICE_GIT_BRANCH
|
||||
|
||||
steps.env.ENVIRONMENT_SLUG = "${configurations.ENVIRONMENT_SLUG}"
|
||||
if (steps.env.ENVIRONMENT_SLUG == null || steps.env.ENVIRONMENT_SLUG.isEmpty()) {
|
||||
steps.error("ENVIRONMENT_SLUG is required")
|
||||
}
|
||||
steps.env.ENVIRONMENT_SLUG = configurations.ENVIRONMENT_SLUG
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user