Skip to content

Commit e768872

Browse files
harrryrliustve
authored andcommitted
Update yq command to work on new yaml (#375)
*Issue description:* Due to recent [change](5392eb2#diff-1d6967a449c1950768de88fc7005718c165b077f045bdbd7d30348f3dcb66e4c) with the yaml file for k8s, the release testing workflow is failing. *Description of changes:* Update the yq command to work with the updated yaml file *Testing*: Ran command locally, verified that it updated appropriately By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 4dc02fa commit e768872

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

terraform/dotnet/k8s/deploy/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ resource "null_resource" "deploy" {
134134
--docker-password="$${TOKEN}"
135135
136136
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i dotnet-frontend-service-depl.yaml
137-
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i dotnet-remote-service-depl.yaml
137+
138+
service_part=$(yq eval 'select(.kind == "Service")' dotnet-remote-service-depl.yaml)
139+
yq eval 'select(.kind == "Deployment") | .spec.template.spec.imagePullSecrets += {"name": "release-testing-ecr-secret"}' -i dotnet-remote-service-depl.yaml
140+
echo "$service_part" >> dotnet-remote-service-depl.yaml
138141
fi
139142
140143
echo "LOG: Applying sample app deployment files"

terraform/java/k8s/deploy/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ resource "null_resource" "deploy" {
135135
--docker-password="$${TOKEN}"
136136
137137
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i frontend-service-depl.yaml
138-
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i remote-service-depl.yaml
138+
139+
service_part=$(yq eval 'select(.kind == "Service")' remote-service-depl.yaml)
140+
yq eval 'select(.kind == "Deployment") | .spec.template.spec.imagePullSecrets += {"name": "release-testing-ecr-secret"}' -i remote-service-depl.yaml
141+
echo "$service_part" >> remote-service-depl.yaml
139142
fi
140143
141144
echo "LOG: Applying sample app deployment files"

terraform/node/k8s/deploy/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ resource "null_resource" "deploy" {
137137
--docker-password="$${TOKEN}"
138138
139139
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i frontend-service-depl.yaml
140-
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i remote-service-depl.yaml
140+
141+
service_part=$(yq eval 'select(.kind == "Service")' remote-service-depl.yaml)
142+
yq eval 'select(.kind == "Deployment") | .spec.template.spec.imagePullSecrets += {"name": "release-testing-ecr-secret"}' -i remote-service-depl.yaml
143+
echo "$service_part" >> remote-service-depl.yaml
141144
fi
142145
143146
echo "LOG: Applying sample app deployment files"

terraform/python/k8s/deploy/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ resource "null_resource" "deploy" {
136136
--docker-password="$${TOKEN}"
137137
138138
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i python-frontend-service-depl.yaml
139-
yq eval '.spec.template.spec.imagePullSecrets += [{"name": "release-testing-ecr-secret"}]' -i python-remote-service-depl.yaml
139+
140+
service_part=$(yq eval 'select(.kind == "Service")' python-remote-service-depl.yaml)
141+
yq eval 'select(.kind == "Deployment") | .spec.template.spec.imagePullSecrets += {"name": "release-testing-ecr-secret"}' -i python-rremote-service-depl.yaml
142+
echo "$service_part" >> python-rremote-service-depl.yaml
140143
fi
141144
142145
echo "LOG: Applying sample app deployment files"

0 commit comments

Comments
 (0)