diff --git a/.github/workflows/actions/patch_image_and_check_diff/action.yml b/.github/workflows/actions/patch_image_and_check_diff/action.yml index 0f09e5156..57e0ea173 100644 --- a/.github/workflows/actions/patch_image_and_check_diff/action.yml +++ b/.github/workflows/actions/patch_image_and_check_diff/action.yml @@ -84,8 +84,11 @@ runs: if: ${{ inputs.repository == 'aws-otel-python-instrumentation' }} shell: bash run: | - kubectl patch deploy -n amazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \ - -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args/3", "value": "--auto-instrumentation-python-image=${{ inputs.patch-image-arn }}"}]' + # Get current deployment and update the Python image argument + kubectl get deploy -n amazon-cloudwatch amazon-cloudwatch-observability-controller-manager -o json | \ + jq '.spec.template.spec.containers[0].args |= map(if test("^--auto-instrumentation-python-image=") then "--auto-instrumentation-python-image=${{ inputs.patch-image-arn }}" else . end)' | \ + kubectl apply -f - + kubectl delete pods --all -n amazon-cloudwatch sleep 10 kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch @@ -98,8 +101,11 @@ runs: if: ${{ inputs.repository == 'aws-otel-java-instrumentation' }} shell: bash run: | - kubectl patch deploy -n amazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \ - -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args/2", "value": "--auto-instrumentation-java-image=${{ inputs.patch-image-arn }}"}]' + # Get current deployment and update the Java image argument + kubectl get deploy -n amazon-cloudwatch amazon-cloudwatch-observability-controller-manager -o json | \ + jq '.spec.template.spec.containers[0].args |= map(if test("^--auto-instrumentation-java-image=") then "--auto-instrumentation-java-image=${{ inputs.patch-image-arn }}" else . end)' | \ + kubectl apply -f - + kubectl delete pods --all -n amazon-cloudwatch sleep 10 kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch @@ -112,8 +118,11 @@ runs: if: ${{ inputs.repository == 'aws-otel-dotnet-instrumentation' }} shell: bash run: | - kubectl patch deploy -namazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \ - -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args/4", "value": "--auto-instrumentation-dotnet-image=${{ inputs.patch-image-arn }}"}]' + # Get current deployment and update the DotNet image argument + kubectl get deploy -n amazon-cloudwatch amazon-cloudwatch-observability-controller-manager -o json | \ + jq '.spec.template.spec.containers[0].args |= map(if test("^--auto-instrumentation-dotnet-image=") then "--auto-instrumentation-dotnet-image=${{ inputs.patch-image-arn }}" else . end)' | \ + kubectl apply -f - + kubectl delete pods --all -n amazon-cloudwatch sleep 10 kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch @@ -126,8 +135,11 @@ runs: if: ${{ inputs.repository == 'aws-otel-js-instrumentation' }} shell: bash run: | - kubectl patch deploy -namazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \ - -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args/5", "value": "--auto-instrumentation-nodejs-image=${{ inputs.patch-image-arn }}"}]' + # Get current deployment and update the Node.js image argument + kubectl get deploy -n amazon-cloudwatch amazon-cloudwatch-observability-controller-manager -o json | \ + jq '.spec.template.spec.containers[0].args |= map(if test("^--auto-instrumentation-nodejs-image=") then "--auto-instrumentation-nodejs-image=${{ inputs.patch-image-arn }}" else . end)' | \ + kubectl apply -f - + kubectl delete pods --all -n amazon-cloudwatch sleep 10 kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch