Skip to content

Commit

Permalink
Merge pull request #77 from T-Systems-MMS/pip_requirements
Browse files Browse the repository at this point in the history
Pip requirements
  • Loading branch information
michaelamattes authored Mar 16, 2023
2 parents 993f9de + ad8750e commit 8323831
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Extension of installed tools.
| ARG | Required | Default | Description | build.yaml use default | build.yaml setup custom |
| ------------ | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| WORKDIR | no | /root | | | |
| REQUIREMENTS | no | | requirements that should be installed for the used tools, currently the following are supported **_[pip, ansible(roles, collections)]_** | requirements:<br>&nbsp;&nbsp;pip:<br>&nbsp;&nbsp;&nbsp;&nbsp;- packaging<br>&nbsp;&nbsp;&nbsp;&nbsp;requests[security]<br>&nbsp;&nbsp;&nbsp;&nbsp;xmltodict<br>&nbsp;&nbsp;ansible:<br>&nbsp;&nbsp;&nbsp;&nbsp;roles:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- t_systems_mms.grafana<br>&nbsp;&nbsp;&nbsp;&nbsp;collections:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- t_systems_mms.acme=2.3.1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- t_systems_mms.icinga_director=1.28.0 | |
| REQUIREMENTS | no | | requirements that should be installed for the used tools, currently the following are supported **_[pip, ansible(roles, collections)]_** | requirements:<br>&nbsp;&nbsp;pip:<br>&nbsp;&nbsp;&nbsp;&nbsp;packages:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- awsume<br>&nbsp;&nbsp;&nbsp;&nbsp;requirements:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- [https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt](https://raw.githubusercontent.com/ansible-collections/azure/v1.15.0/requirements-azure.txt)<br>&nbsp;&nbsp;ansible:<br>&nbsp;&nbsp;&nbsp;&nbsp;roles:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- t_systems_mms.grafana<br>&nbsp;&nbsp;&nbsp;&nbsp;collections:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- t_systems_mms.acme=2.3.1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- t_systems_mms.icinga_director=1.28.0<br>&nbsp;&nbsp;&nbsp;&nbsp;requirements:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- https://raw.githubusercontent.com/T-Systems-MMS/ansible-role-maxscale/master/requirements.yml | |
| EXTENSIONS | no | | extensions that should be installed for the used tools, currently the following are supported **_[az, google, helm]_** | extensions:<br>&nbsp;&nbsp;az:<br>&nbsp;&nbsp;&nbsp;&nbsp;- front-door=1.0.15<br>&nbsp;&nbsp;google:<br>&nbsp;&nbsp;&nbsp;&nbsp;- gsutil<br>&nbsp;&nbsp;&nbsp;&nbsp;- gke-gcloud-auth-plugin<br>&nbsp;&nbsp;&nbsp;&nbsp;- kubectl<br>&nbsp;&nbsp;helm:<br>&nbsp;&nbsp;&nbsp;&nbsp;- https://github.com/databus23/helm-diff=3.5.0<br>&nbsp;&nbsp;&nbsp;&nbsp;- https://github.com/jkroepke/helm-secrets | |

#### Post Build Config
Expand Down Expand Up @@ -148,9 +148,9 @@ If you mount your repositories to the DMC you might want to run it with your loc

This should give you a few benefits:

- no permissions issues when editing files from within the container
- being able to use the local ssh auth key for ansible
- local configuration is used in the container (.bashrc, .gitconfig, .vimrc etc)
* no permissions issues when editing files from within the container
* being able to use the local ssh auth key for ansible
* local configuration is used in the container (.bashrc, .gitconfig, .vimrc etc)

Example:

Expand Down
13 changes: 6 additions & 7 deletions examples/full_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,22 @@ repositories:
binaries:
github:
- remotemobprogramming/mob=linux_amd64
- derailed/k9s=Linux_x86_64
google:
- google-cloud-cli
requirements:
pip:
- packaging
- requests[security]
- xmltodict
- azure-cli-core
- azure-common
- awsume
packages:
- awsume
requirements:
- https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt
ansible:
roles:
- t_systems_mms.grafana
collections:
- t_systems_mms.acme
- t_systems_mms.icinga_director
requirements:
- https://raw.githubusercontent.com/T-Systems-MMS/ansible-role-maxscale/master/requirements.yml
extensions:
az:
- front-door
Expand Down
6 changes: 3 additions & 3 deletions render.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ KEYS=$(cut -d '=' -f1 "${BUILD_FILE}" | sort -u)
## generate ARG=VALUE for replacement
for KEY in ${KEYS}
do
if [ "$(grep -wc "${KEY}" "${BUILD_FILE}")" -gt 1 ]; then
VALUE=$(grep -w "${KEY}" "${BUILD_FILE}" | cut -d '=' -f2- | sort -u | tr '\n' ';')
if [ "$(grep -c "^${KEY}=" "${BUILD_FILE}")" -gt 1 ]; then
VALUE=$(grep "^${KEY}=" "${BUILD_FILE}" | cut -d '=' -f2- | sort -u | tr '\n' ';')
else
VALUE=$(grep -w "${KEY}" "${BUILD_FILE}" | cut -d '=' -f2- | sort -u | tr -d '\n')
VALUE=$(grep "^${KEY}=" "${BUILD_FILE}" | cut -d '=' -f2- | sort -u | tr -d '\n')
fi
ARG=$(echo "${KEY}" | awk '{print toupper($0)}')

Expand Down
6 changes: 4 additions & 2 deletions template.d/21_requirements
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ 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_REQ[@]}; do pip3 install --no-cache-dir "${REQUIREMENT_REQ//=/==}";done; fi && \
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; fi; 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

0 comments on commit 8323831

Please sign in to comment.