Update entrypoint logic to hack tox.ini for config generation
This commit is contained in:
parent
b82378911e
commit
1ac3ca1363
@ -28,5 +28,6 @@ RUN set -x \
|
|||||||
|
|
||||||
COPY generate.py /opt/gen-oslo-openstack-helm/generate.py
|
COPY generate.py /opt/gen-oslo-openstack-helm/generate.py
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
COPY oslo-config-generator /opt/gen-oslo-openstack-helm/oslo-config-generator
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
@ -1,23 +1,47 @@
|
|||||||
#!/bin/bash
|
#!/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
|
set -xe
|
||||||
|
|
||||||
|
# Shallow clone the Project Repo and desired branch
|
||||||
git clone --depth 1 --branch ${PROJECT_BRANCH} ${PROJECT_REPO} /tmp/${PROJECT}
|
git clone --depth 1 --branch ${PROJECT_BRANCH} ${PROJECT_REPO} /tmp/${PROJECT}
|
||||||
|
|
||||||
|
# Move into the project directory
|
||||||
cd /tmp/${PROJECT}
|
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|')
|
TOX_VENV_DIR=$(crudini --get tox.ini testenv:genconfig envdir | sed 's|^{toxworkdir}|.tox|')
|
||||||
if [ -z "$TOX_VENV_DIR" ]
|
if [ -z "$TOX_VENV_DIR" ]; then
|
||||||
then
|
TOX_VENV_DIR=".tox/genconfig"
|
||||||
TOX_VENV_DIR=".tox/genconfig"
|
|
||||||
fi
|
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)"
|
||||||
|
|
||||||
|
# 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)"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Run tox to generate the standard config files, and generate the venv
|
||||||
tox -egenconfig
|
tox -egenconfig
|
||||||
|
|
||||||
source ${TOX_VENV_DIR}/bin/activate
|
# Drop into a shell in the container.
|
||||||
|
|
||||||
python /opt/gen-oslo-openstack-helm/generate.py ${GENCONFIG_FLAGS} \
|
|
||||||
--helm_chart ${PROJECT} \
|
|
||||||
--helm_namespace ${PROJECT}
|
|
||||||
|
|
||||||
bash
|
bash
|
||||||
|
23
tools/gen-oslo-openstack-helm/oslo-config-generator
Executable file
23
tools/gen-oslo-openstack-helm/oslo-config-generator
Executable file
@ -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} \
|
||||||
|
"${@}"
|
Loading…
Reference in New Issue
Block a user