[GH-ISSUE #1694] "depends-on" not being accounted for #839

Closed
opened 2026-03-01 21:46:49 +03:00 by kerem · 3 comments
Owner

Originally created by @lemisieur on GitHub (Mar 22, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1694

Bug report info

act version:            0.2.43
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 10
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        /var/run/docker.sock
        /Users/jpoulin/.docker/run/docker.sock
Config files:           
        /Users/jpoulin/.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.20.1
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.43
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               arm64
                GOOS:                 darwin
Docker Engine:
        Engine version:        20.10.23
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:            
        OS arch:               aarch64
        OS kernel:             5.15.49-linuxkit
        OS CPU:                2
        OS memory:             1989 MB
        Security options:
                name=seccomp,profile=default
                name=cgroupns

Command used with act

act --secret-file .secrets --workflows .github/workflows/build_backend.yml

Describe issue

It seems like even if I make jobs dependent on each others using the "depends-on" flag, they all kick off at the same time

No response

Workflow content

name: Build backend

on:
  push:
    branches: # On all branches, except for "prod"
      - "**"
      - "!prod"
    paths:
      - backend/* # Only trigger if backend files are changed
  workflow_dispatch: # Allow manual triggering of the workflow - this should be removed in production

# Set the permissions for the workflow
permissions:
  deployments: write
  packages: write
  pull-requests: write
  security-events: write
  statuses: write

env:
  IMAGE_PATH: ${{ secrets.IMAGE_REGISTRY }}/${{ secrets.IMAGE_REPOSITORY }}/${{ secrets.IMAGE_NAME_BACKEND }}
  DEV_TAG: dev-${{ github.sha }}
  PROMO_TAG: staging # Tag to use to promote the image to the upper environment

jobs:
  ##### Build the backend image and push it to the GitHub Packages registry
  build:
    name: Build backend image
    runs-on: ubuntu-latest # Run on the latest version of Ubuntu

    steps:
      # Checkout the code
      - name: Code checkout
        uses: actions/checkout@v3

      # Set up Docker Buildx
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2

      # Login to the GitHub Packages registry using the GITHUB_TOKEN
      - name: Login to Github Packages
        uses: docker/login-action@v2
        with:
          registry: ${{ secrets.IMAGE_REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      
      # Build the image and push it to the GitHub Packages registry
      - name: Build image and push to GitHub Packages
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          context: ./
          file: ./backend/Dockerfile
          tags: ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }}
          push: true

      # Output the image digest
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}
  
  ##### Scan the image for vulnerabilities
  security-scan:
    name: Image security scan
    runs-on: ubuntu-latest # Run on the latest version of Ubuntu
    depends-on: build # Only run this job if the build job was successful
    
    steps:
      # Login to the GitHub Packages registry using the GITHUB_TOKEN
      - name: Login to Github Packages
        uses: docker/login-action@v2
        with:
          registry: ${{ secrets.IMAGE_REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      # Pull the image to scan for vulnerabilities
      - name: Pull image to scan (${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }})
        run: docker pull ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }}

      # Run Snyk to scan the image for vulnerabilities
      - name: Run Snyk to check for vulnerabilities
        uses: snyk/actions/docker@master
        env:
          SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
        with:
          image: ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }}
          args: --sarif-file-output=snyk.sarif # Output the results in SARIF format for upload to GitHub Code Scanning
      
      # Upload the results to GitHub Code Scanning
      - name: Upload result to GitHub Code Scanning
        if: ${{ github.ref == 'refs/heads/staging' }} # Only upload report if coming from our upper branch
        uses: github/codeql-action/upload-sarif@v2
        with:
          sarif_file: snyk.sarif # Upload the SARIF file generated by Snyk
  
  ##### Promote the image to the upper environment
  promote-staging:
    name: Promote to "{{ env.PROMO_TAG }}" tag
    runs-on: ubuntu-latest # Run on the latest version of Ubuntu
    depends-on: security-scan # Only run this job if the security-scan job was successful
  
    steps:
      # Login to the GitHub Packages registry using the GITHUB_TOKEN
      - name: Login to Github Packages
        uses: docker/login-action@v2
        with:
          registry: ${{ secrets.IMAGE_REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      # Pull the image to promote
      - name: Pull dev image (${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }})
        run: docker pull ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }}
      
      # Tag the image with the "staging" tag
      - name: Promote "${{ env.DEV_TAG }}" to "${{ env.PROMO_TAG }}"
        run: docker tag ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }} \
             ${{ env.IMAGE_PATH }}:${{ env.PROMO_TAG }}
      
      # Push the image to the GitHub Packages registry
      - name: Push latest tag to Github Packages
        run: docker push${{ env.IMAGE_PATH }}:${{ env.PROMO_TAG }}

Relevant log output

Too long, will add as attached file to the issue

Additional information

No response

Originally created by @lemisieur on GitHub (Mar 22, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1694 ### Bug report info ```plain text act version: 0.2.43 GOOS: darwin GOARCH: arm64 NumCPU: 10 Docker host: DOCKER_HOST environment variable is unset/empty. Sockets found: /var/run/docker.sock /Users/jpoulin/.docker/run/docker.sock Config files: /Users/jpoulin/.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.20.1 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.43 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: arm64 GOOS: darwin Docker Engine: Engine version: 20.10.23 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: aarch64 OS kernel: 5.15.49-linuxkit OS CPU: 2 OS memory: 1989 MB Security options: name=seccomp,profile=default name=cgroupns ``` ### Command used with act ```sh act --secret-file .secrets --workflows .github/workflows/build_backend.yml ``` ### Describe issue It seems like even if I make jobs dependent on each others using the "depends-on" flag, they all kick off at the same time ### Link to GitHub repository _No response_ ### Workflow content ```yml name: Build backend on: push: branches: # On all branches, except for "prod" - "**" - "!prod" paths: - backend/* # Only trigger if backend files are changed workflow_dispatch: # Allow manual triggering of the workflow - this should be removed in production # Set the permissions for the workflow permissions: deployments: write packages: write pull-requests: write security-events: write statuses: write env: IMAGE_PATH: ${{ secrets.IMAGE_REGISTRY }}/${{ secrets.IMAGE_REPOSITORY }}/${{ secrets.IMAGE_NAME_BACKEND }} DEV_TAG: dev-${{ github.sha }} PROMO_TAG: staging # Tag to use to promote the image to the upper environment jobs: ##### Build the backend image and push it to the GitHub Packages registry build: name: Build backend image runs-on: ubuntu-latest # Run on the latest version of Ubuntu steps: # Checkout the code - name: Code checkout uses: actions/checkout@v3 # Set up Docker Buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 # Login to the GitHub Packages registry using the GITHUB_TOKEN - name: Login to Github Packages uses: docker/login-action@v2 with: registry: ${{ secrets.IMAGE_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # Build the image and push it to the GitHub Packages registry - name: Build image and push to GitHub Packages id: docker_build uses: docker/build-push-action@v2 with: context: ./ file: ./backend/Dockerfile tags: ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }} push: true # Output the image digest - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} ##### Scan the image for vulnerabilities security-scan: name: Image security scan runs-on: ubuntu-latest # Run on the latest version of Ubuntu depends-on: build # Only run this job if the build job was successful steps: # Login to the GitHub Packages registry using the GITHUB_TOKEN - name: Login to Github Packages uses: docker/login-action@v2 with: registry: ${{ secrets.IMAGE_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # Pull the image to scan for vulnerabilities - name: Pull image to scan (${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }}) run: docker pull ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }} # Run Snyk to scan the image for vulnerabilities - name: Run Snyk to check for vulnerabilities uses: snyk/actions/docker@master env: SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} with: image: ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }} args: --sarif-file-output=snyk.sarif # Output the results in SARIF format for upload to GitHub Code Scanning # Upload the results to GitHub Code Scanning - name: Upload result to GitHub Code Scanning if: ${{ github.ref == 'refs/heads/staging' }} # Only upload report if coming from our upper branch uses: github/codeql-action/upload-sarif@v2 with: sarif_file: snyk.sarif # Upload the SARIF file generated by Snyk ##### Promote the image to the upper environment promote-staging: name: Promote to "{{ env.PROMO_TAG }}" tag runs-on: ubuntu-latest # Run on the latest version of Ubuntu depends-on: security-scan # Only run this job if the security-scan job was successful steps: # Login to the GitHub Packages registry using the GITHUB_TOKEN - name: Login to Github Packages uses: docker/login-action@v2 with: registry: ${{ secrets.IMAGE_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # Pull the image to promote - name: Pull dev image (${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }}) run: docker pull ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }} # Tag the image with the "staging" tag - name: Promote "${{ env.DEV_TAG }}" to "${{ env.PROMO_TAG }}" run: docker tag ${{ env.IMAGE_PATH }}:${{ env.DEV_TAG }} \ ${{ env.IMAGE_PATH }}:${{ env.PROMO_TAG }} # Push the image to the GitHub Packages registry - name: Push latest tag to Github Packages run: docker push${{ env.IMAGE_PATH }}:${{ env.PROMO_TAG }} ``` ### Relevant log output ```sh Too long, will add as attached file to the issue ``` ### Additional information _No response_
kerem 2026-03-01 21:46:49 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@lemisieur commented on GitHub (Mar 22, 2023):

log.txt

<!-- gh-comment-id:1479539341 --> @lemisieur commented on GitHub (Mar 22, 2023): [log.txt](https://github.com/nektos/act/files/11040200/log.txt)
Author
Owner

@ChristopherHX commented on GitHub (Mar 22, 2023):

depends-on since when is that a valid property of a job?

<!-- gh-comment-id:1479578256 --> @ChristopherHX commented on GitHub (Mar 22, 2023): `depends-on` since when is that a valid property of a job?
Author
Owner

@lemisieur commented on GitHub (Mar 22, 2023):

Well, that's my mistake, should've been needs instead, idk where I got this depends-on from

<!-- gh-comment-id:1479791118 --> @lemisieur commented on GitHub (Mar 22, 2023): Well, that's my mistake, should've been `needs` instead, idk where I got this `depends-on` from
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#839
No description provided.