dahlia / submark

Extract a part from CommonMark/Markdown docs
https://hackage.haskell.org/package/submark
GNU General Public License v3.0
6 stars 1 forks source link

Action can not find setup action in self-hosted runners #7

Closed kuhnroyal closed 3 months ago

kuhnroyal commented 2 years ago

When trying to use dahlia/submark on a self-hosted runner, it fails to find the dahlia/submark/setup action:

Error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/path/to/runner/_work/my-project/my-project/setup'. Did you forget to run actions/checkout before running your local action?

This happens on Linux and MacOS. Something with the path seems off, I will try to get some debug logging.

Can I run dahlia/submark/setup manually beforehand, will the main action detect that it is already configured?

kuhnroyal commented 2 years ago

Runner debug log shows a different location:

Download action repository 'dahlia/submark@7d44d75a4dcfd351258491f26898e836b0521ce0' (SHA:7d44d75a4dcfd351258491f26898e836b0521ce0)
##[debug]Download 'https://api.github.com/repos/dahlia/submark/tarball/7d44d75a4dcfd351258491f26898e836b0521ce0' to '/path/to/runner/_work/_actions/_temp_41868f75-c368-4ff6-b927-d5b93b71a9f6/5311a86e-d87f-49bc-953b-4ac3d910f7f8.tar.gz'
##[debug]Unwrap 'dahlia-submark-7d44d75' to '/path/to/runner/_work/_actions/dahlia/submark/7d44d75a4dcfd351258491f26898e836b0521ce0'
##[debug]Archive '/path/to/runner/_work/_actions/_temp_41868f75-c368-4ff6-b927-d5b93b71a9f6/5311a86e-d87f-49bc-953b-4ac3d910f7f8.tar.gz' has been unzipped into '/path/to/runner/_work/_actions/dahlia/submark/7d44d75a4dcfd351258491f26898e836b0521ce0'.
##[debug]Action 'dahlia/submark@7d44d75a4dcfd351258491f26898e836b0521ce0' already downloaded at '/path/to/runner/_work/_actions/dahlia/submark/7d44d75a4dcfd351258491f26898e836b0521ce0'.
kuhnroyal commented 2 years ago

Maybe this will help: https://stackoverflow.com/a/66643346/2553215

Using ${{github.action_path}}/setup/ here: https://github.com/dahlia/submark/blob/main/action.yaml#L57

kuhnroyal commented 2 years ago

Sadly a dynamic uses: is not supported...

dahlia commented 2 years ago

@kuhnroyal Have you ever found any workaround?

kuhnroyal commented 2 years ago

Sadly not, so far

kuhnroyal commented 2 years ago

Probably something like extracting setup into a script and calling it from both actions. I am wondering why it would work on Github hosted runners with this.

kuhnroyal commented 2 years ago

Ok, this doesn't work at all: see https://github.com/kuhnroyal/submark_test/runs/6672494094?check_suite_focus=true

kuhnroyal commented 2 years ago

This only works inside the submark repository.

kuhnroyal commented 2 years ago

After working around this by removing the setup part and manually running dahlia/submark/setup beforehand, I get another error. Not sure if this is related to private runners.

Run kuhnroyal/submark@081418786c64195fd80ef7bf8253d47d7292ce69
Run from __future__ import print_function
Traceback (most recent call last):
  File "/path/to/runner/_work/_temp/aa8be0ca-d542-467b-8aab-8844d2a83698.py", line 87, in <module>
    exit_code = subprocess.call(args, stderr=stderr)
  File "/path/to/runner/_work/_tool/Python/3.10.4/x64/lib/python3.10/subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/path/to/runner/_work/_tool/Python/3.10.4/x64/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/path/to/runner/_work/_tool/Python/3.10.4/x64/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: ''
Error: Process completed with exit code 1.
dahlia commented 2 years ago

Recently I also experienced the same issue… it might be fixed if I change the following line to uses: dahlia/submark/setup 🤔:

https://github.com/dahlia/submark/blob/ff45d9f552483bdf2f740a60168af6878eddad3c/action.yaml#L57

dahlia commented 2 years ago

@kuhnroyal Could you try with uses: dahlia/submark@bugfix/7? I removed bugfix/7 branch and instead it's now merged to the main branch.

vscheuber commented 2 years ago

@dahlia I have been experiencing that issue using github hosted runners. I changed my action to use:

uses: dahlia/submark@bugfix/7

And that solved the issue for me in github hosted runners. Would love to see this branch merged so I know my pipeline won't break going forward.

dahlia commented 2 years ago

@vscheuber Thanks for your feedback! I just merged the fix.

However, I'm going to keep this issue open, because I haven't tested it with self-hosted runners. Please anybody who tested it with self-hosted runners tell me if it actually works or not.

vscheuber commented 2 years ago

Fantastic! Thank you @dahlia . I have switched my pipeline to use @main and will let you know if I hit any further problems.

kuhnroyal commented 2 years ago

I currently do not have a pipeline with this on a self-hosted runner anymore. From a security perspective I don't like the usage of the main branch there but also do not have a better idea.

dahlia commented 2 years ago

From a security perspective I don't like the usage of the main branch there but also do not have a better idea.

I agree and am going to make a new tag if this fix is proved to work well on self-hosted runners.

maelchiotti commented 3 months ago

Hi @dahlia. I have this issue on GitHub hosted runners. It's fixed however if I use the main branch. I don't have a self-hosted runner to test this on, but maybe a new release should be published with the fix, while keeping the issue open? This way I wouldn't have to use the main branch.

dahlia commented 3 months ago

It's already fixed, but I forgot to close this issue. You can now use the main branch.

maelchiotti commented 3 months ago

Yes I do use the main branch, but shouldn't this be included in a release then?