act icon indicating copy to clipboard operation
act copied to clipboard

Issue with `-n` dry run

Open nickp60 opened this issue 2 years ago • 11 comments

Bug report info

act --bug-report
act version:            0.2.31
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        /var/run/docker.sock
Config files:           
        /Users/nwaters/.actrc:
                -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
                -P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.19
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -compiler:            gc
                -ldflags:             -X main.version=0.2.31
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               amd64
                GOOS:                 darwin
                GOAMD64:              v1
Docker Engine:
        Engine version:        20.10.8
        Engine runtime:        runc
        Cgroup version:        1
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:            
        OS arch:               x86_64
        OS kernel:             5.10.47-linuxkit
        OS CPU:                4
        OS memory:             7960 MB
        Security options:
                name=seccomp,profile=default

Command used with act

act -n -v

Describe issue

I am trying to do a dry run to check a dynamically generated matrix, and encounter an error that does <edit: not> occur when running the actual tool without -n

 expression '${{ fromJson(needs.list-manifests.outputs.matrix) }}' evaluated to '%!t(<nil>)' 
ERRO[0000] Error while evaluating matrix: Invalid JSON: unexpected end of JSON input 
DEBU[0000]                                              
FATA[0000] yaml: unmarshal errors:
  line 27: cannot unmarshal !!str `${{ fro...` into []interface {} 

Link to GitHub repository

No response

Workflow content

name: 'build'                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                         
on:                                                                                                                                                                                                                                                                                                                                      
  push:                                                                                                                                                                                                                                                                                                                                  
    branches:                                                                                                                                                                                                                                                                                                                            
    - main                                                                                                                                                                                                                                                                                                                               
  pull_request:                                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                                         
jobs:                                                                                                                                                                                                                                                                                                                                    
  list-manifests:                                                                                                                                                                                                                                                                                                                        
    runs-on: ubuntu-latest                                                                                                                                                                                                                                                                                                               
    outputs:                                                                                                                                                                                                                                                                                                                             
      matrix: ${{ steps.set-matrix.outputs.matrix }}                                                                                                                                                                                                                                                                                     
    steps:                                                                                                                                                                                                                                                                                                                               
      - uses: actions/checkout@v2                                                                                                                                                                                                                                                                                                        
      - id: set-matrix                                                                                                                                                                                                                                                                                                                   
        run: echo "::set-output name=matrix::$(cat build_manifest.csv |grep -v '^#' | jq --raw-input . | jq -c --slurp .)"                                                                                                                                                                                                               
  build:                                                                                                                                                                                                                                                                                                                                 
    name: 'Build'                                                                                                                                                                                                                                                                                                                        
    needs: list-manifests                                                                                                                                                                                                                                                                                                                
    runs-on: ubuntu-latest                                                                                                                                                                                                                                                                                                               
    permissions:                                                                                                                                                                                                                                                                                                                         
      contents: read                                                                                                                                                                                                                                                                                                                     
      packages: write                                                                                                                                                                                                                                                                                                                    
    strategy:                                                                                                                                                                                                                                                                                                                            
        matrix:                                                                                                                                                                                                                                                                                                                          
            manifest: ${{ fromJson(needs.list-manifests.outputs.matrix) }}                                                                                                                                                                                                                                                               
    steps:                                                                                                                                                                                                                                                                                                                               
      - name: "Build:checkout"                                                                                                                                                                                                                                                                                                           
        uses: actions/checkout@v2                                                                                                                                                                                                                                                                                                        
      - name: Get version                                                                                                                                                                                                                                                                                                                
        env:                                                                                                                                                                                                                                                                                                                             
          tool_ver: ${{ matrix.manifest }}                                                                                                                                                                                                                                                                                               
        id: versplit                                                                                                                                                                                                                                                                                                                     
        run: echo "::set-output name=VERSION::${tool_ver##*,}"                                                                                                                                                                                                                                                                           
      - name: Get tool                                                                                                                                                                                                                                                                                                                   
        env:                                                                                                                                                                                                                                                                                                                             
          tool_ver: ${{ matrix.manifest }}                                                                                                                                                                                                                                                                                               
        id: toolsplit                                                                                                                                                                                                                                                                                                                    
        run: echo "::set-output name=TOOL::${tool_ver%,*}"

Relevant log output

act -n -v                                                                                                                                                                                                                                                                                    
DEBU[0000] Loading environment from /Users/nwaters/GitHub/dockerfiles/.env                                                                                                                                                                                                                                                               
DEBU[0000] Loading secrets from /Users/nwaters/GitHub/dockerfiles/.secrets                                                                                                                                                                                                                                                               
DEBU[0000] Loading workflows from '/Users/nwaters/GitHub/dockerfiles/.github/workflows'                                                                                                                                                                                                                                                  
DEBU[0000] Loading workflows recursively                                                                                                                                                                                                                                                                                                 
DEBU[0000] Found workflow 'builder.yaml' in '/Users/nwaters/GitHub/dockerfiles/.github/workflows/builder.yaml'                                                                                                                                                                                                                           
DEBU[0000] Found workflow 'builder.yaml~' in '/Users/nwaters/GitHub/dockerfiles/.github/workflows/builder.yaml~'                                                                                                                                                                                                                         
DEBU[0000] Reading workflow '/Users/nwaters/GitHub/dockerfiles/.github/workflows/builder.yaml'                                                                                                                                                                                                                                           
DEBU[0000] Planning event: push                                                                                                                                                                                                                                                                                                          
DEBU[0000] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                                                      
DEBU[0000] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                                                  
DEBU[0000] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                                                      
DEBU[0000] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'                                                                                                                                                                                                                                                                     
DEBU[0000] using github ref: refs/heads/main                                                                                                                                                                                                                                                                                             
DEBU[0000] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                                                      
*DRYRUN* [build/list-manifests] [DEBUG] evaluating expression 'success()'                                                                                                                                                                                                                                                                
*DRYRUN* [build/list-manifests] [DEBUG] expression 'success()' evaluated to 'true'                                                                                                                                                                                                                                                       
*DRYRUN* [build/list-manifests] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest                                                                                                                                                                                                                                                   
*DRYRUN* [build/list-manifests]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false                                                                                                                                                                                                       
*DRYRUN* [build/list-manifests] [DEBUG]   🐳  docker pull ghcr.io/catthehacker/ubuntu:act-latest                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG]   🐳  docker volume rm act-build-list-manifests                                                                                                                                                                                                                                                  
*DRYRUN* [build/list-manifests] [DEBUG]   🐳  docker volume rm act-build-list-manifests-env                                                                                                                                                                                                                                              
*DRYRUN* [build/list-manifests]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]                                                                                                                                                                          
*DRYRUN* [build/list-manifests]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]                                                                                                                                                                             
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                     
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'                                                                                                                                                                                                                                        
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main                                                                                                                                                                                                                                                                
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Skipping local actions/checkout because workdir was already copied                                                                                                                                                                                                                               
*DRYRUN* [build/list-manifests] [DEBUG] skip pre step for 'actions/checkout@v2': no action model available                                                                                                                                                                                                                               
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                     
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'                                                                                                                                                                                                                                        
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main                                                                                                                                                                                                                                                                
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Skipping local actions/checkout because workdir was already copied                                                                                                                                                                                                                               
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                     
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'                                                                                                                                                                                                                                        
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main                                                                                                                                                                                                                                                                
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                     
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'                                                                                                                                                                                                                                        
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main                                                                                                                                                                                                                                                                
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] setupEnv => map[ACT:true CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVEN
T_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:list-manifests GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/main GITHUB_REF_NAME:main GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:vdblab/dockerfiles GITHUB_REPOSITORY_OWNER:vdblab GITHUB_RETENT
ION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:5d068db5bef97e1d014f994f3eecd6d6e464d4d0 GITHUB_TOKEN: GITHUB_WORKFLOW:build GITHUB_WORKSPACE:/Users/nwaters/GitHub/dockerfiles ImageOS:ubuntu20 PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/nul
l RUNNER_TRACKING_ID:]                                                                                                                                                                                                                                                                                                                   
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                     
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'                                                                                                                                                                                                                                        
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main                                                                                                                                                                                                                                                                
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] evaluating expression ''                                                                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] expression '' evaluated to 'true'                                                                                                                                                                                                                                                                
*DRYRUN* [build/list-manifests] ⭐ Run Main actions/checkout@v2                                                                                                                                                                                                                                                                          
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                         
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'                                                                                                                                                                                                                     
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0 
DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0*DRYRUN* [build/list-manifests]   ✅  Success - Main actions/checkout@v2*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0*DRYRUN* [build/list-manifests] [DEBUG] setupEnv => map[ACT:true CI:true GITHUB_ACTION:set-matrix GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:list-manifests GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/main GITHUB_REF_NAME:main GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:vdblab/dockerfiles GITHUB_REPOSITORY_OWNER:vdblab GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:5d068db5bef97e1d014f994f3eecd6d6e464d4d0 GITHUB_TOKEN: GITHUB_WORKFLOW:build GITHUB_WORKSPACE:/Users/nwaters/GitHub/dockerfiles ImageOS:ubuntu20 PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] evaluating expression ''
*DRYRUN* [build/list-manifests] [DEBUG] expression '' evaluated to 'true'
*DRYRUN* [build/list-manifests] ⭐ Run Main echo "::set-output name=matrix::$(cat build_manifest.csv |grep -v '^#' | jq --raw-input . | jq -c --slurp .)"
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] Wrote command 

echo "::set-output name=matrix::$(cat build_manifest.csv |grep -v '^#' | jq --raw-input . | jq -c --slurp .)"

 to 'workflow/set-matrix'
*DRYRUN* [build/list-manifests]   ✅  Success - Main echo "::set-output name=matrix::$(cat build_manifest.csv |grep -v '^#' | jq --raw-input . | jq -c --slurp .)"
*DRYRUN* [build/list-manifests] [DEBUG] skipping post step for 'actions/checkout@v2': no action model available
*DRYRUN* [build/list-manifests] [DEBUG]   🐳  docker volume rm act-build-list-manifests
*DRYRUN* [build/list-manifests] [DEBUG]   🐳  docker volume rm act-build-list-manifests-env
*DRYRUN* [build/list-manifests] 🏁  Job succeeded
*DRYRUN* [build/list-manifests] [DEBUG] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git'
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0'
*DRYRUN* [build/list-manifests] [DEBUG] using github ref: refs/heads/main
*DRYRUN* [build/list-manifests] [DEBUG] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0
*DRYRUN* [build/list-manifests] [DEBUG] expression '${{ steps.set-matrix.outputs.matrix }}' rewritten to 'format('{0}', steps.set-matrix.outputs.matrix)'
*DRYRUN* [build/list-manifests] [DEBUG] evaluating expression 'format('{0}', steps.set-matrix.outputs.matrix)'
*DRYRUN* [build/list-manifests] [DEBUG] expression 'format('{0}', steps.set-matrix.outputs.matrix)' evaluated to '%!t(string=)'
DEBU[0000] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git' 
DEBU[0000] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git' 
DEBU[0000] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0 
DEBU[0000] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0' 
DEBU[0000] using github ref: refs/heads/main            
DEBU[0000] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0 
DEBU[0000] Loading slug from git directory '/Users/nwaters/GitHub/dockerfiles/.git' 
DEBU[0000] Loading revision from git directory '/Users/nwaters/GitHub/dockerfiles/.git' 
DEBU[0000] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0 
DEBU[0000] HEAD points to '5d068db5bef97e1d014f994f3eecd6d6e464d4d0' 
DEBU[0000] using github ref: refs/heads/main            
DEBU[0000] Found revision: 5d068db5bef97e1d014f994f3eecd6d6e464d4d0 
DEBU[0000] evaluating expression '${{ fromJson(needs.list-manifests.outputs.matrix) }}' 
DEBU[0000] expression '${{ fromJson(needs.list-manifests.outputs.matrix) }}' evaluated to '%!t(<nil>)' 
ERRO[0000] Error while evaluating matrix: Invalid JSON: unexpected end of JSON input 
DEBU[0000]                                              
FATA[0000] yaml: unmarshal errors:
  line 27: cannot unmarshal !!str `${{ fro...` into []interface {}

Additional information

I'm guessing this happens cause the echo "::set-output name=matrix::$(...) part isn't executed in the dry run; might still be nice to have a way around this; perhaps a tag to indicate a step should be executed in dryrun mode?

nickp60 avatar Sep 14 '22 14:09 nickp60

I am trying to do a dry run to check a dynamically generated matrix, and encounter an error that does occur when running the actual tool not with -n

I think you meant to say "encounter an error that does not occur when running the actual tool not with -n" ?

For myself, I can successfully run my workflow using act without the dryrun flag. However, once I use the dryrun flag I get a similar error as op:

DEBU[0003] evaluating expression '${{ fromJSON(needs.project_types.outputs.node_versions) }}' 
DEBU[0003] expression '${{ fromJSON(needs.project_types.outputs.node_versions) }}' evaluated to '%!t(<nil>)' 
ERRO[0003] Error while evaluating matrix: Invalid JSON: unexpected end of JSON input 
DEBU[0003] false                                        
FATA[0003] yaml: unmarshal errors:
  line 443: cannot unmarshal !!str `${{ fro...` into []interface {} 

here is my bug report data

act version:            0.2.30
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
	/var/run/docker.sock
Config files:           
	/home/mig/.actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.19
	Module path:           github.com/nektos/act
	Main version:          (devel)
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-compiler:            gc
		-trimpath:            true
		CGO_ENABLED:          1
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         b305cca1c05c9f68f352f53467e509fdaedb8cfd
		vcs.time:             2022-08-02T15:26:03Z
		vcs.modified:         true
Docker Engine:
	Engine version:        20.10.17
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         systemd
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Arch Linux
	OS type:               linux
	OS version:            
	OS arch:               x86_64
	OS kernel:             5.19.3-zen1-1-zen
	OS CPU:                16
	OS memory:             31787 MB
	Security options:
		name=seccomp,profile=default
		name=cgroupns

20k-ultra avatar Sep 14 '22 19:09 20k-ultra

I can add from a black box debugging perspective, this is not a new regression. I've tried act version 0.2.25, 0.2.28, and 0.2.30. They all have this issue just with varying error messages. I was hoping I could just downgrade as a workaround :(

20k-ultra avatar Sep 15 '22 04:09 20k-ultra

I'm not shure what should happen in this case, because GitHub doesn't have a concept like DRYRUN

perhaps a tag to indicate a step should be executed in dryrun mode?

I cannot imagine how to implement that, because act doesn't create a docker container to run the step that could create the matrix.

I understand your problem is that you don't know how to correctly use ::set-output:: to set an output and want to experiment with dryrun until it works.

I can provide you a hint to fix the bug in your workflow, you have to escape %, \r, \n.

      - id: set-matrix                                                                                                                                                                                                                                                                                                                   
        run: echo "::set-output name=matrix::$(cat build_manifest.csv |grep -v '^#' | jq --raw-input . | jq -c --slurp .  | sed -e "s/%/%25/g" | sed -e "s/^.*$/\0%0A/g" | sed -e "s/\r/%0D/g" | tr -d '\n')"                                                                                                                                                                                                               

GitHub seem to plan to improve setting outputs from bash by providing file commands for set-output https://github.com/actions/runner/pull/2118. The heredoc style allows to avoid the need to use undocumented escape codes.

I can image that act accepts the outputs of the previous jobs, but that would be hard to use.

I suggest

  • to copy your workflow to e.g. .github/act/workflows/test.yml
  • comment out steps which should be skipped
  • run act without DRYRUN

Otherwise DRYRUN should proceed even on errors like

  • strategy
  • if
  • calling local actions

However that is not what you wanted to work. Maybe a new run mode between DRYRUN and normal would solve this problem?

ChristopherHX avatar Sep 15 '22 16:09 ChristopherHX

@20k-ultra yes, thank you, edited above for clarity!

nickp60 avatar Sep 15 '22 16:09 nickp60

@ChristopherHX thank you for your comment. The in the workflow works as intended, the issue only occurs in --dryrun mode presumably due to empty argument to fromJson.

A new mode between DRRUN and normal might be useful; I was imagining a simpler sulution of either a flag to force execution of a step regardsless of --dryrun``, or to make a label/decorator like #debugoutputswhere mock outputs could be specified and used during--dryrun`.
something like :

jobs:                                                                                                                                                                                                                                                                                                                                    
  list-manifests:                                                                                                                                                                                                                                                                                                                        
    runs-on: ubuntu-latest                                                                                                                                                                                                                                                                                                               
    outputs:                                                                                                                                                                                                                                                                                                                             
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    #debugoutputs:
    #   matrix: ["item1,A", "item2,A", "item1,B"]                                                                                                                                                                                                                                                                                     
    steps:                                                                                                                                                                                                                                                                                                                               
      - uses: actions/checkout@v2                                                                                                                                                                                                                                                                                                        
      - id: set-matrix                                                                                                                                                                                                                                                                                                                   
        run: echo "::set-output name=matrix::$(cat build_manifest.csv |grep -v '^#' | jq --raw-input . | jq -c --slurp .)"                                                                                                                                                                                                               

Or in @20k-ultra 's case (guessing, as I don't have the code)

job:
  project_types
  ...
  outputs:
      node_versions: ${{ steps.getnodeversions.outputs.node_versions }}
  #debugoutputs:
  #   node_versions: ["7.3", "7.4"]
  steps:
    id: getnodeversions
    run: <logic to get node versions"

A third option could be to set an override via the CLI, somthing like

act -n --overrides steps.set-matrix.outputs.matrix=["item1,A", "item2,A", "item1,B"]

Just some ideas; I realize these are easy to think about and hard to implement!

nickp60 avatar Sep 15 '22 16:09 nickp60

debug outputs is a neat idea!!

I was honestly surprised to find act offered a dryrun flag. Given how complex workflow's can be, and their logic depending on outputs, how could it be possible ?

I am considering making my workflow "dryrun aware" so that it logs a message to indicate "I would have done this thing but this is a dryrun". That however, would make the workflow very verbose with the significant additions of "if dryrun ..."

I'm hoping an act dev sees the debug outputs idea and thinks it's something we should discuss further.

For context on why I want to use dryrun... I have a 1300 LOC workflow that I'm hoping to write some unit testing for. With the dryrun flag I can see "did this job run when I gave this context" by grepping act output for my job.

20k-ultra avatar Sep 15 '22 17:09 20k-ultra

I guess something like debugoutputs on job level can be added to act, but the other 3 maintainers / owner need to agree.

This format seem to be easier to parse in go yaml v3. Providing job outputs should be doable, even with comments.

jobs:                                                                                                                                                                                                                                                                                                                                    
  list-manifests:
    runs-on: ubuntu-latest
    outputs:
      # Comment for this output
      # DRYRUN: ["7.3", "7.4"]
      # Another Comment for this output
      matrix: ${{ steps.set-matrix.outputs.matrix }}

Comments below a yaml key value pair doesn't get associated with the key above it, so better only above outputs key or as line comment on the right to the specfic output.

#DRYRUN: <value> / # DRYRUN: <value>.

ChristopherHX avatar Sep 15 '22 19:09 ChristopherHX

You can try https://github.com/nektos/act/pull/1350, seems like to be fairly easy to implement. It has a fast turn around time.

ChristopherHX avatar Sep 15 '22 20:09 ChristopherHX

Hello,

I don't dive into static checking of workflows yet but I like idea with splitting dryrun data (and any act related data like env.ACT) from real workflows. Just my opinion. :)

For example, by adding --dryrun-override-file=override.yml with a usual workflow-like structure like:

jobs:
  list-manifests:                                                                                                                                   
    outputs:
      matrix: ["7.3", "7.4"]

And during dryrun we replace real YAML nodes by nodes from the files and continue usual parsing.

So third option with overriding thru CLI looks interesting.

alex-savchuk avatar Sep 18 '22 19:09 alex-savchuk

The fix in #1350 works for my purposes, and I like having everything in a single file. Kind of documents what is expected from a step as well, which is nice.

nickp60 avatar Sep 19 '22 14:09 nickp60

I personally like @alex-savchuk approach of being able to pass a file with the overrides but will take overrides in the workflow too! I think it makes makes it so that the people writing the workflow don't even have to know or worry about the test tooling.

Check out how complex/long the workflow file I'm testing is https://github.com/product-os/flowzone/blob/master/.github/workflows/flowzone.yml

If I had to add comments inline to specify overrides, it would get even longer.

20k-ultra avatar Sep 20 '22 05:09 20k-ultra

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

github-actions[bot] avatar Oct 21 '22 00:10 github-actions[bot]

I commented on https://github.com/nektos/act/pull/1350 stating I plan to support dryrun and configurable outputs within my integration testing tool I'm building for Github workflows. I don't think act wants to support this right now so that's the direction I'm going.

20k-ultra avatar Nov 08 '22 04:11 20k-ultra