Consensys / kubernetes-action

GitHub Action to run kubectl
37 stars 62 forks source link

Action fails because incompatible python version for awscli #12

Open MarkPare opened 1 year ago

MarkPare commented 1 year ago

Currently I'm seeing this action fail with an error (see logs below).

I believe problem comes from this recent change in awscli package that removes support for python 2.7.

Wondering if/when issue will be corrected here. This is blocking my deployments so I need a fix asap.

Step 4/8 : RUN pip install awscli
   ---> Running in 516ceb5c09b9
  Collecting awscli
    Downloading https://files.pythonhosted.org/packages/aa/24/e098cf5ce28a764bca174e88f4ccb70754e9f049c9bf986e582aedcb7420/awscli-1.19.112-py2.py3-none-any.whl (3.6MB)
  Collecting botocore==1.20.112 (from awscli)
    Downloading https://files.pythonhosted.org/packages/c7/ea/11c3beca131920f552602b98d7ba9fc5b46bee6a59cbd48a95a85cbb8f41/botocore-1.20.112-py2.py3-none-any.whl (7.7MB)
  Collecting s3transfer<0.5.0,>=0.4.0 (from awscli)
    Downloading https://files.pythonhosted.org/packages/63/d0/693477c688348654ddc21dcdce0817653a294aa[43](https://github.com/tryhungry/hungry-services/actions/runs/5578112763/jobs/10191862056#step:3:43)f41771084c25e7ff9c7/s3transfer-0.4.2-py2.py3-none-any.whl (79kB)
  Collecting colorama<0.4.4,>=0.2.5 (from awscli)
    Downloading https://files.pythonhosted.org/packages/c9/dc/[45](https://github.com/tryhungry/hungry-services/actions/runs/5578112763/jobs/10191862056#step:3:45)cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
  Collecting PyYAML<5.5,>=3.10 (from awscli)
    Downloading https://files.pythonhosted.org/packages/a0/a4/d63f2d7597e1a4b55aa3b4d6c5b029991d3b824b5bd331af8d4ab1ed687d/PyYAML-5.4.1.tar.gz (175kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
      Complete output from command python setup.py egg_info:
      running egg_info
      creating pip-egg-info/PyYAML.egg-info
      writing pip-egg-info/PyYAML.egg-info/PKG-INFO
      writing top-level names to pip-egg-info/PyYAML.egg-info/top_level.txt
      writing dependency_links to pip-egg-info/PyYAML.egg-info/dependency_links.txt
      writing manifest file 'pip-egg-info/PyYAML.egg-info/SOURCES.txt'
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/tmp/pip-install-n212Qs/PyYAML/setup.py", line 295, in <module>
          python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*',
        File "/tmp/pip-build-env-_dpnrk/lib/python2.7/site-packages/setuptools/__init__.py", line 162, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python2.7/distutils/core.py", line 1[51](https://github.com/tryhungry/hungry-services/actions/runs/5578112763/jobs/10191862056#step:3:51), in setup
          dist.run_commands()
        File "/usr/lib/python2.7/distutils/dist.py", line 9[53](https://github.com/tryhungry/hungry-services/actions/runs/5578112763/jobs/10191862056#step:3:53), in run_commands
          self.run_command(cmd)
        File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-_dpnrk/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
          self.find_sources()
        File "/tmp/pip-build-env-_dpnrk/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
          mm.run()
        File "/tmp/pip-build-env-_dpnrk/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
          self.add_defaults()
        File "/tmp/pip-build-env-_dpnrk/lib/python2.7/site-packages/setuptools/command/egg_info.py", line [57](https://github.com/tryhungry/hungry-services/actions/runs/5578112763/jobs/10191862056#step:3:57)0, in add_defaults
          sdist.add_defaults(self)
        File "/tmp/pip-build-env-_dpnrk/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
          self._add_defaults_ext()
        File "/tmp/pip-build-env-_dpnrk/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 120, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
        File "/tmp/pip-install-n212Qs/PyYAML/setup.py", line 201, in get_source_files
          self.cython_sources(ext.sources, ext)
        File "/usr/lib/python2.7/distutils/cmd.py", line 105, in __getattr__
          raise AttributeError, attr
      AttributeError: cython_sources
VictorMessina commented 1 year ago

Same issue here!! Do you have a time limit to fix the issue ?

allancarvalho commented 1 year ago

Same here

ivilla commented 1 year ago

Same here!

MarkPare commented 1 year ago

For anyone running into this issue and needing a fix asap, I had some issues when testing other kubectl github actions, but this works for AWS EKS:

curl -O https://s3.us-west-2.amazonaws.com/amazon-eks/1.24.13/2023-05-11/bin/linux/amd64/kubectl
chmod +x ./kubectl
kubectl version --short --client
echo ${{ secrets.KUBE_CONFIG_DATA }} | base64 --decode > kube_config.yaml
kubectl apply -f my-deployment.yaml --kubeconfig kube_config.yaml
nacholemmo commented 1 year ago

Same here

fno commented 1 year ago

i've forked the repo and removed the aws dependency as we were not using it.

if it's helpful for anybody NOT USING EKS you can find it here: https://github.com/marketplace/actions/kubernetes-kubectl-action-without-aws

davi020 commented 1 year ago

Hi @nacholemmo @ivilla @allancarvalho @VictorMessina @VictorMessina - Please try this and see if that works - https://github.com/marketplace/actions/kubernetes-action-with-python-2-x-fixes Tested and reported working in EKS.

fabian818 commented 1 year ago

Same Here

lomby commented 1 year ago

Same issue here but the fix from @davi020 has worked for us šŸ”„

nenadz-qsense commented 1 year ago

Hi @nacholemmo @ivilla @allancarvalho @VictorMessina @VictorMessina - Please try this and see if that works - https://github.com/marketplace/actions/kubernetes-action-with-python-2-x-fixes Tested and reported working in EKS.

HI, @davi020 , I have tried to user your version, it passed the previous error, but now I get error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

which, after googling a bit seems to be connected with kubectl version issues, any idea?

lomby commented 1 year ago

@nenadz-qsense I had the same issue at first. You'll need to update that line/value in your .kube/config file to this

client.authentication.k8s.io/v1beta1

Then base64 encode it again and update your secret. Worked perfectly for me after that šŸ‘ Probably worth updating any versions of aws cli/kubectl locally/elsewhere too for consistency (if they are supported by your Kubernetes version/s)

davi020 commented 1 year ago

Hi @nenadz-qsense - Hope you fixed your issue with the solution @lomby provided.

nenadz-qsense commented 1 year ago

It works.

Thanks both @lomby @davi020