forked from att-comdev/openstack-helm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update entrypoint logic to hack tox.ini for config generation
- Loading branch information
1 parent
b823789
commit 1ac3ca1
Showing
3 changed files
with
58 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2017 The Openstack-Helm Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
set -xe | ||
|
||
# Shallow clone the Project Repo and desired branch | ||
git clone --depth 1 --branch ${PROJECT_BRANCH} ${PROJECT_REPO} /tmp/${PROJECT} | ||
cd /tmp/${PROJECT} | ||
|
||
# Move into the project directory | ||
cd /tmp/${PROJECT} | ||
|
||
# Hack the tox.ini to load our oslo-config-generator script | ||
TOX_VENV_DIR=$(crudini --get tox.ini testenv:genconfig envdir | sed 's|^{toxworkdir}|.tox|') | ||
if [ -z "$TOX_VENV_DIR" ] | ||
then | ||
TOX_VENV_DIR=".tox/genconfig" | ||
if [ -z "$TOX_VENV_DIR" ]; then | ||
TOX_VENV_DIR=".tox/genconfig" | ||
fi | ||
GENCONFIG_FLAGS=$(crudini --get tox.ini testenv:genconfig commands | sed 's/^oslo-config-generator//') | ||
echo "mv -f /opt/gen-oslo-openstack-helm/oslo-config-generator $(pwd)/${TOX_VENV_DIR}/bin/oslo-config-generator" > /tmp/oslo-config-generator-cmds | ||
crudini --get tox.ini testenv:genconfig commands >> /tmp/oslo-config-generator-cmds | ||
crudini --set tox.ini testenv:genconfig commands "$(cat /tmp/oslo-config-generator-cmds)" | ||
|
||
tox -egenconfig | ||
# Setting up the whitelisted commands to include mv, letting us drop in the | ||
# hacked oslo-config-generator. | ||
(crudini --get tox.ini testenv:genconfig whitelist_externals > /tmp/whitelist_externals) || true | ||
echo "mv" >> /tmp/whitelist_externals | ||
crudini --set tox.ini testenv:genconfig whitelist_externals "$(cat /tmp/whitelist_externals)" | ||
|
||
source ${TOX_VENV_DIR}/bin/activate | ||
# Setting environment variables for OpenStack-Helm's oslo-config-generator args | ||
echo "HELM_CHART=${PROJECT}" > /opt/gen-oslo-openstack-helm-env | ||
echo "HELM_NAMESPACE=${PROJECT}" >> /opt/gen-oslo-openstack-helm-env | ||
|
||
python /opt/gen-oslo-openstack-helm/generate.py ${GENCONFIG_FLAGS} \ | ||
--helm_chart ${PROJECT} \ | ||
--helm_namespace ${PROJECT} | ||
# Run tox to generate the standard config files, and generate the venv | ||
tox -egenconfig | ||
|
||
# Drop into a shell in the container. | ||
bash |
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,23 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2017 The Openstack-Helm Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
set -xe | ||
|
||
source /opt/gen-oslo-openstack-helm-env | ||
|
||
python /opt/gen-oslo-openstack-helm/generate.py \ | ||
--helm_chart ${HELM_CHART} \ | ||
--helm_namespace ${HELM_NAMESPACE} \ | ||
"${@}" |