-
Notifications
You must be signed in to change notification settings - Fork 9
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 #88 from z-bsod/formatting
try to improve readabilty of templates by using indentation
- Loading branch information
Showing
6 changed files
with
142 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
## repositories | ||
RUN if [ -n "${REPOSITORIES}" ]; then \ | ||
IFS=';' && \ | ||
for REPOSITORY in ${REPOSITORIES[@]}; do declare -u REPO="${REPOSITORY}" && REPO_GPG=$(eval "echo \$REPOSITORIES_${REPO}_GPG") && REPO_ENTRY=$(eval "eval "echo \$REPOSITORIES_${REPO}_ENTRY"") && \ | ||
curl -fsSL "${REPO_GPG}" | gpg --dearmor | tee "/etc/apt/trusted.gpg.d/${REPOSITORY}.gpg" > /dev/null && apt-add-repository "deb [arch=amd64] ${REPO_ENTRY}"; done; \ | ||
for REPOSITORY in ${REPOSITORIES[@]}; \ | ||
do \ | ||
declare -u REPO="${REPOSITORY}" && \ | ||
REPO_GPG=$(eval "echo \$REPOSITORIES_${REPO}_GPG") && \ | ||
REPO_ENTRY=$(eval "eval "echo \$REPOSITORIES_${REPO}_ENTRY"") && \ | ||
curl -fsSL "${REPO_GPG}" \ | ||
| gpg --dearmor \ | ||
| tee "/etc/apt/trusted.gpg.d/${REPOSITORY}.gpg" > /dev/null && \ | ||
apt-add-repository "deb [arch=amd64] ${REPO_ENTRY}"; \ | ||
done; \ | ||
fi |
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,16 +1,57 @@ | ||
## binaries | ||
RUN if [ -n "${BINARIES}" ]; then \ | ||
IFS=';' && \ | ||
for BINARY in ${BINARIES[@]}; do declare -u BINARY_REPO="${BINARY}" && BINARY_URI=$(eval "echo \$BINARIES_${BINARY_REPO}_URI") && BINARY_PACKAGES=$(eval "echo \$BINARIES_${BINARY_REPO}") && \ | ||
if [ "${BINARY_REPO}" = "GITHUB" ]; then for BINARY_PACKAGE in ${BINARY_PACKAGES}; do BINARY_PACKAGE_URI=$(echo "${BINARY_URI}/${BINARY_PACKAGE}" | awk -F '=' '{ if (!$3) {version="/latest"}; printf("%s/releases%s", $1, version)}') && \ | ||
BINARY_PACKAGE_VERSION=$(echo "${BINARY_PACKAGE}" | awk -F '=' '{print $3".*"$2".tar.gz"}') && \ | ||
BINARY_PACKAGE_URL=$(curl -fsSL "${BINARY_PACKAGE_URI}" | grep -Po '"browser_download_url": "\K.*?(?=\")' | grep -P "${BINARY_PACKAGE_VERSION}") && \ | ||
mkdir -p ./github && curl -SsL --retry 5 "${BINARY_PACKAGE_URL}" | tar xz -C ./github && \ | ||
chmod -R +x ./github/* && mv ./github/* /usr/local/bin/; done; fi && \ | ||
if [ "${BINARY_REPO}" = "GOOGLE" ]; then for BINARY_PACKAGE in ${BINARY_PACKAGES}; do BINARY_PACKAGE_URI=$(echo "${BINARY_PACKAGE}" | awk -F '=' '{ if (!$2) version=""; else version=$2; printf("%s_%s", $1, version)}') && \ | ||
BINARY_PACKAGE_VERSION=$(curl -fSsL "${BINARY_URI}" | grep "${BINARY_PACKAGE_URI}" | cut -d '_' -f2 | sort -un | tail -n1 | cut -d '-' -f1) && \ | ||
BINARY_PACKAGE_URL="https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/$(echo ${BINARY_PACKAGE} | cut -d '=' -f1)-${BINARY_PACKAGE_VERSION}-linux-x86_64.tar.gz" && \ | ||
mkdir -p ./google && curl -SsL --retry 5 "${BINARY_PACKAGE_URL}" | tar xz -C ./google && \ | ||
chmod -R +x ./google/* && \ | ||
sh ./google/*/install.sh --quiet --command-completion true --bash-completion true --path-update true; done; fi; done \ | ||
fi | ||
for BINARY in ${BINARIES[@]}; do \ | ||
declare -u BINARY_REPO="${BINARY}" && \ | ||
BINARY_URI=$(eval "echo \$BINARIES_${BINARY_REPO}_URI") && \ | ||
BINARY_PACKAGES=$(eval "echo \$BINARIES_${BINARY_REPO}") && \ | ||
\ | ||
# download binaries from github | ||
if [ "${BINARY_REPO}" = "GITHUB" ]; then \ | ||
for BINARY_PACKAGE in ${BINARY_PACKAGES}; \ | ||
do \ | ||
BINARY_PACKAGE_URI=$(\ | ||
echo "${BINARY_URI}/${BINARY_PACKAGE}" \ | ||
| awk -F '=' '{ if (!$3) {version="/latest"}; printf("%s/releases%s", $1, version)}'\ | ||
) && \ | ||
BINARY_PACKAGE_VERSION=$(echo "${BINARY_PACKAGE}" | awk -F '=' '{print $3".*"$2".tar.gz"}') && \ | ||
BINARY_PACKAGE_URL=$(\ | ||
curl -fsSL "${BINARY_PACKAGE_URI}" \ | ||
| grep -Po '"browser_download_url": "\K.*?(?=\")' \ | ||
| grep -P "${BINARY_PACKAGE_VERSION}"\ | ||
) && \ | ||
\ | ||
mkdir -p ./github && \ | ||
curl -SsL --retry 5 "${BINARY_PACKAGE_URL}" | tar xz -C ./github && \ | ||
chmod -R +x ./github/* && \ | ||
mv ./github/* /usr/local/bin/; \ | ||
done; \ | ||
fi && \ | ||
\ | ||
# download binaries from google | ||
if [ "${BINARY_REPO}" = "GOOGLE" ]; then \ | ||
for BINARY_PACKAGE in ${BINARY_PACKAGES}; \ | ||
do \ | ||
BINARY_PACKAGE_URI=$(\ | ||
echo "${BINARY_PACKAGE}" \ | ||
| awk -F '=' '{ if (!$2) version=""; else version=$2; printf("%s_%s", $1, version)}'\ | ||
) && \ | ||
BINARY_PACKAGE_VERSION=$(\ | ||
curl -fSsL "${BINARY_URI}" \ | ||
| grep "${BINARY_PACKAGE_URI}" \ | ||
| cut -d '_' -f2 \ | ||
| sort -un \ | ||
| tail -n1 \ | ||
| cut -d '-' -f1 \ | ||
) && \ | ||
BINARY_PACKAGE_FILENAME="$(echo ${BINARY_PACKAGE} | cut -d '=' -f1)-${BINARY_PACKAGE_VERSION}-linux-x86_64.tar.gz" && \ | ||
BINARY_PACKAGE_URL="https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${BINARY_PACKAGE_FILENAME}" && \ | ||
\ | ||
mkdir -p ./google && \ | ||
curl -SsL --retry 5 "${BINARY_PACKAGE_URL}" | tar xz -C ./google && \ | ||
chmod -R +x ./google/* && \ | ||
sh ./google/*/install.sh --quiet --command-completion true --bash-completion true --path-update true; \ | ||
done; \ | ||
fi; \ | ||
done; \ | ||
fi |
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,11 +1,41 @@ | ||
## requirements | ||
RUN if [ -n "${REQUIREMENTS}" ]; then \ | ||
IFS=';' && \ | ||
for REQUIREMENT in ${REQUIREMENTS[@]}; do IFS='' && declare -u REQ="${REQUIREMENT}" && REQUIREMENTS_REQ=$(eval "echo \$REQUIREMENTS_${REQ}") && \ | ||
IFS=';' && \ | ||
if [ "${REQ}" = "PIP" ]; then for REQUIREMENT_REQ in ${REQUIREMENTS_PIP_PACKAGES[@]}; do pip3 install --no-cache-dir "${REQUIREMENT_REQ//=/==}"; done && \ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_PIP_REQUIREMENTS[@]}; do pip3 install --no-cache-dir -r "${REQUIREMENT_REQ}"; done; fi && \ | ||
if [ "${REQ}" = "ANSIBLE" ]; then for REQUIREMENT_REQ in ${REQUIREMENTS_ANSIBLE_ROLES[@]}; do ansible-galaxy install "${REQUIREMENT_REQ//=/,}"; done && \ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_ANSIBLE_COLLECTIONS[@]}; do ansible-galaxy collection install "${REQUIREMENT_REQ//=/:}"; done&& \ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_ANSIBLE_REQUIREMENTS[@]}; do ansible-galaxy install -r "${REQUIREMENT_REQ}"; done; fi; done \ | ||
for REQUIREMENT in ${REQUIREMENTS[@]}; \ | ||
do \ | ||
IFS='' && \ | ||
declare -u REQ="${REQUIREMENT}" && \ | ||
REQUIREMENTS_REQ=$(eval "echo \$REQUIREMENTS_${REQ}") && \ | ||
IFS=';' && \ | ||
\ | ||
if [ "${REQ}" = "PIP" ]; then \ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_PIP_PACKAGES[@]}; \ | ||
do \ | ||
pip3 install --no-cache-dir "${REQUIREMENT_REQ//=/==}"; \ | ||
done && \ | ||
\ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_PIP_REQUIREMENTS[@]}; \ | ||
do \ | ||
pip3 install --no-cache-dir -r "${REQUIREMENT_REQ}"; \ | ||
done; \ | ||
fi && \ | ||
\ | ||
if [ "${REQ}" = "ANSIBLE" ]; \ | ||
then \ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_ANSIBLE_ROLES[@]}; \ | ||
do \ | ||
ansible-galaxy install "${REQUIREMENT_REQ//=/,}"; \ | ||
done && \ | ||
\ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_ANSIBLE_COLLECTIONS[@]}; \ | ||
do \ | ||
ansible-galaxy collection install "${REQUIREMENT_REQ//=/:}"; \ | ||
done && \ | ||
\ | ||
for REQUIREMENT_REQ in ${REQUIREMENTS_ANSIBLE_REQUIREMENTS[@]}; \ | ||
do \ | ||
ansible-galaxy install -r "${REQUIREMENT_REQ}"; \ | ||
done; \ | ||
fi; \ | ||
done \ | ||
fi |
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,9 +1,32 @@ | ||
## extensions | ||
RUN if [ -n "${EXTENSIONS}" ]; then \ | ||
IFS=';' && \ | ||
for EXTENSION in ${EXTENSIONS[@]}; do IFS='' && declare -u EXT="${EXTENSION}" && EXTENSIONS_EXT=$(eval "echo \$EXTENSIONS_${EXT}") && \ | ||
IFS=';' && \ | ||
if [ "${EXT}" = "AZ" ]; then for EXTENSION_EXT in ${EXTENSIONS_EXT[@]}; do az extension add -y --name "${EXTENSION_EXT//=/ --version }"; done; fi && \ | ||
if [ "${EXT}" = "GOOGLE" ]; then for EXTENSION_EXT in ${EXTENSIONS_EXT[@]}; do ./google/*/bin/gcloud components install "${EXTENSION_EXT}" && "${EXTENSION_EXT//.*=/gcloud components update --version }"; done; fi && \ | ||
if [ "${EXT}" = "HELM" ]; then for EXTENSION_EXT in ${EXTENSIONS_EXT[@]}; do helm plugin install "${EXTENSION_EXT//=/ --version}"; done; fi; done \ | ||
for EXTENSION in ${EXTENSIONS[@]}; do \ | ||
IFS='' && \ | ||
declare -u EXT="${EXTENSION}" && \ | ||
EXTENSIONS_EXT=$(eval "echo \$EXTENSIONS_${EXT}") && \ | ||
IFS=';' && \ | ||
\ | ||
if [ "${EXT}" = "AZ" ]; then \ | ||
for EXTENSION_EXT in ${EXTENSIONS_EXT[@]}; \ | ||
do \ | ||
az extension add -y --name "${EXTENSION_EXT//=/ --version }"; \ | ||
done; \ | ||
fi && \ | ||
\ | ||
if [ "${EXT}" = "GOOGLE" ]; then \ | ||
for EXTENSION_EXT in ${EXTENSIONS_EXT[@]}; \ | ||
do \ | ||
./google/*/bin/gcloud components install "${EXTENSION_EXT}" && \ | ||
"${EXTENSION_EXT//.*=/gcloud components update --version }"; \ | ||
done; \ | ||
fi && \ | ||
\ | ||
if [ "${EXT}" = "HELM" ]; then \ | ||
for EXTENSION_EXT in ${EXTENSIONS_EXT[@]}; \ | ||
do \ | ||
helm plugin install "${EXTENSION_EXT//=/ --version}"; \ | ||
done; \ | ||
fi; \ | ||
done \ | ||
fi |
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,7 +1,14 @@ | ||
## profiles | ||
RUN if [ -n "${PROFILES}" ]; then \ | ||
IFS=';' && \ | ||
for PROFILE in ${PROFILES[@]}; do IFS='' && declare -u PR="${PROFILE//./_}" && PROFILES_PR=$(eval "echo \$PROFILES_${PR}") && \ | ||
IFS=';' && \ | ||
for PROFILE_PR in ${PROFILES_PR[@]}; do echo "${PROFILE_PR}" >> "${PROFILE}"; done; done \ | ||
for PROFILE in ${PROFILES[@]}; \ | ||
do \ | ||
IFS='' && \ | ||
declare -u PR="${PROFILE//./_}" && \ | ||
PROFILES_PR=$(eval "echo \$PROFILES_${PR}") && \ | ||
IFS=';' && \ | ||
for PROFILE_PR in ${PROFILES_PR[@]}; do \ | ||
echo "${PROFILE_PR}" >> "${PROFILE}"; \ | ||
done; \ | ||
done \ | ||
fi |
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,5 +1,7 @@ | ||
## post_build_commands | ||
RUN if [ -n "${POST_BUILD_COMMANDS}" ]; then \ | ||
IFS=';' && \ | ||
for POST_BUILD_COMMAND in "${POST_BUILD_COMMANDS[@]}"; do bash -c "${POST_BUILD_COMMAND}"; done \ | ||
for POST_BUILD_COMMAND in "${POST_BUILD_COMMANDS[@]}"; do \ | ||
bash -c "${POST_BUILD_COMMAND}"; \ | ||
done \ | ||
fi |