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

Container action is only supported on Linux #40

Closed
rogchap opened this issue Sep 22, 2019 · 18 comments
Closed

Container action is only supported on Linux #40

rogchap opened this issue Sep 22, 2019 · 18 comments

Comments

@rogchap
Copy link

rogchap commented Sep 22, 2019

This action only works on linux due to it using a docker container.
Would be good if this action could work for Mac OSX and Windows too, but I guess this would mean moving away from a docker implementation.
At very least (although does not work for me) call this out in the README that only Linux is supported.

@peter-evans
Copy link
Owner

Thank you for raising this. I wasn't aware that it doesn't work on Mac OSX and Windows. I will look into this and see if it's feasible to make it multi-platform.

@rogchap
Copy link
Author

rogchap commented Sep 23, 2019

Thanks @peter-evans
I hope you don't mind, but I took your python script to call this manually for now.
One small change i made that may be particular to my case: is because I'm building for multiple platforms, I want to raise multiple PRs (or all in one PR) and due to the branch names being based on the hash I get a conflict.
Your check for the branch is in origin already pr_branch_exists will always return false because these jobs are run in parallel and without calling git fetch first the new branch will never be in the remotes.origin.refs
So I changed this to use a timestamp instead 🤷‍♂
You can see my implementation here if it helps:
https://github.com/rogchap/v8go/blob/master/.github/workflows/v8build.yml

PS. thanks for a great Action

@peter-evans
Copy link
Owner

peter-evans commented Sep 24, 2019

Confirmed that, currently, container actions only work on Linux virtual environments. The only way to make Mac OSX and Windows actions right now is a new Javascript actions format that was introduced with Actions v2.
https://help.github.com/en/articles/about-actions#types-of-actions

The options currently are very limited and Actions are still not GA yet, so I imagine that there are more features coming to support other platforms. This action can be made usable very easily if either:

I will reach out to GitHub support and try and find out what direction they are likely to take in the near future.

By the way, I should point out that the majority of the actions currently on the Marketplace are container based actions because they were written during the Actions v1 beta when that was the only option. So none of those will work on Mac OSX and Windows either.

Update: I've discovered a way to make this action work on all three platforms without needing to rewrite it completely. Working on a test release.

@peter-evans
Copy link
Owner

peter-evans commented Sep 25, 2019

I've released a beta version of the multi-platform action. Please test it out.

    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v1.3.1-multi
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@rogchap I've added an extra parameter BRANCH_SUFFIX that if set to timestamp will use timestamps to suffix the branch names instead of the short SHA1 hash. (By the way, during testing I still got an unlucky clash when using timestamps, so I might add a further option to randomise a suffix)

I'm not sure what direction GitHub are going to take in the future to support multi-platform actions. I will probably leave the original action and multi platform action implementations separate until it becomes clear.

@rogchap
Copy link
Author

rogchap commented Sep 25, 2019

Thanks for jumping on this so fast @peter-evans I will give the update a try and provide feedback. thanks again.

@peter-evans
Copy link
Owner

@rogchap I'm going to close this issue for now. If you have any problems with the -multi versions of this action please create a new issue. Thanks!

@rogchap
Copy link
Author

rogchap commented Oct 5, 2019

No worries @peter-evens; I haven’t had a chance to test yet; but will.

@AraHaan
Copy link

AraHaan commented Jan 22, 2021

@peter-evans how exactly did you make this work? I made an action myself 2 days ago using an old v1 action as a guide to add more features to it and would like to fix this same issue.

@peter-evans
Copy link
Owner

Hi @AraHaan

I made an action myself 2 days ago using an old v1 action as a guide

Is it a container-based action? If so, you still can't use container-based actions cross-platform. They only work on linux VMs. The only solution that I know of is to convert the action to Javascript.

@AraHaan
Copy link

AraHaan commented Jan 22, 2021

Welp that would be hard as it is in using this code atm https://github.com/Elskom/merge-dependabot/blob/main/entrypoint.sh
I changed a few lines of some other action to basically do what I wanted it to do.

I did try on my project having it use linux however .NET Core does not like building a project that imports the WindowsDesktop SDK on linux. 💯

@peter-evans
Copy link
Owner

If a complete rewrite to Javascript/Typescript is not feasible, the only other suggestion I have is to make a Javascript wrapper action which executes whatever tooling you need to run. For an example of what I mean, see python-action, which is a wrapper around executing Python in a cross-platform way. That's how I originally made this action work cross-platform, but eventually I just rewrote it from scratch.

@AraHaan
Copy link

AraHaan commented Jan 22, 2021

So basically to make an ruby-action I would have to convert the code under https://github.com/actions/setup-ruby for it and tell it to use that instead of python 👌

@AraHaan
Copy link

AraHaan commented Jan 23, 2021

@peter-evans so what do I do to make the setup-ruby into an single js file?

@peter-evans
Copy link
Owner

Multiple versions of Ruby are available in the GitHub Actions tool-cache. So all setup-ruby does is find the path in the cache to the version of Ruby that the user has requested.

These two lines are finding the version in the cache and building the correct path to the binary. If you run these when your action starts you should have a path to the Ruby binary that you can call to execute your script.
https://github.com/actions/setup-ruby/blob/main/src/cache.ts#L6-L8

@simondelphia
Copy link

simondelphia commented Apr 7, 2022

It the version identifier still 1.3.1-multi?
Still get the error about Linux after switching.

Download action repository 'peter-evans/create-pull-request@v1.3.1-multi' (SHA:0fe13446aa550b789d50dc39ea9e8e7067e1ed67)
Container action is only supported on Linux, skip pull and build docker images.

@AraHaan
Copy link

AraHaan commented Apr 7, 2022

@peter-evans it is possible to have javascript bootstrap the python code to the action itself and act as an proxy (I would totally do that if I plan to eventually write my github action in .NET).

@peter-evans
Copy link
Owner

@simondelphia This is an old issue and 1.3.1-multi is a very old version of the action! I rewrote the action in Typescript and now all versions >2 are multi platform. Please use the latest version of this action.

@simondelphia
Copy link

simondelphia commented Apr 8, 2022

Seems then the reason why I was getting this error was actually because of swift-package-dependencies-check which I was trying to use together with this one. I assumed this PR action was the reason for the error but when I removed the pull request step I still got the same error. The logs made it unclear which one was causing the problem before that.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants