Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support #5

Open
Marv51 opened this issue Sep 1, 2022 · 2 comments
Open

Windows support #5

Marv51 opened this issue Sep 1, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Marv51
Copy link

Marv51 commented Sep 1, 2022

I tried to run the s3cmd action on Windows in the GitHub Action windows-2022 environment.

This seems unsupported right now.

It would be cool to add support, or if that is not possible, maybe the error message could be improved?

Current error message:

The system cannot find the path specified.
child_process.js:674
    throw err;
    ^

Error: Command failed: /bin/bash -c 'pip3 install s3cmd --no-cache'
The system cannot find the path specified.
@bluebrown
Copy link
Contributor

bluebrown commented Sep 1, 2022

Good point. I had this always in the back of my head and wanted to add it to the readme, but never did for some reason.

The reason why windows is not supported is that we can run it without docker on Linux machines. Perhaps it could be done on Windows as well, but I am not sure if python is pre-installed there.

If you want to experiment with installing s3cmd on a windows machine based on the current platform, it would make a nice pull request.

Otherwise, we could think about using docker but I kind of dislike the idea because it makes the build more slow.

@bluebrown bluebrown added the enhancement New feature or request label Sep 1, 2022
@Marv51
Copy link
Author

Marv51 commented Sep 2, 2022

I can't get s3cmd to properly work in my Github Action on Windows. Locally it is quite straight forward, but for whatever reason it just does not work on GitHub Actions. (I have moved on to the official AWS SDK which comes preinstalled)

This is what I found:

plain pip install s3cmd seems to work on Windows.
Also I believe the settings file should be in "$env:APPDATA\s3cmd.ini".

- name: Install S3cmd
        run: |
          pip install s3cmd
          New-Item "$env:APPDATA\s3cmd.ini"
          Set-Content "$env:APPDATA\s3cmd.ini" '[default]'
          Add-Content "$env:APPDATA\s3cmd.ini" "access_key = ${{ secrets.DEPLOY_ACCESSKEY }}"
          [...]

However, the pip packages are not properly added to the PATH by default. And even if you add it to the path, powershell can't execute the "s3cmd" file with python automatically.

So instead I used:

$s3location = $(python -c 'import os,sysconfig;print(sysconfig.get_path(\"scripts\",f\"{os.name}_user\"))')
$s3cmd = $s3location + "/s3cmd"
python $s3cmd ls

for whatever reason, with that my github action just keeps running with that and never terminates.
There is no output, or debug output. Locally that also works fine.

Hey, I know that is not a great contribution "I tried a bunch of things and I couldn't get it to work" but maybe this helps someone skip a bunch of steps and start straight where I gave up.

Edit: I did not use the action in this repo for any of this. Obviously writing the settings file with the action would be way nicer, but for now on Windows, I just manually do the work in Powershell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants