Modified yaml files are not been used by kubernetes/create-or-update-resource orb during AWS EKS deploy

hi there

I’m using kubernetes/create-or-update-resource orb to deploy my statefulset to AWS EKS. The all deployment worked fine until I added an extra step to manually update my image tag inside my .yaml file using “sed” to the desired tag id.

My original file charts/neo4j-graphql-v3.yaml

# GRAPHQL SERVER
  - name: graphql-server
    image: xxxxxxxxxxx.dkr.ecr.ap-southeast-2.amazonaws.com/enigma-graphql:<IMAGE_TAG>

My config.yml

- run:
        name: "PREPARE FILES"
        command: |
          # UPDATE IMAGE TYPE
          sed -i "s/<IMAGE_TAG>/${CIRCLE_TAG}-b$CIRCLE_BUILD_NUM/g" charts/neo4j-graphql-v3.yaml
          cat charts/neo4j-graphql-v3.yaml. #just to confirm file is writen properly

- kubernetes/create-or-update-resource:
        get-rollout-status: true
        resource-file-path: charts/neo4j-graphql-v3.yaml
        resource-name: sts/neo4j-graphql-v3

I would expect orb to use my new modified file charts/neo4j-graphql-v3.yaml, but instead, it uses the original file that was checkout from repository and the deploy failes as there is no tag called <IMAGE_TAG>.

Thanks

Hi @awsassembly, would you be able to share a link to your CircleCI job so that I can take a further look?

hi Stella, thanks for replying. Here is one of my attempts using “git add/commit” to see if the file would get staged, but that didn’t work it as well. https://circleci.com/gh/tourismmedia/enigma-graphql-js/63

@awsassembly Thanks for sharing the link! It looks like there are 2 checkout steps in the job and one of them takes place after the yaml file has been modified. I think that could be the reason that the modification was not effective. Could you try removing the 2nd checkout step?

1 Like

Hi Stella, you were just right on spot, I missed that extra checkout while copying/pasting code around. Thanks for helping. Very much appreciated.

Hi Stella

In fact, the extra checkout was coming from the command. “- aws-eks/update-kubeconfig-with-authenticator:” I don’t see “extra” checkouts in other orb commands, is this expected?

Complementing, if I remove my manual checkout the extra one doesn’t run.

Job with both checkout
https://circleci.com/gh/tourismmedia/enigma-graphql-js/86

Job without a checkout
https://circleci.com/gh/tourismmedia/enigma-graphql-js/87

Thanks

Hi Stella

Complementing my msg, in fact its not “- aws-eks/update-kubeconfig-with-authenticator:” that triggers checkout, but it always trigger after I run by “prepare files” run command. I’m not sure what is going on

https://circleci.com/gh/tourismmedia/enigma-graphql-js/88

@awsassembly I believe the 2nd checkout step is caused by running aws-ecr/build-and-push-image: https://circleci.com/orbs/registry/orb/circleci/aws-ecr#commands-build-and-push-image Could you add a checkout: false parameter to the command?

1 Like

All good now Stela, problem was the ECR orb checking out code, the command “checkout: false” resolved the issue now for good. Thanks again for your prompt response. :+1:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.