[GH-ISSUE #757] Environment variables defined in the container are not evaluatable #477

Closed
opened 2026-03-01 21:43:44 +03:00 by kerem · 2 comments
Owner

Originally created by @mulle-nat on GitHub (Jul 20, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/757

Originally assigned to: @catthehacker on GitHub.

System information

  • Operating System: macOS

  • Architecture: x86_64

  • Docker version: Docker version 20.10.7, build f0df350

  • Docker image used in act: catthehacker/ubuntu:act-20.04

  • act version: 0.2.23

Expected behaviour

I expected to be able to use container defined environment variables in if: statements.

name: CI

on: [push]

env:
# ENV2: # undefined here, but defined in local container 

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ ubuntu-latest] # macos-latest,

    steps:
    - name: Dump Environment
      run:  env | sort

    - name: Test
      if: ${{ env.ENV2 }} 
      run:  echo Test

Actual behaviour

ENV2 value is ignored, unless defined in workflow file.

Workflow and/or repository

See the complete workflow with step by step instructions on how to reproduce:

https://github.com/mulle-nat/act-and-github

Originally created by @mulle-nat on GitHub (Jul 20, 2021). Original GitHub issue: https://github.com/nektos/act/issues/757 Originally assigned to: @catthehacker on GitHub. <!-- - Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases) - Search the existing issues. - Refer to [README](https://github.com/nektos/act/blob/master/README.md). --> ## System information <!-- - Operating System: < Windows | Linux | macOS | etc... > - Architecture: < x64 (64-bit) | x86 (32-bit) | arm64 (64-bit) | arm (32-bit) | etc... > - Apple M1: < yes | no > - Docker version: < output of `docker system info -f "{{.ServerVersion}}"` > - Docker image used in `act`: < can be omitted if it's included in log > - `act` version: < output of `act --version`, if you've built `act` yourself, please provide commit hash > --> - Operating System: macOS - Architecture: x86_64 - Docker version: Docker version 20.10.7, build f0df350 - Docker image used in `act`: catthehacker/ubuntu:act-20.04 - `act` version: 0.2.23 ## Expected behaviour I expected to be able to use container defined environment variables in if: statements. ``` name: CI on: [push] env: # ENV2: # undefined here, but defined in local container jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest] # macos-latest, steps: - name: Dump Environment run: env | sort - name: Test if: ${{ env.ENV2 }} run: echo Test ``` ## Actual behaviour `ENV2` value is ignored, unless defined in workflow file. ## Workflow and/or repository See the complete workflow with step by step instructions on how to reproduce: https://github.com/mulle-nat/act-and-github </details>
Author
Owner

@catthehacker commented on GitHub (Jul 26, 2021):

We don't inspect Docker image for envvars, they should be in /etc/environment

<!-- gh-comment-id:887078309 --> @catthehacker commented on GitHub (Jul 26, 2021): We don't inspect Docker image for envvars, they should be in `/etc/environment`
Author
Owner

@github-actions[bot] commented on GitHub (Sep 9, 2021):

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

<!-- gh-comment-id:915653903 --> @github-actions[bot] commented on GitHub (Sep 9, 2021): Issue is stale and will be closed in 14 days unless there is new activity
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#477
No description provided.