Skip to content

Commit

Permalink
Merge "generate-config: ensure the config repo checkout in ~/config d…
Browse files Browse the repository at this point in the history
…irectory"
  • Loading branch information
Zuul CI authored and Gerrit Code Review committed Oct 16, 2023
2 parents cd8aa87 + 0a6b0d1 commit 2a9c18a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions controllers/static/nodepool/generate-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ 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
git reset --hard $REF
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
Expand Down
12 changes: 6 additions & 6 deletions controllers/static/zuul/generate-tenant-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2a9c18a

Please sign in to comment.