fix: replace embedded python with sed in deploy-gke manifest update step
This commit is contained in:
@@ -214,23 +214,10 @@ jobs:
|
||||
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"
|
||||
sed -i "s/^ replicas: .*/ replicas: 1/" "${DEPLOY_DIR}/deployment-${SLOT}.yaml"
|
||||
sed -i "s/^ replicas: .*/ replicas: 0/" "${DEPLOY_DIR}/deployment-${IDLE}.yaml"
|
||||
echo " deployment-${SLOT}.yaml: replicas set to 1"
|
||||
echo " deployment-${IDLE}.yaml: replicas set to 0"
|
||||
|
||||
git config user.email "ci@neurontechnologies.ai"
|
||||
git config user.name "Neuron CI"
|
||||
|
||||
Reference in New Issue
Block a user