@@ -142,29 +142,23 @@ jobs:
142142
143143 echo "Creating template: $NEW_TEMPLATE"
144144
145- # Get the startup script from the current template
145+ # Get the startup script from the current template and update IMAGE_TAG
146146 gcloud compute instance-templates describe $CURRENT_TEMPLATE \
147- --format="value(properties.metadata.items[startup-script])" > /tmp/startup-script.sh
148-
149- # Create new template based on current one but with new image tag
150- gcloud compute instance-templates create $NEW_TEMPLATE \
151- --source-instance-template=$CURRENT_TEMPLATE \
152- --metadata-from-file=startup-script=/tmp/startup-script.sh \
153- --project=${{ env.PROJECT_ID }} \
154- --region=${{ env.REGION }}
155-
156- # Update the IMAGE_TAG in the startup script metadata
157- # The startup script uses ${image_tag} variable which gets replaced
158- gcloud compute instance-templates describe $NEW_TEMPLATE \
159147 --format="value(properties.metadata.items[startup-script])" | \
160- sed "s|IMAGE_TAG=.*|IMAGE_TAG=\"$TAG\"|g" > /tmp/startup-script-updated.sh
161-
162- # Recreate template with updated startup script
163- gcloud compute instance-templates delete $NEW_TEMPLATE --quiet
148+ sed "s|IMAGE_TAG=\".*\"|IMAGE_TAG=\"$TAG\"|g" > /tmp/startup-script-updated.sh
164149
150+ # Create new template with all parameters from current template
165151 gcloud compute instance-templates create $NEW_TEMPLATE \
166- --source-instance-template=$CURRENT_TEMPLATE \
152+ --machine-type=e2-medium \
153+ --network-interface=network-tier=PREMIUM,address=34.14.39.221 \
167154 --metadata-from-file=startup-script=/tmp/startup-script-updated.sh \
155+ --metadata=enable-oslogin=TRUE \
156+ --maintenance-policy=MIGRATE \
157+ --provisioning-model=STANDARD \
158+ --service-account=merkle-oracle-node-sa-staging@merkle-oracle-staging.iam.gserviceaccount.com \
159+ --scopes=https://www.googleapis.com/auth/cloud-platform \
160+ --tags=merkle-oracle-node-web,allow-health-check \
161+ --create-disk=auto-delete=yes,boot=yes,device-name=persistent-disk-0,image=projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts,mode=rw,size=100,type=pd-ssd \
168162 --project=${{ env.PROJECT_ID }} \
169163 --region=${{ env.REGION }}
170164
0 commit comments