Skip to content

Commit

Permalink
Merge pull request #32 from sonatype-nexus-community/ci_local_build_n…
Browse files Browse the repository at this point in the history
…otes_mac_docker_rancher

add notes to fix rancher desktop and act on mac
  • Loading branch information
madpah authored Oct 16, 2024
2 parents 9cd6f06 + d54f3b6 commit de19448
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/GITHUBACTIONS-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
GitHub Actions Notes
====================

Local Builds
---------------
See: [Running GitHub Actions Locally](https://contribute.sonatype.com/docs/how-to/testing-github-actions-locally/).
25 changes: 24 additions & 1 deletion content/en/docs/how-to/testing-github-actions-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@ Simply run:
```bash
act
```
### Rancher Desktop on Mac

If you are using Rancher Desktop on Mac, you may see errors like this:

```bash
% act -j build
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
[Continuous Integration/build] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Continuous Integration/build] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```
You can print out your Docker contexts with the following command:
```bash
% docker context ls
NAME DESCRIPTION DOCKER ENDPOINT ERROR
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock
rancher-desktop * Rancher Desktop moby context unix:///Users/bhamail/.rd/docker.sock
```
You can set the DOCKER_HOST environment variable as shown below which will allow `act` to use the correct Docker context:
```bash
export DOCKER_HOST=$(docker context inspect | jq -r '.[0].Endpoints.docker.Host')
```
See: [slight modification that helps for rancher desktop](https://github.com/nektos/act/issues/1051#issuecomment-1732542268)

### Apple Silcon

Expand Down Expand Up @@ -58,4 +81,4 @@ To run a specific job, use the `-j` flag:
For example, to run the `build` job from the `ci.yml` file, use this command:
```bash
$ act --workflows .github/workflows/ci.yml -j build
```
```

0 comments on commit de19448

Please sign in to comment.