This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Ragin-LundF/feature/selection_of_templates
Feature/selection of templates
- Loading branch information
Showing
12 changed files
with
352 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.11.0 | ||
1.12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
########## | ||
# Find templates from "templates/cloud-templates" directory. | ||
# Returns empty value if nothing was found or an array of the files | ||
# | ||
# argument 1: variable in which the result should be written (return value) | ||
########## | ||
function findJenkinsCloudTemplates() { | ||
# arguments | ||
local ARG_RETVALUE_CLOUD_TEMPLATES=$1 | ||
local __INTERNAL_TEMPLATES_FILE_ARRAY | ||
if [[ -d "${TEMPLATES_BASE_DIRECTORY}cloud-templates" ]]; then | ||
__INTERNAL_TEMPLATES_FILE_ARRAY=($(ls "${TEMPLATES_BASE_DIRECTORY}cloud-templates" | grep yaml | sort)) | ||
fi | ||
eval ${ARG_RETVALUE_CLOUD_TEMPLATES}="(\${__INTERNAL_TEMPLATES_FILE_ARRAY[@]})" | ||
} | ||
|
||
########## | ||
# Read selected templates from "templates/cloud-templates" directory. | ||
# This method will do an "echo" if the result is not empty. | ||
# Usage: RESULT_VAR=$(readSelectedCloudTemplates "${VAR[@]}") | ||
# | ||
# argument 1: array with selected files | ||
########## | ||
function readSelectedCloudTemplates() { | ||
# arguments | ||
local ARG_CLOUD_TEMPLATES=("$@") | ||
|
||
for __CLOUD_TEMPLATE_NAME in "${ARG_CLOUD_TEMPLATES[@]}" | ||
do | ||
local __INTERNAL_CLOUD_TEMPLATE_CAT | ||
__INTERNAL_CLOUD_TEMPLATE_CAT=$(cat "${TEMPLATES_BASE_DIRECTORY}cloud-templates/${__CLOUD_TEMPLATE_NAME//\"/}") | ||
# if content was not empty, add it to return value | ||
if [[ -n "${__INTERNAL_CLOUD_TEMPLATE_CAT}" ]]; then | ||
echo "${__INTERNAL_CLOUD_TEMPLATE_CAT}" | ||
fi | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.