[GH-ISSUE #1022] Issue: parse all container/services options #597

Open
opened 2026-03-01 21:44:49 +03:00 by kerem · 7 comments
Owner

Originally created by @catthehacker on GitHub (Mar 1, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1022

on: push

jobs:
  docker-container:
    runs-on: ubuntu-latest
    container:
      image: alpine
      options: --it --rm
    steps:
      - uses: actions/checkout@v2
Originally created by @catthehacker on GitHub (Mar 1, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1022 ``` on: push jobs: docker-container: runs-on: ubuntu-latest container: image: alpine options: --it --rm steps: - uses: actions/checkout@v2 ```
Author
Owner

@bhaveshprajapat commented on GitHub (Oct 3, 2022):

bump

<!-- gh-comment-id:1265649679 --> @bhaveshprajapat commented on GitHub (Oct 3, 2022): bump
Author
Owner

@KnisterPeter commented on GitHub (Oct 3, 2022):

@bhaveshprajapat Feel free to create a pull request 😉

<!-- gh-comment-id:1265651323 --> @KnisterPeter commented on GitHub (Oct 3, 2022): @bhaveshprajapat Feel free to create a pull request 😉
Author
Owner

@KnisterPeter commented on GitHub (Oct 7, 2022):

@cplee @alex-savchuk This change contains a major issue. The workflow below does not return the hostname of the host but some other invalid fqdn.
I'm not sure why this happens, but it is a side-effect of this PR. Reverting it does restore the previous behavior.

name: test
on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: hostname -f
<!-- gh-comment-id:1271268952 --> @KnisterPeter commented on GitHub (Oct 7, 2022): @cplee @alex-savchuk This change contains a major issue. The workflow below does not return the hostname of the host but some other invalid fqdn. I'm not sure why this happens, but it is a side-effect of this PR. Reverting it does restore the previous behavior. ```yaml name: test on: push jobs: test: runs-on: ubuntu-latest steps: - run: hostname -f ```
Author
Owner

@KnisterPeter commented on GitHub (Oct 7, 2022):

According to the docs, if no container is set, the job should run on the host.
This was imitated with act until this fix was applied.
We should restore the default behavior unless there is a container definition on a job.

<!-- gh-comment-id:1271321358 --> @KnisterPeter commented on GitHub (Oct 7, 2022): According to the [docs](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontainer), if no container is set, the job should run on the host. This was imitated with act until this fix was applied. We should restore the default behavior unless there is a `container` definition on a job.
Author
Owner

@alex-savchuk commented on GitHub (Oct 7, 2022):

Checking it.

<!-- gh-comment-id:1271597637 --> @alex-savchuk commented on GitHub (Oct 7, 2022): Checking it.
Author
Owner

@alex-savchuk commented on GitHub (Oct 7, 2022):

@KnisterPeter
Could you please provide output for previous output of hostname -f and new one?
I checked and see "docker-desktop" for both cases :(

<!-- gh-comment-id:1271622283 --> @alex-savchuk commented on GitHub (Oct 7, 2022): @KnisterPeter Could you please provide output for previous output of ```hostname -f``` and new one? I checked and see "docker-desktop" for both cases :(
Author
Owner

@KnisterPeter commented on GitHub (Oct 10, 2022):

The 'previous' output was the output of the host machine as act was used to start the docker container in network mode host. Now with your fix it is started with the default network mode.
As you are parsing an empty string into docker options (using the cli tool) the output are all the docker defaults. Then you merge that into (and over) the act defaults.
I've already build a fix for this: https://github.com/nektos/act/pull/1375

Please test if your change did not break with that. 😃

<!-- gh-comment-id:1272872989 --> @KnisterPeter commented on GitHub (Oct 10, 2022): The 'previous' output was the output of the host machine as act was used to start the docker container in network mode `host`. Now with your fix it is started with the default network mode. As you are parsing an empty string into docker options (using the cli tool) the output are all the docker defaults. Then you merge that into (and over) the act defaults. I've already build a fix for this: https://github.com/nektos/act/pull/1375 Please test if your change did not break with that. :smiley:
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
starred/act#597
No description provided.