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

Add support for service containers #1949

Merged
merged 33 commits into from
Oct 19, 2023

Commits on Aug 14, 2023

  1. Support services (nektos#42)

    Removed createSimpleContainerName and AutoRemove flag
    
    Co-authored-by: Lunny Xiao <[email protected]>
    Co-authored-by: Jason Song <[email protected]>
    Reviewed-on: https://gitea.com/gitea/act/pulls/42
    Reviewed-by: Jason Song <[email protected]>
    Co-authored-by: Zettat123 <[email protected]>
    Co-committed-by: Zettat123 <[email protected]>
    3 people authored and GuessWhoSamFoo committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    cbc838d View commit details
    Browse the repository at this point in the history
  2. Support services options (nektos#45)

    Reviewed-on: https://gitea.com/gitea/act/pulls/45
    Reviewed-by: Lunny Xiao <[email protected]>
    Co-authored-by: Zettat123 <[email protected]>
    Co-committed-by: Zettat123 <[email protected]>
    Zettat123 authored and GuessWhoSamFoo committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    5cc4bd0 View commit details
    Browse the repository at this point in the history
  3. Support intepolation for env of services (nektos#47)

    Reviewed-on: https://gitea.com/gitea/act/pulls/47
    Reviewed-by: Lunny Xiao <[email protected]>
    Co-authored-by: Zettat123 <[email protected]>
    Co-committed-by: Zettat123 <[email protected]>
    Zettat123 authored and GuessWhoSamFoo committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    ca623ce View commit details
    Browse the repository at this point in the history
  4. Support services credentials (nektos#51)

    If a service's image is from a container registry requires authentication, `act_runner` will need `credentials` to pull the image, see [documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idservicesservice_idcredentials).
    Currently, `act_runner` incorrectly uses the `credentials` of `containers` to pull services' images and the `credentials` of services won't be used, see the related code: https://gitea.com/gitea/act/src/commit/0c1f2edb996a87ee17dcf3cfa7259c04be02abd7/pkg/runner/run_context.go#L228-L269
    
    Co-authored-by: Jason Song <[email protected]>
    Reviewed-on: https://gitea.com/gitea/act/pulls/51
    Reviewed-by: Jason Song <[email protected]>
    Reviewed-by: Lunny Xiao <[email protected]>
    Co-authored-by: Zettat123 <[email protected]>
    Co-committed-by: Zettat123 <[email protected]>
    2 people authored and GuessWhoSamFoo committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    7a09a48 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    92f9cc7 View commit details
    Browse the repository at this point in the history
  6. Fix container network issue (nektos#56)

    Follow: https://gitea.com/gitea/act_runner/pulls/184
    Close https://gitea.com/gitea/act_runner/issues/177
    
    - `act` create new networks only if the value of `NeedCreateNetwork` is true, and remove these networks at last. `NeedCreateNetwork` is passed by `act_runner`. 'NeedCreateNetwork' is true only if  `container.network` in the configuration file of the `act_runner` is empty.
    - In the `docker create` phase, specify the network to which containers will connect. Because, if not specify , container will connect to `bridge` network which is created automatically by Docker.
      - If the network is user defined network ( the value of `container.network` is empty or `<custom-network>`.  Because, the network created by `act` is also user defined network.), will also specify alias by `--network-alias`. The alias of service is `<service-id>`. So we can be access service container by `<service-id>:<port>` in the steps of job.
    - Won't try to `docker network connect ` network after `docker start` any more.
      - Because on the one hand,  `docker network connect` applies only to user defined networks, if try to `docker network connect host <container-name>` will return error.
      - On the other hand, we just specify network in the stage of `docker create`, the same effect can be achieved.
    - Won't try to remove containers and networks berfore  the stage of `docker start`, because the name of these containers and netwoks won't be repeat.
    
    Co-authored-by: Jason Song <[email protected]>
    Reviewed-on: https://gitea.com/gitea/act/pulls/56
    Reviewed-by: Jason Song <[email protected]>
    Co-authored-by: sillyguodong <[email protected]>
    Co-committed-by: sillyguodong <[email protected]>
    2 people authored and GuessWhoSamFoo committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    bcfbd28 View commit details
    Browse the repository at this point in the history
  7. Check volumes (nektos#60)

    This PR adds a `ValidVolumes` config. Users can specify the volumes (including bind mounts) that can be mounted to containers by this config.
    
    Options related to volumes:
    - [jobs.<job_id>.container.volumes](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontainervolumes)
    - [jobs.<job_id>.services.<service_id>.volumes](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idservicesservice_idvolumes)
    
    In addition, volumes specified by `options` will also be checked.
    
    Currently, the following default volumes (see https://gitea.com/gitea/act/src/commit/a72822b3f83d3e68ffc697101b713b7badf57e2f/pkg/runner/run_context.go#L116-L166) will be added to `ValidVolumes`:
    - `act-toolcache`
    - `<container-name>` and `<container-name>-env`
    - `/var/run/docker.sock` (We need to add a new configuration to control whether the docker daemon can be mounted)
    
    Co-authored-by: Jason Song <[email protected]>
    Reviewed-on: https://gitea.com/gitea/act/pulls/60
    Reviewed-by: Jason Song <[email protected]>
    Co-authored-by: Zettat123 <[email protected]>
    Co-committed-by: Zettat123 <[email protected]>
    2 people authored and GuessWhoSamFoo committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    a168f8f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    78e4613 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2cfb56b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    973a5d8 View commit details
    Browse the repository at this point in the history
  11. Add docker stubs

    GuessWhoSamFoo committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    197d19d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    83c1304 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    fee22cd View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    b84f831 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    d0aad7f View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    3711e0d View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    7480591 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2023

  1. fix network duplication

    ChristopherHX committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    f3b7953 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e90c543 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    779ad2a View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2023

  1. Configuration menu
    Copy the full SHA
    1e8ce80 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0f0639c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5bad75c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5f5f3cf View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    10ab2db View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2023

  1. Configuration menu
    Copy the full SHA
    5ce86a6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ce9437f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ed086f2 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2023

  1. Always remove service containers

    Although we usually keep containers running if the workflow errored
    (unless `--rm` is given) in order to facilitate debugging and we have
    a flag (`--reuse`) to always keep containers running in order to speed
    up repeated `act` invocations, I believe that these should only apply
    to job containers and not service containers, because changing the
    network settings on a service container requires re-creating it anyway.
    ZauberNerd committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    8e5b4f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    092a41c View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2023

  1. Configuration menu
    Copy the full SHA
    41b68eb View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. Configuration menu
    Copy the full SHA
    0f701ec View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2023

  1. Configuration menu
    Copy the full SHA
    93089ed View commit details
    Browse the repository at this point in the history