[GH-ISSUE #1377] internal act commands/logs are part of redirected command output #729

Closed
opened 2026-03-01 21:45:52 +03:00 by kerem · 1 comment
Owner

Originally created by @jnmcfly on GitHub (Oct 8, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1377

Bug report info

act version:            0.2.32
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/jn/.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.18.6
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:         
        Build settings:
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.32 -X main.commit=21484b5c1ecbd9e1ddb6a57debd7731a3e1fc25f -X main.date=2022-10-01T03:01:40Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         21484b5c1ecbd9e1ddb6a57debd7731a3e1fc25f
                vcs.time:             2022-09-29T05:59:52Z
                vcs.modified:         false
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:                    Manjaro Linux
        OS type:               linux
        OS version:            
        OS arch:               x86_64
        OS kernel:             5.10.141-1-MANJARO
        OS CPU:                8
        OS memory:             15895 MB
        Security options:
                name=apparmor
                name=seccomp,profile=default
                name=cgroupns

Command used with act

act -W ./.github/workflows/tf-unittest.yaml -e inputs.json

Describe issue

tl;dr
a simple json file should be generated by terraform show -json -no-color plan_* > test.json
but instead of printing a smooth formatted json document, we're getting this (execd inside container an cat the test.json):

test.json

[command]/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8/terraform-bin show -json -no-color plan_stage_20b61b43e_1665217566.bin
{"format_version":"1.1","terraform_version":"1.3.2","planned_values":{"root_module":{"resources":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","provider_name":"re
gistry.terraform.io/hashicorp/random","schema_version":0,"values":{"keepers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","n
ame":"name","provider_name":"registry.terraform.io/hashicorp/random","change":{"actions":["create"],"before":null,"after":{"keepers":null},"after_unknown":{"id":true,"result":true},"before_sensitive"
:false,"after_sensitive":{}}}],"configuration":{"provider_config":{"random":{"name":"random","full_name":"registry.terraform.io/hashicorp/random"}},"root_module":{"resources":[{"address":"random_uuid
.name","mode":"managed","type":"random_uuid","name":"name","provider_config_key":"random","schema_version":0}]}}}
::debug::Terraform exited with code 0.
::debug::stdout: {"format_version":"1.1","terraform_version":"1.3.2","planned_values":{"root_module":{"resources":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","p
rovider_name":"registry.terraform.io/hashicorp/random","schema_version":0,"values":{"keepers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"random_uuid.name","mode":"managed","type"
:"random_uuid","name":"name","provider_name":"registry.terraform.io/hashicorp/random","change":{"actions":["create"],"before":null,"after":{"keepers":null},"after_unknown":{"id":true,"result":true},"
before_sensitive":false,"after_sensitive":{}}}],"configuration":{"provider_config":{"random":{"name":"random","full_name":"registry.terraform.io/hashicorp/random"}},"root_module":{"resources":[{"addr
ess":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","provider_config_key":"random","schema_version":0}]}}}%0A
::debug::stderr: 
::debug::exitcode: 0

::set-output name=stdout::{"format_version":"1.1","terraform_version":"1.3.2","planned_values":{"root_module":{"resources":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name":
"name","provider_name":"registry.terraform.io/hashicorp/random","schema_version":0,"values":{"keepers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"random_uuid.name","mode":"manage
d","type":"random_uuid","name":"name","provider_name":"registry.terraform.io/hashicorp/random","change":{"actions":["create"],"before":null,"after":{"keepers":null},"after_unknown":{"id":true,"result
":true},"before_sensitive":false,"after_sensitive":{}}}],"configuration":{"provider_config":{"random":{"name":"random","full_name":"registry.terraform.io/hashicorp/random"}},"root_module":{"resources
":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","provider_config_key":"random","schema_version":0}]}}}%0A

::set-output name=stderr::

::set-output name=exitcode::0

looks like something leaked inside this json.

expected output should be only the stdout part of the command

No response

Workflow content

name: Terraform Unittest
on:
  workflow_call:
    inputs:
      ENVIRONMENT:
        type: string
        required: true
      WORK_DIR:
        type: string
        required: false
        default: ""

defaults:
  run:
    working-directory: "tf" #${{ github.event.inputs.WORK_DIR }}

env:
  TERRAFORM_VERSION: 1.3.2

jobs:
  lint:
    runs-on: ubuntu-22.04
    steps:
      - name: checkout
        uses: actions/checkout@v3
      - name: install terraform
        uses: hashicorp/setup-terraform@v2.0.0
        with:
          terraform_version: ${{env.TERRAFORM_VERSION}}
      - name: terraform init
        run: terraform init
      - name: terraform plan
        run: terraform workspace select ${{ github.event.inputs.ENVIRONMENT }}
      - name: terraform plan
        run: terraform plan -var-file=_global.json -var-file=_${{ github.event.inputs.ENVIRONMENT }}.json -out=plan_${{ github.event.inputs.ENVIRONMENT }}_${GITHUB_SHA:0:9}_$(date +%s).bin
      - name: generate plan json
        run: terraform show -json -no-color plan_* > test.json
      - name: conftest
        uses: docker://openpolicyagent/conftest:latest
        with:
          args: test -p ./tf/policy/ ./tf/test.json

Relevant log output

[Terraform Unittest/lint] ⭐ Run Main generate plan json
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] Wrote command 

terraform show -json -no-color plan_* > test.json

 to 'workflow/5'
[Terraform Unittest/lint] [DEBUG] Writing entry to tarball workflow/5 len:51
[Terraform Unittest/lint] [DEBUG] Extracting content to '/var/run/act'
[Terraform Unittest/lint]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5] user= workdir=tf
[Terraform Unittest/lint] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5]'
[Terraform Unittest/lint] [DEBUG] Working directory '/home/jn/git/github.com/devops-actions/tf'
[Terraform Unittest/lint]   ✅  Success - Main generate plan json
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] setupEnv => map[ACT:true AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:6 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:workflow_call GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:lint GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/main GITHUB_REF_NAME:main GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jnmcfly/devops-actions GITHUB_REPOSITORY_OWNER:jnmcfly GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:20b61b43e39f1bad527b55e1812fa18b17096d9e GITHUB_TOKEN: GITHUB_WORKFLOW:Terraform Unittest GITHUB_WORKSPACE:/home/jn/git/github.com/devops-actions IMAGE_OS:ubuntu22 INPUT_ARGS:test -p ./tf/policy/ ./tf/test.json ImageOS:ubuntu22 LSB_OS_VERSION:2204 LSB_RELEASE:22.04 PATH:/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8:/opt/hostedtoolcache/node/16.17.1/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache TERRAFORM_CLI_PATH:/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8 TERRAFORM_VERSION:1.3.2 USER:root]
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] evaluating expression ''
[Terraform Unittest/lint] [DEBUG] expression '' evaluated to 'true'
[Terraform Unittest/lint] ⭐ Run Main conftest
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint]   🐳  docker pull image=openpolicyagent/conftest:latest platform= username= forcePull=false
[Terraform Unittest/lint] [DEBUG]   🐳  docker pull openpolicyagent/conftest:latest
[Terraform Unittest/lint] [DEBUG] Image exists? true
[Terraform Unittest/lint]   🐳  docker create image=openpolicyagent/conftest:latest platform= entrypoint=[] cmd=["test" "-p" "./tf/policy/" "./tf/test.json"]
[Terraform Unittest/lint] [DEBUG] Created container name=act-Terraform-6 id=5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb from image openpolicyagent/conftest:latest (platform: )
[Terraform Unittest/lint] [DEBUG] ENV ==> [GITHUB_ACTION_PATH= GITHUB_GRAPHQL_URL=https://api.github.com/graphql GITHUB_REPOSITORY_OWNER=jnmcfly TERRAFORM_CLI_PATH=/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8 DEBIAN_FRONTEND=noninteractive GITHUB_RUN_NUMBER=1 GITHUB_ACTIONS=true GITHUB_SHA=20b61b43e39f1bad527b55e1812fa18b17096d9e GITHUB_HEAD_REF= GITHUB_RETENTION_DAYS=0 RUNNER_PERFLOG=/dev/null INPUT_ARGS=test -p ./tf/policy/ ./tf/test.json CI=true GITHUB_WORKFLOW=Terraform Unittest IMAGE_OS=ubuntu22 GITHUB_ACTION_REF= GITHUB_SERVER_URL=https://github.com RUN_TOOL_CACHE=/opt/hostedtoolcache USER=root GITHUB_EVENT_NAME=workflow_call GITHUB_WORKSPACE=/home/jn/git/github.com/devops-actions GITHUB_JOB=lint RUNNER_TRACKING_ID= AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache GITHUB_ACTION=6 GITHUB_EVENT_PATH=/var/run/act/workflow/event.json GITHUB_REF=refs/heads/main GITHUB_PATH=/var/run/act/workflow/paths.txt GITHUB_ACTOR=nektos/act GITHUB_ENV=/var/run/act/workflow/envs.txt GITHUB_REF_NAME=main GITHUB_BASE_REF= DEPLOYMENT_BASEPATH=/opt/runner ACT=true LSB_OS_VERSION=2204 GITHUB_REF_TYPE=branch GITHUB_API_URL=https://api.github.com LSB_RELEASE=22.04 PATH=/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8:/opt/hostedtoolcache/node/16.17.1/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_USER=root GITHUB_RUN_ID=1 GITHUB_ACTION_REPOSITORY= GITHUB_REPOSITORY=jnmcfly/devops-actions GITHUB_TOKEN= TERRAFORM_VERSION=1.3.2 ImageOS=ubuntu22 RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp]
[Terraform Unittest/lint]   🐳  docker run image=openpolicyagent/conftest:latest platform= entrypoint=[] cmd=["test" "-p" "./tf/policy/" "./tf/test.json"]
[Terraform Unittest/lint] [DEBUG] Starting container: 5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb
[Terraform Unittest/lint] [DEBUG] Started container: 5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb
| Error: running test: parse configurations: parser unmarshal: unmarshal json: invalid character 'c' looking for beginning of value, path: ./tf/test.json
[Terraform Unittest/lint] [DEBUG] Return status: 1
[Terraform Unittest/lint] [DEBUG] Removed container: 5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb
[Terraform Unittest/lint]   ❌  Failure - Main conftest
[Terraform Unittest/lint] exit with `FAILURE`: 1
[Terraform Unittest/lint] [DEBUG] skipping post step for 'checkout': no action model available
[Terraform Unittest/lint] 🏁  Job failed
[Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git'
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
[Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e'
[Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main
[Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e
Error: Job 'lint' failed

Additional information

inputs.json

{
  "inputs": {
    "ENVIRONMENT": "stage",
    "WORK_DIR": "tf"
  }
}
Originally created by @jnmcfly on GitHub (Oct 8, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1377 ### Bug report info ```plain text act version: 0.2.32 GOOS: linux GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is unset/empty. Sockets found: /var/run/docker.sock Config files: /home/jn/.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.18.6 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -compiler: gc -ldflags: -s -w -X main.version=0.2.32 -X main.commit=21484b5c1ecbd9e1ddb6a57debd7731a3e1fc25f -X main.date=2022-10-01T03:01:40Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: 21484b5c1ecbd9e1ddb6a57debd7731a3e1fc25f vcs.time: 2022-09-29T05:59:52Z vcs.modified: false 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: Manjaro Linux OS type: linux OS version: OS arch: x86_64 OS kernel: 5.10.141-1-MANJARO OS CPU: 8 OS memory: 15895 MB Security options: name=apparmor name=seccomp,profile=default name=cgroupns ``` ### Command used with act ```sh act -W ./.github/workflows/tf-unittest.yaml -e inputs.json ``` ### Describe issue **tl;dr** a simple json file should be generated by` terraform show -json -no-color plan_* > test.json` but instead of printing a smooth formatted json document, we're getting this (execd inside container an cat the test.json): **test.json** ``` [command]/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8/terraform-bin show -json -no-color plan_stage_20b61b43e_1665217566.bin {"format_version":"1.1","terraform_version":"1.3.2","planned_values":{"root_module":{"resources":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","provider_name":"re gistry.terraform.io/hashicorp/random","schema_version":0,"values":{"keepers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","n ame":"name","provider_name":"registry.terraform.io/hashicorp/random","change":{"actions":["create"],"before":null,"after":{"keepers":null},"after_unknown":{"id":true,"result":true},"before_sensitive" :false,"after_sensitive":{}}}],"configuration":{"provider_config":{"random":{"name":"random","full_name":"registry.terraform.io/hashicorp/random"}},"root_module":{"resources":[{"address":"random_uuid .name","mode":"managed","type":"random_uuid","name":"name","provider_config_key":"random","schema_version":0}]}}} ::debug::Terraform exited with code 0. ::debug::stdout: {"format_version":"1.1","terraform_version":"1.3.2","planned_values":{"root_module":{"resources":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","p rovider_name":"registry.terraform.io/hashicorp/random","schema_version":0,"values":{"keepers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"random_uuid.name","mode":"managed","type" :"random_uuid","name":"name","provider_name":"registry.terraform.io/hashicorp/random","change":{"actions":["create"],"before":null,"after":{"keepers":null},"after_unknown":{"id":true,"result":true}," before_sensitive":false,"after_sensitive":{}}}],"configuration":{"provider_config":{"random":{"name":"random","full_name":"registry.terraform.io/hashicorp/random"}},"root_module":{"resources":[{"addr ess":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","provider_config_key":"random","schema_version":0}]}}}%0A ::debug::stderr: ::debug::exitcode: 0 ::set-output name=stdout::{"format_version":"1.1","terraform_version":"1.3.2","planned_values":{"root_module":{"resources":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name": "name","provider_name":"registry.terraform.io/hashicorp/random","schema_version":0,"values":{"keepers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"random_uuid.name","mode":"manage d","type":"random_uuid","name":"name","provider_name":"registry.terraform.io/hashicorp/random","change":{"actions":["create"],"before":null,"after":{"keepers":null},"after_unknown":{"id":true,"result ":true},"before_sensitive":false,"after_sensitive":{}}}],"configuration":{"provider_config":{"random":{"name":"random","full_name":"registry.terraform.io/hashicorp/random"}},"root_module":{"resources ":[{"address":"random_uuid.name","mode":"managed","type":"random_uuid","name":"name","provider_config_key":"random","schema_version":0}]}}}%0A ::set-output name=stderr:: ::set-output name=exitcode::0 ``` looks like something leaked inside this json. **expected output should be only the stdout part of the command** ### Link to GitHub repository _No response_ ### Workflow content ```yml name: Terraform Unittest on: workflow_call: inputs: ENVIRONMENT: type: string required: true WORK_DIR: type: string required: false default: "" defaults: run: working-directory: "tf" #${{ github.event.inputs.WORK_DIR }} env: TERRAFORM_VERSION: 1.3.2 jobs: lint: runs-on: ubuntu-22.04 steps: - name: checkout uses: actions/checkout@v3 - name: install terraform uses: hashicorp/setup-terraform@v2.0.0 with: terraform_version: ${{env.TERRAFORM_VERSION}} - name: terraform init run: terraform init - name: terraform plan run: terraform workspace select ${{ github.event.inputs.ENVIRONMENT }} - name: terraform plan run: terraform plan -var-file=_global.json -var-file=_${{ github.event.inputs.ENVIRONMENT }}.json -out=plan_${{ github.event.inputs.ENVIRONMENT }}_${GITHUB_SHA:0:9}_$(date +%s).bin - name: generate plan json run: terraform show -json -no-color plan_* > test.json - name: conftest uses: docker://openpolicyagent/conftest:latest with: args: test -p ./tf/policy/ ./tf/test.json ``` ### Relevant log output ```sh [Terraform Unittest/lint] ⭐ Run Main generate plan json [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] Wrote command terraform show -json -no-color plan_* > test.json to 'workflow/5' [Terraform Unittest/lint] [DEBUG] Writing entry to tarball workflow/5 len:51 [Terraform Unittest/lint] [DEBUG] Extracting content to '/var/run/act' [Terraform Unittest/lint] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5] user= workdir=tf [Terraform Unittest/lint] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5]' [Terraform Unittest/lint] [DEBUG] Working directory '/home/jn/git/github.com/devops-actions/tf' [Terraform Unittest/lint] ✅ Success - Main generate plan json [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] setupEnv => map[ACT:true AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:6 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:workflow_call GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:lint GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/main GITHUB_REF_NAME:main GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jnmcfly/devops-actions GITHUB_REPOSITORY_OWNER:jnmcfly GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:20b61b43e39f1bad527b55e1812fa18b17096d9e GITHUB_TOKEN: GITHUB_WORKFLOW:Terraform Unittest GITHUB_WORKSPACE:/home/jn/git/github.com/devops-actions IMAGE_OS:ubuntu22 INPUT_ARGS:test -p ./tf/policy/ ./tf/test.json ImageOS:ubuntu22 LSB_OS_VERSION:2204 LSB_RELEASE:22.04 PATH:/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8:/opt/hostedtoolcache/node/16.17.1/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache TERRAFORM_CLI_PATH:/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8 TERRAFORM_VERSION:1.3.2 USER:root] [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] evaluating expression '' [Terraform Unittest/lint] [DEBUG] expression '' evaluated to 'true' [Terraform Unittest/lint] ⭐ Run Main conftest [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] 🐳 docker pull image=openpolicyagent/conftest:latest platform= username= forcePull=false [Terraform Unittest/lint] [DEBUG] 🐳 docker pull openpolicyagent/conftest:latest [Terraform Unittest/lint] [DEBUG] Image exists? true [Terraform Unittest/lint] 🐳 docker create image=openpolicyagent/conftest:latest platform= entrypoint=[] cmd=["test" "-p" "./tf/policy/" "./tf/test.json"] [Terraform Unittest/lint] [DEBUG] Created container name=act-Terraform-6 id=5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb from image openpolicyagent/conftest:latest (platform: ) [Terraform Unittest/lint] [DEBUG] ENV ==> [GITHUB_ACTION_PATH= GITHUB_GRAPHQL_URL=https://api.github.com/graphql GITHUB_REPOSITORY_OWNER=jnmcfly TERRAFORM_CLI_PATH=/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8 DEBIAN_FRONTEND=noninteractive GITHUB_RUN_NUMBER=1 GITHUB_ACTIONS=true GITHUB_SHA=20b61b43e39f1bad527b55e1812fa18b17096d9e GITHUB_HEAD_REF= GITHUB_RETENTION_DAYS=0 RUNNER_PERFLOG=/dev/null INPUT_ARGS=test -p ./tf/policy/ ./tf/test.json CI=true GITHUB_WORKFLOW=Terraform Unittest IMAGE_OS=ubuntu22 GITHUB_ACTION_REF= GITHUB_SERVER_URL=https://github.com RUN_TOOL_CACHE=/opt/hostedtoolcache USER=root GITHUB_EVENT_NAME=workflow_call GITHUB_WORKSPACE=/home/jn/git/github.com/devops-actions GITHUB_JOB=lint RUNNER_TRACKING_ID= AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache GITHUB_ACTION=6 GITHUB_EVENT_PATH=/var/run/act/workflow/event.json GITHUB_REF=refs/heads/main GITHUB_PATH=/var/run/act/workflow/paths.txt GITHUB_ACTOR=nektos/act GITHUB_ENV=/var/run/act/workflow/envs.txt GITHUB_REF_NAME=main GITHUB_BASE_REF= DEPLOYMENT_BASEPATH=/opt/runner ACT=true LSB_OS_VERSION=2204 GITHUB_REF_TYPE=branch GITHUB_API_URL=https://api.github.com LSB_RELEASE=22.04 PATH=/tmp/4e3150ec-a152-467e-8b5f-f548ce0849c8:/opt/hostedtoolcache/node/16.17.1/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_USER=root GITHUB_RUN_ID=1 GITHUB_ACTION_REPOSITORY= GITHUB_REPOSITORY=jnmcfly/devops-actions GITHUB_TOKEN= TERRAFORM_VERSION=1.3.2 ImageOS=ubuntu22 RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp] [Terraform Unittest/lint] 🐳 docker run image=openpolicyagent/conftest:latest platform= entrypoint=[] cmd=["test" "-p" "./tf/policy/" "./tf/test.json"] [Terraform Unittest/lint] [DEBUG] Starting container: 5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb [Terraform Unittest/lint] [DEBUG] Started container: 5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb | Error: running test: parse configurations: parser unmarshal: unmarshal json: invalid character 'c' looking for beginning of value, path: ./tf/test.json [Terraform Unittest/lint] [DEBUG] Return status: 1 [Terraform Unittest/lint] [DEBUG] Removed container: 5ca43ab8db38c968f9a35e9dc7b42d312dbda03c1be2493f685599151490aebb [Terraform Unittest/lint] ❌ Failure - Main conftest [Terraform Unittest/lint] exit with `FAILURE`: 1 [Terraform Unittest/lint] [DEBUG] skipping post step for 'checkout': no action model available [Terraform Unittest/lint] 🏁 Job failed [Terraform Unittest/lint] [DEBUG] Loading slug from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Loading revision from git directory '/home/jn/git/github.com/devops-actions/.git' [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e [Terraform Unittest/lint] [DEBUG] HEAD points to '20b61b43e39f1bad527b55e1812fa18b17096d9e' [Terraform Unittest/lint] [DEBUG] using github ref: refs/heads/main [Terraform Unittest/lint] [DEBUG] Found revision: 20b61b43e39f1bad527b55e1812fa18b17096d9e Error: Job 'lint' failed ``` ### Additional information **inputs.json** ``` { "inputs": { "ENVIRONMENT": "stage", "WORK_DIR": "tf" } } ```
kerem 2026-03-01 21:45:52 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@ChristopherHX commented on GitHub (Oct 8, 2022):

It's the fault of https://github.com/hashicorp/setup-terraform, they install a wrapper script and don't add the actual teraform cli to your PATH by default.

See the README of hashicorp/setup-terraform

The wrapper script installation can be skipped by setting the terraform_wrapper variable to false:

steps:
- uses: hashicorp/setup-terraform@v2
  with:
   terraform_wrapper: false
<!-- gh-comment-id:1272300643 --> @ChristopherHX commented on GitHub (Oct 8, 2022): It's the fault of https://github.com/hashicorp/setup-terraform, they install a wrapper script and don't add the actual teraform cli to your PATH by default. See the README of [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform#usage) > The wrapper script installation can be skipped by setting the terraform_wrapper variable to false: >```yaml >steps: >- uses: hashicorp/setup-terraform@v2 > with: > terraform_wrapper: false >```
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#729
No description provided.