Not support uses an action in the root directory #512

Closed
opened 2024-03-11 07:53:53 +00:00 by PittyXu · 10 comments

The config like this is not work:

on: [push]

jobs:
  hello_world_job:
    runs-on: ubuntu-latest
    name: a
    steps:
      - name: Hello world action step
        uses: ./ # Uses an action in the root directory
        with:
          who-to-greet: 'Mona the Octocat'

https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#example-using-a-private-action

The config like this is not work: ```yaml on: [push] jobs: hello_world_job: runs-on: ubuntu-latest name: a steps: - name: Hello world action step uses: ./ # Uses an action in the root directory with: who-to-greet: 'Mona the Octocat' ``` `https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#example-using-a-private-action`
Member

Did you checkout the repository?

      # To use this repository's private action,
      # you must check out the repository
      - name: Checkout
        uses: actions/checkout@v4
Did you checkout the repository? ``` # To use this repository's private action, # you must check out the repository - name: Checkout uses: actions/checkout@v4 ```
Author

@Zettat123 Yes, the sample code has been streamlined.

There is an error:

file does not exist
skipping post step for 'xxx': no action model available
@Zettat123 Yes, the sample code has been streamlined. There is an error: ``` file does not exist skipping post step for 'xxx': no action model available ```
Member

This is weird. I tested the sample code and found it works as expected. Is your workflow file different from the sample code?

on: [push]

jobs:
  hello_world_job:
    runs-on: ubuntu-latest
    name: A job to say hello
    steps:
      # To use this repository's private action,
      # you must check out the repository
      - name: Checkout
        uses: actions/checkout@v4
      - name: Hello world action step
        uses: ./ # Uses an action in the root directory
        id: hello
        with:
          who-to-greet: 'Mona the Octocat'
      # Use the output from the `hello` step
      - name: Get the output time
        run: echo "The time was ${{ steps.hello.outputs.time }}"
This is weird. I tested the sample code and found it works as expected. Is your workflow file different from the sample code? ```yaml on: [push] jobs: hello_world_job: runs-on: ubuntu-latest name: A job to say hello steps: # To use this repository's private action, # you must check out the repository - name: Checkout uses: actions/checkout@v4 - name: Hello world action step uses: ./ # Uses an action in the root directory id: hello with: who-to-greet: 'Mona the Octocat' # Use the output from the `hello` step - name: Get the output time run: echo "The time was ${{ steps.hello.outputs.time }}" ```
Zettat123 added the
kind
bug
label 2024-03-11 09:55:17 +00:00
Author

@Zettat123 My Runner version is 0.2.6, gitea version is 1.21.7

The code is like the github page:
action.yml

name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
  who-to-greet:  # id of input
    description: 'Who to greet'
    required: true
    default: 'World'
outputs:
  time: # id of output
    description: 'The time we greeted you'
runs:
  using: 'node20'
  main: 'dist/index.js'

gitea.yml

on: [push]

jobs:
  hello_world_job:
    runs-on: ubuntu-latest
    name: A job to say hello
    steps:
      # To use this repository's private action,
      # you must check out the repository
      - name: Checkout
        uses: actions/checkout@v4
      - name: Hello world action step
        uses: ./ # Uses an action in the root directory
        id: hello
        with:
          who-to-greet: 'Mona the Octocat'
      # Use the output from the `hello` step
      - name: Get the output time
        run: echo "The time was ${{ steps.hello.outputs.time }}"

action's index.js
image
The error:
image

@Zettat123 My Runner version is 0.2.6, gitea version is 1.21.7 The code is like the github page: `action.yml` ```yml name: 'Hello World' description: 'Greet someone and record the time' inputs: who-to-greet: # id of input description: 'Who to greet' required: true default: 'World' outputs: time: # id of output description: 'The time we greeted you' runs: using: 'node20' main: 'dist/index.js' ``` gitea.yml ```yml on: [push] jobs: hello_world_job: runs-on: ubuntu-latest name: A job to say hello steps: # To use this repository's private action, # you must check out the repository - name: Checkout uses: actions/checkout@v4 - name: Hello world action step uses: ./ # Uses an action in the root directory id: hello with: who-to-greet: 'Mona the Octocat' # Use the output from the `hello` step - name: Get the output time run: echo "The time was ${{ steps.hello.outputs.time }}" ``` action's `index.js` ![image](/attachments/206e4ee6-c4a8-496c-ab77-0dd27f51eba5) The error: ![image](/attachments/c22a5a10-6606-4fb0-9af5-fa183a4235c6)
174 KiB
552 KiB
Member

I didn't find anything incorrect in these files.
Could you add - run: ls -al to the workflow file to check if action.yml exists?

The action should work if action.yml exists

I didn't find anything incorrect in these files. Could you add `- run: ls -al` to the workflow file to check if `action.yml` exists? <img width="600px" src="/attachments/8002b854-61f0-4c0b-978d-46cf4782da26" /> The action should work if `action.yml` exists
Member

@PittyXu Can you find text like file does not exist in your act_runner's logs? Or can you provide the full log of act_runner if possible?

@PittyXu Can you find text like `file does not exist` in your act_runner's logs? Or can you provide the full log of act_runner if possible?
Member

Sorry I didn't make it clear. Looks like the logs you provided are from the UI. Since not all logs from act_runner are displayed on the UI, some information may be missed.

Could you provide the logs that the act_runner printed to the console? (Before you post the logs, you can remove the sensitive information)

Sorry I didn't make it clear. Looks like the logs you provided are from the UI. Since not all logs from act_runner are displayed on the UI, some information may be missed. Could you provide the logs that the act_runner printed to the console? (Before you post the logs, you can remove the sensitive information)
Member

I tested the ls -Ral /var/run/act command and found the result was similar to yours. Since I didn't encounter any error, I think it's not because Extracting content to '/var/run/act'.

I noticed the file does not exist error in your logs. This means that act_runner may get some errors when it reads the action.yml file from the job container.

It should come from

localReader := func(ctx context.Context) actionYamlReader {
_, cpath := getContainerActionPaths(sal.Step, path.Join(actionDir, ""), sal.RunContext)
return func(filename string) (io.Reader, io.Closer, error) {
tars, err := sal.RunContext.JobContainer.GetContainerArchive(ctx, path.Join(cpath, filename))
if err != nil {
return nil, nil, os.ErrNotExist
}
treader := tar.NewReader(tars)
if _, err := treader.Next(); err != nil {
return nil, nil, os.ErrNotExist
}
return treader, tars, nil
}
}
.

The code above is not good because it always return os.ErrNotExist and does not return the real error. Could you try the nightly act_runner and check if the file does not exist error still exists?

I tested the `ls -Ral /var/run/act` command and found the result was similar to yours. Since I didn't encounter any error, I think it's not because `Extracting content to '/var/run/act'`. I noticed the `file does not exist` error in your logs. This means that act_runner may get some errors when it reads the `action.yml` file from the job container. <img src="/attachments/74d35467-9392-4b2d-8c12-ff889005a9bd" width="480px" /> It should come from https://gitea.com/gitea/act/src/commit/4699c3b689cb6711f2de1b8a402683e1b8ea8150/pkg/runner/step_action_local.go#L42-L55 . The code above is not good because it always return `os.ErrNotExist` and does not return the real error. Could you try the [nightly act_runner](https://dl.gitea.com/act_runner/nightly/) and check if the `file does not exist` error still exists?
Author

@Zettat123
I found out why this problem was in, I started the runner and using a config file. If container.workdir_parent is set in the config file, it will cause this failure.

config.yaml

....
container:
  # The parent directory of a job's working directory.
  # If it's empty, /workspace will be used.
  workdir_parent: /workspace
....
@Zettat123 I found out why this problem was in, I started the runner and using a config file. If `container.workdir_parent` is set in the config file, it will cause this failure. `config.yaml` ```yaml .... container: # The parent directory of a job's working directory. # If it's empty, /workspace will be used. workdir_parent: /workspace .... ```
Member

Thank you for digging into this issue. I'll take a look at this configuration later

Thank you for digging into this issue. I'll take a look at this configuration later
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/act_runner#512
No description provided.