Skip to content

Commit

Permalink
Fix job template (#179)
Browse files Browse the repository at this point in the history
* fix job template
  • Loading branch information
bolyachevets authored Sep 10, 2024
1 parent bae3278 commit 8719d5d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/actions/backend-deploy-job/files/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@ steps:
op inject -f -i ./devops/vaults.gcp.env -o ./devops/vaults.${env_name}
export VPC_CONNECTOR=$(awk -F '=' '/^VPC_CONNECTOR/ {print $2}' ./devops/vaults.${env_name})
export VAL=$(awk '{f1=f2=$0; sub(/=.*/,"",f1); sub(/[^=]+=/,"",f2); printf "- name: %s\n value: %s\n",f1,f2}' ./devops/vaults.${env_name} | sed 's/\"/\"/g')
if [ "$VPC_CONNECTOR" ]; then
yq e '.spec.template.metadata.annotations["run.googleapis.com/vpc-access-egress"] = "private-ranges-only" |
.spec.template.metadata.annotations["run.googleapis.com/vpc-access-connector"] = env(VPC_CONNECTOR)' \
./devops/gcp/k8s/service.template.yaml > ./devops/gcp/k8s/temp-service.${env_name}.yaml
# generate manifest for each environment
yq e '.spec.template.spec.containers[0].env += env(VAL)' ./devops/gcp/k8s/temp-service.${env_name}.yaml > ./devops/gcp/k8s/service.${env_name}.yaml
else
# generate manifest for each environment
yq e '.spec.template.spec.template.spec.containers[0].env += env(VAL)' ./devops/gcp/k8s/job.template.yaml > ./devops/gcp/k8s/job.${env_name}.yaml
fi
export VAL=$(awk '{f1=f2=$0; sub(/=.*/,"",f1); sub(/[^=]+=/,"",f2); printf "- name: %s\n value: %s\n",f1,f2}' ./devops/vaults.${env_name} | sed 's/\"/\"/g')
# generate manifest for each environment
yq e '.spec.template.spec.template.spec.containers[0].env += env(VAL)' ./devops/gcp/k8s/job.template.yaml > ./devops/gcp/k8s/job.${env_name}.yaml
done
targets_full=(${_DEPLOY_FULL_TARGETS})
Expand Down

0 comments on commit 8719d5d

Please sign in to comment.