From 0a6b0d1cc15cfbda5bd93d62262f9e2dc1a34254 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Fri, 13 Oct 2023 14:40:17 +0000 Subject: [PATCH] generate-config: ensure the config repo checkout in ~/config directory The choosen config repo name is up to the administrator (like microzuul-config) in our first use case. However to simplify we can simply assume that the checkout is done in a well known directory such as "config". The "dib-ansible" command assume a checkout named "config". So this change ensures the checkout is always named "config". Change-Id: I810f85246d1229cc06383aa7ccb91d9249f79047 --- controllers/static/nodepool/generate-config.sh | 10 +++++----- controllers/static/zuul/generate-tenant-config.sh | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/controllers/static/nodepool/generate-config.sh b/controllers/static/nodepool/generate-config.sh index ed7aac1e..24a64434 100644 --- a/controllers/static/nodepool/generate-config.sh +++ b/controllers/static/nodepool/generate-config.sh @@ -31,8 +31,8 @@ if [ "$CONFIG_REPO_SET" == "TRUE" ]; then REF=${REF:-origin/master} # Clone or fetch config repository - if [ -d ~/${CONFIG_REPO_NAME}/.git ]; then - pushd ~/${CONFIG_REPO_NAME} + if [ -d ~/config/.git ]; then + pushd ~/config git remote remove origin git remote add origin ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} git fetch origin @@ -40,13 +40,13 @@ if [ "$CONFIG_REPO_SET" == "TRUE" ]; then popd else pushd ~/ - git clone ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} + git clone ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} config popd fi # Append the config repo provided config file to the default one - if [ -f ~/${CONFIG_REPO_NAME}/nodepool/${NODEPOOL_CONFIG_FILE} ]; then - cat ~/${CONFIG_REPO_NAME}/nodepool/${NODEPOOL_CONFIG_FILE} >> ~/nodepool.yaml + if [ -f ~/config/nodepool/${NODEPOOL_CONFIG_FILE} ]; then + cat ~/config/nodepool/${NODEPOOL_CONFIG_FILE} >> ~/nodepool.yaml fi fi diff --git a/controllers/static/zuul/generate-tenant-config.sh b/controllers/static/zuul/generate-tenant-config.sh index 40689a81..af690dc6 100644 --- a/controllers/static/zuul/generate-tenant-config.sh +++ b/controllers/static/zuul/generate-tenant-config.sh @@ -26,8 +26,8 @@ if [ "$CONFIG_REPO_SET" == "TRUE" ]; then REF=${REF:-origin/master} # Clone or fetch config repository - if [ -d ~/${CONFIG_REPO_NAME}/.git ]; then - pushd ~/${CONFIG_REPO_NAME} + if [ -d ~/config/.git ]; then + pushd ~/config git remote | grep origin && git remote remove origin git remote add origin ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} if [ "$INIT_CONTAINER" == "1" ]; then @@ -41,9 +41,9 @@ if [ "$CONFIG_REPO_SET" == "TRUE" ]; then else pushd ~/ if [ "$INIT_CONTAINER" == "1" ]; then - git clone ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} || true + git clone ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} config || true else - git clone ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} + git clone ${CONFIG_REPO_BASE_URL}/${CONFIG_REPO_NAME} config fi popd fi @@ -56,8 +56,8 @@ if [ "$CONFIG_REPO_SET" == "TRUE" ]; then EOF # Append the config repo provided tenant file to the default one - if [ -f ~/${CONFIG_REPO_NAME}/zuul/main.yaml ]; then - cat ~/${CONFIG_REPO_NAME}/zuul/main.yaml >> ~/main.yaml + if [ -f ~/config/zuul/main.yaml ]; then + cat ~/config/zuul/main.yaml >> ~/main.yaml fi fi