fix(ci): update infra manifests after blue-green swap
Neuron Soul CI / build (push) Failing after 10m28s
Neuron Soul CI / build (push) Failing after 10m28s
This commit is contained in:
@@ -200,6 +200,46 @@ jobs:
|
|||||||
--image "${{ steps.vars.outputs.image }}" \
|
--image "${{ steps.vars.outputs.image }}" \
|
||||||
--slot "${{ steps.vars.outputs.slot }}"
|
--slot "${{ steps.vars.outputs.slot }}"
|
||||||
|
|
||||||
|
- name: Update infrastructure manifests
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
INFRA_GIT_TOKEN: ${{ secrets.INFRA_GIT_TOKEN }}
|
||||||
|
run: |
|
||||||
|
SLOT="${{ steps.vars.outputs.slot }}"
|
||||||
|
if [ "$SLOT" = "blue" ]; then IDLE="green"; else IDLE="blue"; fi
|
||||||
|
|
||||||
|
git clone "http://${INFRA_GIT_TOKEN}@34.31.145.131/neuron-technologies/infrastructure.git" \
|
||||||
|
--depth=1 --branch=main /tmp/infra-update
|
||||||
|
|
||||||
|
cd /tmp/infra-update
|
||||||
|
|
||||||
|
DEPLOY_DIR="platform/k8s/neuron-mcp"
|
||||||
|
python3 -c "
|
||||||
|
import re, sys
|
||||||
|
|
||||||
|
slot = sys.argv[1]
|
||||||
|
idle = sys.argv[2]
|
||||||
|
|
||||||
|
def set_replicas(path, count):
|
||||||
|
with open(path) as f:
|
||||||
|
content = f.read()
|
||||||
|
content = re.sub(r'^( replicas: )\d+', r'\g<1>' + str(count), content, count=1, flags=re.MULTILINE)
|
||||||
|
with open(path, 'w') as f:
|
||||||
|
f.write(content)
|
||||||
|
print(f' {path}: replicas set to {count}')
|
||||||
|
|
||||||
|
set_replicas(f'{DEPLOY_DIR}/deployment-{slot}.yaml', 1)
|
||||||
|
set_replicas(f'{DEPLOY_DIR}/deployment-{idle}.yaml', 0)
|
||||||
|
" "$SLOT" "$IDLE"
|
||||||
|
|
||||||
|
git config user.email "ci@neurontechnologies.ai"
|
||||||
|
git config user.name "Neuron CI"
|
||||||
|
git add "${DEPLOY_DIR}/deployment-blue.yaml" "${DEPLOY_DIR}/deployment-green.yaml"
|
||||||
|
git diff --staged --quiet && { echo "No manifest changes needed"; exit 0; }
|
||||||
|
git commit -m "ci: neuron-mcp replica sync after blue-green swap to ${SLOT}"
|
||||||
|
git push origin main
|
||||||
|
echo "Infrastructure manifests updated: ${SLOT}=1, ${IDLE}=0"
|
||||||
|
|
||||||
- name: Verify deployment
|
- name: Verify deployment
|
||||||
run: |
|
run: |
|
||||||
SLOT="${{ steps.vars.outputs.slot }}"
|
SLOT="${{ steps.vars.outputs.slot }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user