Ownership changing problem in deployment

For the last step of my deployment, I am having errors related to changing ownership in my folder. I have created a separate job named deploy and created workflows. The deploy job uses the following docker images.

working_directory: ~/Backpack-Technologies/backpack-api
parallelism: 1
shell: /bin/bash --login
  - image: google/cloud-sdk

I have used setup_remote_docker for making docker calls in the container because our steps have some docker command there. Running the following commands:

  - run: apt-get -y install sudo
  - run: sudo apt-get update && sudo apt-get --only-upgrade install kubectl google-cloud-sdk google-cloud-sdk-app-engine-grpc google-cloud-sdk-pubsub-emulator google-cloud-sdk-app-engine-go google-cloud-sdk-cloud-build-local google-cloud-sdk-datastore-emulator google-cloud-sdk-app-engine-python google-cloud-sdk-cbt google-cloud-sdk-bigtable-emulator google-cloud-sdk-app-engine-python-extras google-cloud-sdk-datalab google-cloud-sdk-app-engine-java coreutils
  - run: echo $ACCT_AUTH | base64 --decode > ${HOME}//gcloud-service-key.json
  - run: gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
  - run: gcloud config set project $PROJECT_ID
  - run: gcloud config set compute/zone ${CLOUDSDK_COMPUTE_ZONE}
  - run: gcloud --quiet container clusters get-credentials $CLUSTER_NAME
  - run: gcloud debug source gen-repo-info-file
  - run: docker build -t asia.gcr.io/${PROJECT_ID}/staging-backpack-api:$CIRCLE_SHA1 .
  - run: docker tag asia.gcr.io/${PROJECT_ID}/staging-backpack-api:$CIRCLE_SHA1 asia.gcr.io/${PROJECT_ID}/staging-backpack-api:latest
  - run: gcloud docker -- push asia.gcr.io/${PROJECT_ID}/staging-backpack-api
  - run: sudo chown -R ubuntu:ubuntu /home/ubuntu/.kube
  - run: sudo chown -R ubuntu:ubuntu /home/ubuntu/.config/gcloud
  - run: kubectl patch deployment staging-backpack-api -p '{"spec":{"template":{"spec":{"containers":[{"name":"staging-backpack-api","image":"asia.gcr.io/backpack-782cb/staging-backpack-api:'"$CIRCLE_SHA1"'"}]}}}}'

Every step for until the chown got executed. On chown I am having this error:

#!/bin/bash --login
sudo chown -R ubuntu:ubuntu /home/ubuntu/.kube
chown: invalid user: 'ubuntu:ubuntu'
Exited with code 1

Is this because of using the google-cloud image I have used? What would be the possible course of action?

Thanks in advance!

I figured out the answer. Because I haven’t used any sudo for gcloud commands before. So the /home/ubuntu/.kube doesn’t need to be changed to work.

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