nektos / act

Run your GitHub Actions locally 🚀

Home Page:https://nektosact.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue: Got error when use act at locally with remote docker contexts

Aisuko opened this issue · comments

Act version

➜  helm-charts-action git:(master) ✗ act --version
act version 0.2.20

Expected behaviour

act can work well with remote docker context, and I can pull the target image by manually.

Actual behaviour

act can not pull the image

Workflow and/or repository

workflow
name: Release Charts

on:
  push:
    branches:
      - master
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Configure Git
        run: |
          git config user.name "$GITHUB_ACTOR"
          git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

      - name: Install Helm
        uses: azure/setup-helm@v1
        with:
          version: v3.4.1

      # Optional step if GPG signing is used
      # - name: Prepare GPG key
      #   run: |
      #     gpg_dir=.cr-gpg
      #     mkdir "$gpg_dir"

      #     keyring="$gpg_dir/secring.gpg"
      #     base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring"

      #     passphrase_file="$gpg_dir/passphrase"
      #     echo "$GPG_PASSPHRASE" > "$passphrase_file"

      #     echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
      #     echo "CR_KEYRING=$keyring" >> "$GITHUB_ENV"
      #   env:
      #     GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
      #     GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"

      - name: Add dependency chart repos
        run: |
          helm repo add meshery https://meshery.io/charts/

      - name: Helm Chart Releaser For Remote
        uses: Aisuko/chart-releaser-action@v1.0.0-alpha.4
        with:
          charts_dir: install
          owner: Aisuko
          repo: charts-release
          # For helm charts index
          charts_repo_url: https://aisuko.github.io/charts-release
        env:
          CR_TOKEN: "${{ secrets.TOKEN }}"

Steps to reproduce

act output

Log
➜  helm-charts-action git:(master) ✗ act -n -v
DEBU[0000] Loading environment from /Users/peasant/Documents/helm-charts-action/.env
DEBU[0000] Loading secrets from /Users/peasant/Documents/helm-charts-action/.secrets
DEBU[0000] Loading workflows from '/Users/peasant/Documents/helm-charts-action/.github/workflows'
DEBU[0000] Reading workflow '/Users/peasant/Documents/helm-charts-action/.github/workflows/lint-test.yaml'
DEBU[0000] Reading workflow '/Users/peasant/Documents/helm-charts-action/.github/workflows/release.yaml'
DEBU[0000] Planning event: push
DEBU[0000] Loading slug from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] Loading revision from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] HEAD points to '296c8e291f2da06b236c92629848fd4663bd3a9e'
DEBU[0000] HEAD matches refs/heads/master
DEBU[0000] using github ref: refs/heads/master
DEBU[0000] context env => map[ACT:true CR_TOKEN:12c8f8fe2e21bd57107357fd0d5b5da665a9711b]
DEBU[0000] Loading slug from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] Loading revision from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] HEAD points to '296c8e291f2da06b236c92629848fd4663bd3a9e'
DEBU[0000] HEAD matches refs/heads/master
DEBU[0000] using github ref: refs/heads/master
DEBU[0000] context env => map[ACT:true CR_TOKEN:12c8f8fe2e21bd57107357fd0d5b5da665a9711b]
*DRYRUN* [Release Charts/release        ] 🚀  Start image=catthehacker/ubuntu:act-latest
DEBU[0000] Loading slug from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] Loading revision from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] HEAD points to '296c8e291f2da06b236c92629848fd4663bd3a9e'
DEBU[0000] HEAD matches refs/heads/master
DEBU[0000] using github ref: refs/heads/master
*DRYRUN* [Release Charts/release        ]   🐳  docker pull catthehacker/ubuntu:act-latest
*DRYRUN* [Lint and Test Charts/lint-test] 🚀  Start image=catthehacker/ubuntu:act-latest
DEBU[0000] Loading slug from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] Loading revision from git directory '/Users/peasant/Documents/helm-charts-action/.git'
DEBU[0000] Found revision: 296c8e291f2da06b236c92629848fd4663bd3a9e
DEBU[0000] HEAD points to '296c8e291f2da06b236c92629848fd4663bd3a9e'
DEBU[0000] HEAD matches refs/heads/master
DEBU[0000] using github ref: refs/heads/master
*DRYRUN* [Lint and Test Charts/lint-test]   🐳  docker pull catthehacker/ubuntu:act-latest
DEBU[0000] FIXME: Got an status-code for which error does not match any expected type!!!: -1  module=api status_code=-1
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] FIXME: Got an status-code for which error does not match any expected type!!!: -1  module=api status_code=-1
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DEBU[0000] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
➜  helm-charts-action git:(master) ✗ docker context ls
NAME            DESCRIPTION                               DOCKER ENDPOINT               KUBERNETES ENDPOINT   ORCHESTRATOR
default         Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                         swarm
redthirteen *   redthirteen                               ssh://aisuko@192.168.1.104
➜  helm-charts-action git:(master) ✗ docker images
REPOSITORY                                                      TAG                                        IMAGE ID       CREATED         SIZE
catthehacker/ubuntu                                             act-latest                                 516a91a01868   2 days ago      528MB
sickcodes/docker-osx                                            big-sur                                    a32a578a260a   5 days ago      3.25GB
<none>                                                          <none>                                     c14679285dd2   9 days ago      815MB
<none>                                                          <none>                                     d6b4fd464b03   9 days ago      815MB
vsc-mit-scheme-a3ad0cd28c253fbef4b418939bae5d95-uid             latest                                     5836980029e7   2 weeks ago     711MB
vsc-mit-scheme-a3ad0cd28c253fbef4b418939bae5d95                 latest                                     692f54af05cc   2 weeks ago     711MB
<none>                                                          <none>                                     261c7901ecab   4 weeks ago     711MB
vsc-mit-gnu-scheme-f8156c18abdddf4975e24318610814dd             latest                                     b45be34c65db   4 weeks ago     711MB

Issue is stale and will be closed in 14 days unless there is new activity

@catthehacker I can help test or contribution, please do some feedback

I think act doesn't read docker context configurations, no idea how to do that.

I would try to set the environment variable DOCKER_HOST=ssh://aisuko@192.168.1.104, then act should be able to connect.

DOCKER_HOST=ssh://aisuko@192.168.1.104 act

In the log it tried to connect to localhost, because DOCKER_HOST was set to it's default (or unset) unix:///var/run/docker.sock

I think act doesn't read docker context configurations, no idea how to do that.

I would try to set the environment variable DOCKER_HOST=ssh://aisuko@192.168.1.104, then act should be able to connect.

DOCKER_HOST=ssh://aisuko@192.168.1.104 act

In the log it tried to connect to localhost, because DOCKER_HOST was set to it's default (or unset) unix:///var/run/docker.sock

Thanks, I will take it a try.

commented

Docker contexts are not supported and it's quite easy to overcome that (example above). Anyone can feel free to make PR with such feature but it won't be actively pursued.

Here are one liners to set DOCKER_HOST automatically from current context:

bash:

export DOCKER_HOST=$(docker context inspect --format '{{.Endpoints.docker.Host}}')

pwsh:

$env:DOCKER_HOST = (docker context inspect --format '{{.Endpoints.docker.Host}}')

I believe we can add these to the README.md as tips, simpler for using is enough.

In fact, I'd like to add these to the .env file.

Issue is stale and will be closed in 14 days unless there is new activity

We can close this issue due to #749

Is this meant to be a workaround forever?