kubectl icon indicating copy to clipboard operation
kubectl copied to clipboard

syntax error: unexpected redirection

Open rodriguesl3 opened this issue 5 years ago • 11 comments

I am getting errors to deploy an image to cluster. It is happening only when I am using v2.0

I changed my script and I did a rollback to use steebchen/kubectl@5be8a58b7a807d914496f20c0d4d1d9c1c240ccb version and it works correctly, maybe something is not right in v2.0 for kubectl 1.19 or I am doing something wrong

[email protected]

Run steebchen/[email protected] with: config: *** version: 1.19 command: set image --record deployment/website website=***.dkr.ecr.us-east-2.amazonaws.com/ssr:bc26f98b47e env: AWS_DEFAULT_REGION: us-east-2 AWS_REGION: us-east-2 AWS_ACCESS_KEY_ID: *** AWS_SECRET_ACCESS_KEY: *** /usr/bin/docker run --name a33c1c469a5a29fda48f8a379d8c36438ac58_d57f93 --label 8a33c1 --workdir /github/workspace --rm -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e INPUT_CONFIG -e INPUT_VERSION -e INPUT_COMMAND -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/website/website":"/github/workspace" 8a33c1:c469a5a29fda48f8a379d8c36438ac58 "1.19" "***" "set image --record deployment/website website=***.dkr.ecr.us-east-2.amazonaws.com/ssr:bc26f98b47e10c18552cde21cbb23abafef93760" using [email protected] /usr/local/bin/kubectl: line 1: syntax error: unexpected redirection

steebchen/kubectl@5be8a58b7a807d914496f20c0d4d1d9c1c240ccb

with: args: set image --record deployment/website website=***.dkr.ecr.us-east-2.amazonaws.com/ssr:bc26f98b47e env: AWS_DEFAULT_REGION: us-east-2 AWS_REGION: us-east-2 AWS_ACCESS_KEY_ID: *** AWS_SECRET_ACCESS_KEY: *** KUBE_CONFIG_DATA: *** /usr/bin/docker run --name a33c1a958b5ebc2da473e88c9bd5f63b7e954_5f2eae --label 8a33c1 --workdir /github/workspace --rm -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e KUBE_CONFIG_DATA -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/website/website":"/github/workspace" 8a33c1:a958b5ebc2da473e88c9bd5f63b7e954 set image --record deployment/website website=***.dkr.ecr.us-east-2.amazonaws.com/ssr:1fd7c547d79fcb6a5a549947d0c272ec6f7f293f deployment.apps/website image updated

rodriguesl3 avatar Jun 23 '21 16:06 rodriguesl3

Can you please share your GitHub Action yaml config, or at least the relevant parts? Thanks. If you use quotes for the command, can you try unquoting it?

steebchen avatar Jun 23 '21 18:06 steebchen

@steebchen Thanks for your time to try to help me. I tried unquoting and quoting what was unquoted and I got the same error

[email protected] /usr/local/bin/kubectl: line 1: syntax error: unexpected redirection

The step is failing it deploying to cluster

Here is the commands in github actions: ` deploy:

needs: build
name: deploy to cluster
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: connect in AWS
  uses: aws-actions/configure-aws-credentials@v1
  with:
    aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
    aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
    aws-region: us-east-2      
  
- name: Login to Amazon ECR
  id: login-ecr
  uses: aws-actions/amazon-ecr-login@v1
  
- name: deploying to cluster
  uses: steebchen/[email protected]
  with:
    config: ${{ secrets.KUBE_CONFIG_DATA }}
    version: "1.19"
    command: "set image --record deployment/website website=${{ steps.login-ecr.outputs.registry }}/ssr:${{ github.sha }}"
- name: verify deployment
  uses: steebchen/[email protected]
  with:
    config: ${{ secrets.KUBE_CONFIG_DATA }}
    version: "1.19"
    command: rollout status deployment/website

`

rodriguesl3 avatar Jun 26 '21 12:06 rodriguesl3

Thanks, I'll investigate soon

steebchen avatar Jun 26 '21 12:06 steebchen

Hm, I can't reproduce this. Can you try specifying a simple command like kubectl get pods, i.e.:

command: get pods

and let me know if this works or not? Thanks!

steebchen avatar Jun 26 '21 13:06 steebchen

same problem 😢 Here is the command was added:

- name: getting pods     
  uses: steebchen/[email protected]
  with:
    config: ${{ secrets.KUBE_CONFIG_DATA }}
    version: "1.19"
    command: get pods

Here is the result. image

rodriguesl3 avatar Jun 26 '21 19:06 rodriguesl3

I really don't know what could be wrong. You're using ubuntu-latest without a custom GitHub Actions runner, right? Can you maybe try removing all AWS related stuff and see if it continues to happen? I wouldn't know how to debug this as it works fine for me:

image

(it shows an error but you can see that it successfully reached the cluster).

steebchen avatar Jun 29 '21 08:06 steebchen

I have the same thing and I'm using 1.19 kubectl version too. Maybe something with using this exact version or with using any custom version?

vadimshvetsov avatar Jul 08 '21 19:07 vadimshvetsov

It works for me with or without a custom version, and it also works with 1.19...

steebchen avatar Jul 09 '21 06:07 steebchen

@vadimshvetsov @rodriguesl3 @steebchen If you are using v2.0.0 specify the kubectl version as v1.19.0 instead of 1.19 and it will work

pratik-parikh01 avatar Jul 22 '21 05:07 pratik-parikh01

@pratik-parikh01 Oh right, thanks for the tip. @vadimshvetsov and @rodriguesl3 can you please give that a shot?

steebchen avatar Jul 22 '21 07:07 steebchen

@pratik-parikh01 @steebchen thanks, with specifying kubectl version as v1.19.0 the problem has gone.

vadimshvetsov avatar Jul 25 '21 14:07 vadimshvetsov